Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ompi/mca/coll/han/coll_han_subcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
(COMM)->c_coll->coll_##COLL##_module = (FALLBACKS).COLL.module; \
} while (0)

#define HAN_SUBCOM_EXTRA_RETAIN(COMM, PARENT_COMM) \
do \
{ \
if (OMPI_COMM_CID_IS_LOWER(COMM, PARENT_COMM)) { \
OMPI_COMM_SET_EXTRA_RETAIN(COMM); \
OBJ_RETAIN(COMM); \
} \
} while (0)

/*
* Routine that creates the local hierarchical sub-communicators
* Called each time a collective is called.
Expand Down Expand Up @@ -206,6 +215,11 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
HAN_SUBCOM_RESTORE_COLLECTIVE(fallbacks, comm, han_module, scatterv);

OBJ_DESTRUCT(&comm_info);

/* Ensure these communicators aren't released before the parent comm */
HAN_SUBCOM_EXTRA_RETAIN(*low_comm, comm);
HAN_SUBCOM_EXTRA_RETAIN(*up_comm, comm);

return OMPI_SUCCESS;

return_with_error:
Expand Down Expand Up @@ -376,6 +390,14 @@ int mca_coll_han_comm_create(struct ompi_communicator_t *comm,
han_module->cached_up_comms = up_comms;
han_module->cached_vranks = vranks;

/* Ensure these communicators aren't released before the parent comm */
for(int i = 0; i < COLL_HAN_LOW_MODULES; i++) {
HAN_SUBCOM_EXTRA_RETAIN(low_comms[i], comm);
}
for(int i = 0; i < COLL_HAN_UP_MODULES; i++) {
HAN_SUBCOM_EXTRA_RETAIN(up_comms[i], comm);
}

/* Reset the saved collectives to point back to HAN */
HAN_SUBCOM_RESTORE_COLLECTIVE(fallbacks, comm, han_module, alltoall);
HAN_SUBCOM_RESTORE_COLLECTIVE(fallbacks, comm, han_module, alltoallv);
Expand Down