Skip to content

Commit f377569

Browse files
authored
Merge pull request #10238 from MamziB/mamzi/multi-thread-osc
osc/ucx: flush all the outstanding transfers before cleaning up the thread local context
2 parents 49460b4 + f073d63 commit f377569

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

opal/mca/common/ucx/common_ucx_wpool.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,16 @@ static void _tlocal_ctx_rec_cleanup(_ctx_record_t *ctx_rec)
562562
opal_common_ucx_winfo_t *winfo = ctx_rec->winfo;
563563
opal_common_ucx_wpool_t *wpool = ctx_rec->gctx->wpool;
564564

565+
opal_mutex_lock(&winfo->mutex);
566+
int rc = opal_common_ucx_winfo_flush(winfo, 0, OPAL_COMMON_UCX_FLUSH_B, OPAL_COMMON_UCX_SCOPE_WORKER, NULL);
567+
winfo->global_inflight_ops = 0;
568+
memset(winfo->inflight_ops, 0, winfo->comm_size * sizeof(short));
569+
opal_mutex_unlock(&winfo->mutex);
570+
if (rc != OPAL_SUCCESS) {
571+
MCA_COMMON_UCX_ERROR("opal_common_ucx_flush failed: %d", rc);
572+
return;
573+
}
574+
565575
/* Remove worker from active and return to idle list. */
566576
_wpool_put_winfo(wpool, winfo);
567577

0 commit comments

Comments
 (0)