File tree 4 files changed +68
-0
lines changed
4 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 21
21
static opal_mutex_t wait_sync_lock = OPAL_MUTEX_STATIC_INIT ;
22
22
static ompi_wait_sync_t * wait_sync_list = NULL ;
23
23
24
+ void wait_sync_global_wakeup_st (int status )
25
+ {
26
+ ompi_wait_sync_t * sync ;
27
+ for ( sync = wait_sync_list ; sync != NULL ; sync = sync -> next ) {
28
+ wait_sync_update (sync , 0 , status );
29
+ }
30
+ }
31
+
32
+ void wait_sync_global_wakeup_mt (int status )
33
+ {
34
+ ompi_wait_sync_t * sync ;
35
+ opal_mutex_lock (& wait_sync_lock );
36
+ for ( sync = wait_sync_list ; sync != NULL ; sync = sync -> next ) {
37
+ /* sync_update is going to take the sync->lock from within
38
+ * the wait_sync_lock. Thread lightly here: Idealy we should
39
+ * find a way to not take a lock in a lock as this is deadlock prone,
40
+ * but as of today we are the only place doing this so it is safe.
41
+ */
42
+ wait_sync_update (sync , 0 , status );
43
+ if ( sync -> next == wait_sync_list ) break ; /* special case for rings */
44
+ }
45
+ opal_mutex_unlock (& wait_sync_lock );
46
+ }
47
+
24
48
static opal_atomic_int32_t num_thread_in_progress = 0 ;
25
49
26
50
#define WAIT_SYNC_PASS_OWNERSHIP (who ) \
Original file line number Diff line number Diff line change @@ -103,4 +103,14 @@ static inline int sync_wait_st(ompi_wait_sync_t *sync)
103
103
} \
104
104
} while (0)
105
105
106
+ /**
107
+ * Wake up all syncs with a particular status. If status is OMPI_SUCCESS this
108
+ * operation is a NO-OP. Otherwise it will trigger the "error condition" from
109
+ * all registered sync.
110
+ */
111
+ OPAL_DECLSPEC void wait_sync_global_wakeup_st (int status );
112
+ OPAL_DECLSPEC void wait_sync_global_wakeup_mt (int status );
113
+ #define wait_sync_global_wakeup (st ) (opal_using_threads()? wait_sync_global_wakeup_mt(st): wait_sync_global_wakeup_st(st))
114
+
115
+
106
116
#endif /* OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_WAIT_SYNC_H */
Original file line number Diff line number Diff line change 21
21
static opal_mutex_t wait_sync_lock = OPAL_MUTEX_STATIC_INIT ;
22
22
static ompi_wait_sync_t * wait_sync_list = NULL ;
23
23
24
+ void wait_sync_global_wakeup_st (int status )
25
+ {
26
+ ompi_wait_sync_t * sync ;
27
+ for ( sync = wait_sync_list ; sync != NULL ; sync = sync -> next ) {
28
+ wait_sync_update (sync , 0 , status );
29
+ }
30
+ }
31
+
32
+ void wait_sync_global_wakeup_mt (int status )
33
+ {
34
+ ompi_wait_sync_t * sync ;
35
+ opal_mutex_lock (& wait_sync_lock );
36
+ for ( sync = wait_sync_list ; sync != NULL ; sync = sync -> next ) {
37
+ /* sync_update is going to take the sync->lock from within
38
+ * the wait_sync_lock. Thread lightly here: Idealy we should
39
+ * find a way to not take a lock in a lock as this is deadlock prone,
40
+ * but as of today we are the only place doing this so it is safe.
41
+ */
42
+ wait_sync_update (sync , 0 , status );
43
+ if ( sync -> next == wait_sync_list ) break ; /* special case for rings */
44
+ }
45
+ opal_mutex_unlock (& wait_sync_lock );
46
+ }
47
+
24
48
static opal_atomic_int32_t num_thread_in_progress = 0 ;
25
49
26
50
#define WAIT_SYNC_PASS_OWNERSHIP (who ) \
Original file line number Diff line number Diff line change @@ -103,4 +103,14 @@ static inline int sync_wait_st(ompi_wait_sync_t *sync)
103
103
} while (0)
104
104
105
105
106
+ /**
107
+ * Wake up all syncs with a particular status. If status is OMPI_SUCCESS this
108
+ * operation is a NO-OP. Otherwise it will trigger the "error condition" from
109
+ * all registered sync.
110
+ */
111
+ OPAL_DECLSPEC void wait_sync_global_wakeup_st (int status );
112
+ OPAL_DECLSPEC void wait_sync_global_wakeup_mt (int status );
113
+ #define wait_sync_global_wakeup (st ) (opal_using_threads()? wait_sync_global_wakeup_mt(st): wait_sync_global_wakeup_st(st))
114
+
115
+
106
116
#endif /* OPAL_MCA_THREADS_QTHREADS_THREADS_QTHREADS_WAIT_SYNC_H */
You can’t perform that action at this time.
0 commit comments