Skip to content

Commit 79ba752

Browse files
xinzhao3Tomislav Janjusic
authored andcommitted
ompi/oshmem/spml/ucx: fix eps destroy in shmem_ctx_destroy().
Signed-off-by: Tomislav Janjusic <tomislavj@mellanox.com>
1 parent b00209e commit 79ba752

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
@@ -604,17 +604,31 @@ void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx)
604604

605605
MCA_SPML_CALL(quiet(ctx));
606606

607+
oshmem_shmem_barrier();
608+
607609
SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex);
608610

609611
/* delete context object from list */
610612
OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list),
611613
mca_spml_ucx_ctx_list_item_t) {
612614
if ((shmem_ctx_t)(&ctx_item->ctx) == ctx) {
613615
opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super);
614-
for (i = 0; i < nprocs; i++) {
615-
ucp_ep_destroy(ctx_item->ctx.ucp_peers[i].ucp_conn);
616+
617+
opal_common_ucx_del_proc_t *del_procs;
618+
del_procs = malloc(sizeof(*del_procs) * nprocs);
619+
620+
for (i = 0; i < nprocs; ++i) {
621+
del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn;
622+
del_procs[i].vpid = i;
623+
ctx_item->ctx.ucp_peers[i].ucp_conn = NULL;
616624
}
625+
626+
opal_common_ucx_del_procs(del_procs, nprocs, oshmem_my_proc_id(),
627+
mca_spml_ucx.num_disconnect,
628+
ctx_item->ctx.ucp_worker);
629+
free(del_procs);
617630
free(ctx_item->ctx.ucp_peers);
631+
618632
ucp_worker_destroy(ctx_item->ctx.ucp_worker);
619633
OBJ_RELEASE(ctx_item);
620634
break;

0 commit comments

Comments
 (0)