Skip to content

Commit

Permalink
communicator: add assertion on OMPI_COMM_DISJOINT flag
Browse files Browse the repository at this point in the history
This patch introduces assertions to verify that sub-communicators
are created with the expected OMPI_COMM_DISJOINT* flags.

Signed-off-by: Wenduo Wang <[email protected]>
  • Loading branch information
wenduwan committed Dec 2, 2023
1 parent a1cf411 commit 61c9403
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ompi/mca/coll/han/coll_han_subcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ int mca_coll_han_comm_create(struct ompi_communicator_t *comm,
opal_info_set(&comm_info, "ompi_comm_coll_preference", "tuned,^han");
ompi_comm_split_type(comm, MPI_COMM_TYPE_SHARED, 0,
&comm_info, &(low_comms[0]));
assert(OMPI_COMM_IS_DISJOINT_SET(low_comms[0]) && !OMPI_COMM_IS_DISJOINT(low_comms[0]));

/*
* Get my local rank and the local size
Expand All @@ -296,6 +297,7 @@ int mca_coll_han_comm_create(struct ompi_communicator_t *comm,
opal_info_set(&comm_info, "ompi_comm_coll_preference", "sm,^han");
ompi_comm_split_type(comm, MPI_COMM_TYPE_SHARED, 0,
&comm_info, &(low_comms[1]));
assert(OMPI_COMM_IS_DISJOINT_SET(low_comms[1]) && !OMPI_COMM_IS_DISJOINT(low_comms[1]));

/*
* Upgrade libnbc module priority to set up up_comms[0] with libnbc module
Expand All @@ -304,15 +306,16 @@ int mca_coll_han_comm_create(struct ompi_communicator_t *comm,
*/
opal_info_set(&comm_info, "ompi_comm_coll_preference", "libnbc,^han");
ompi_comm_split_with_info(comm, low_rank, w_rank, &comm_info, &(up_comms[0]), false);

up_rank = ompi_comm_rank(up_comms[0]);
assert(OMPI_COMM_IS_DISJOINT_SET(up_comms[0]) && OMPI_COMM_IS_DISJOINT(up_comms[0]));

/*
* Upgrade adapt module priority to set up up_comms[0] with adapt module
* This sub-communicator contains one process per node.
*/
opal_info_set(&comm_info, "ompi_comm_coll_preference", "adapt,^han");
ompi_comm_split_with_info(comm, low_rank, w_rank, &comm_info, &(up_comms[1]), false);
assert(OMPI_COMM_IS_DISJOINT_SET(up_comms[1]) && OMPI_COMM_IS_DISJOINT(up_comms[1]));

/*
* Set my virtual rank number.
Expand Down Expand Up @@ -350,5 +353,3 @@ int mca_coll_han_comm_create(struct ompi_communicator_t *comm,
OBJ_DESTRUCT(&comm_info);
return OMPI_SUCCESS;
}


0 comments on commit 61c9403

Please sign in to comment.