Skip to content

Commit 0e32b0a

Browse files
committed
Avoid a lock if no CUDA IPC operations are pending.
Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
1 parent fd4ca39 commit 0e32b0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

opal/mca/common/cuda/common_cuda.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static int cuda_event_ipc_first_avail, cuda_event_dtoh_first_avail, cuda_event_h
182182
static int cuda_event_ipc_first_used, cuda_event_dtoh_first_used, cuda_event_htod_first_used;
183183

184184
/* Number of status items currently in use */
185-
static int cuda_event_ipc_num_used, cuda_event_dtoh_num_used, cuda_event_htod_num_used;
185+
static volatile int cuda_event_ipc_num_used, cuda_event_dtoh_num_used, cuda_event_htod_num_used;
186186

187187
/* Size of array holding events */
188188
int cuda_event_max = 400;
@@ -1507,6 +1507,9 @@ void *mca_common_cuda_get_htod_stream(void) {
15071507
int progress_one_cuda_ipc_event(struct mca_btl_base_descriptor_t **frag) {
15081508
CUresult result;
15091509

1510+
if( OPAL_LIKELY(0 == cuda_event_ipc_num_used) )
1511+
return 0;
1512+
15101513
OPAL_THREAD_LOCK(&common_cuda_ipc_lock);
15111514
if (cuda_event_ipc_num_used > 0) {
15121515
opal_output_verbose(20, mca_common_cuda_output,

0 commit comments

Comments
 (0)