Skip to content

Commit 4a1c3af

Browse files
authored
Merge pull request #10381 from MamziB/mamzi/ucx-fence
OSC/UCX: Adding the wpool fence function
2 parents 20b210d + 1ba6464 commit 4a1c3af

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

opal/mca/common/ucx/common_ucx_wpool.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,34 @@ OPAL_DECLSPEC int opal_common_ucx_wpmem_flush(opal_common_ucx_wpmem_t *mem,
858858

859859
OPAL_DECLSPEC int opal_common_ucx_wpmem_fence(opal_common_ucx_wpmem_t *mem)
860860
{
861-
/* TODO */
862-
return OPAL_SUCCESS;
861+
ucs_status_t status = UCS_OK;
862+
_ctx_record_t *ctx_rec;
863+
opal_common_ucx_winfo_t *winfo;
864+
opal_common_ucx_ctx_t *ctx;
865+
int rc = OPAL_SUCCESS;
866+
867+
if (NULL == mem) {
868+
return OPAL_SUCCESS;
869+
}
870+
871+
ctx = mem->ctx;
872+
opal_mutex_lock(&ctx->mutex);
873+
874+
OPAL_LIST_FOREACH (ctx_rec, &ctx->ctx_records, _ctx_record_t) {
875+
winfo = ctx_rec->winfo;
876+
opal_mutex_lock(&winfo->mutex);
877+
status = ucp_worker_fence(winfo->worker);
878+
opal_mutex_unlock(&winfo->mutex);
879+
if (status != UCS_OK) {
880+
MCA_COMMON_UCX_ERROR("opal_common_ucx_fence failed: %d", rc);
881+
rc = OPAL_ERROR;
882+
break;
883+
}
884+
}
885+
886+
opal_mutex_unlock(&ctx->mutex);
887+
888+
return rc;
863889
}
864890

865891
OPAL_DECLSPEC void opal_common_ucx_req_init(void *request)

0 commit comments

Comments
 (0)