Skip to content

Commit f666d75

Browse files
xinzhao3Tomislav Janjusic
authored andcommitted
ompi/oshmem/spml/ucx: fix eps destroy in shmem_ctx_destroy().
Signed-off-by: Tomislav Janjusic <[email protected]> (cherry picked from commit 79ba752)
1 parent 15cfba5 commit f666d75

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,17 +607,31 @@ void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx)
607607

608608
MCA_SPML_CALL(quiet(ctx));
609609

610+
oshmem_shmem_barrier();
611+
610612
SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex);
611613

612614
/* delete context object from list */
613615
OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list),
614616
mca_spml_ucx_ctx_list_item_t) {
615617
if ((shmem_ctx_t)(&ctx_item->ctx) == ctx) {
616618
opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super);
617-
for (i = 0; i < nprocs; i++) {
618-
ucp_ep_destroy(ctx_item->ctx.ucp_peers[i].ucp_conn);
619+
620+
opal_common_ucx_del_proc_t *del_procs;
621+
del_procs = malloc(sizeof(*del_procs) * nprocs);
622+
623+
for (i = 0; i < nprocs; ++i) {
624+
del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn;
625+
del_procs[i].vpid = i;
626+
ctx_item->ctx.ucp_peers[i].ucp_conn = NULL;
619627
}
628+
629+
opal_common_ucx_del_procs(del_procs, nprocs, oshmem_my_proc_id(),
630+
mca_spml_ucx.num_disconnect,
631+
ctx_item->ctx.ucp_worker);
632+
free(del_procs);
620633
free(ctx_item->ctx.ucp_peers);
634+
621635
ucp_worker_destroy(ctx_item->ctx.ucp_worker);
622636
OBJ_RELEASE(ctx_item);
623637
break;

0 commit comments

Comments
 (0)