Skip to content

Commit 849985e

Browse files
authored
Merge pull request #10681 from jjhursey/fix-hw-guided-split
Fix MPI_COMM_TYPE_HW_GUIDED split
2 parents 26742ec + 6f1c128 commit 849985e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

ompi/communicator/comm.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key,
868868
ompi_communicator_t *newcomp = MPI_COMM_NULL;
869869
int my_size, my_rsize = 0, mode, inter;
870870
int *lranks = NULL, *rranks = NULL;
871-
int global_split_type, ok, tmp[6];
871+
int global_split_type, global_orig_split_type, ok, tmp[6];
872872
int rc;
873873
int orig_split_type = split_type;
874874

@@ -902,8 +902,10 @@ int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key,
902902
* If not the same at all ranks, throw an error.
903903
*/
904904
flag = 0;
905-
for (int i = 0; ompi_comm_split_type_hw_guided_support[i].info_value; ++i) {
906-
if (0 == strncasecmp(value->string, ompi_comm_split_type_hw_guided_support[i].info_value, strlen(ompi_comm_split_type_hw_guided_support[i].info_value))) {
905+
for (int i = 0; NULL != ompi_comm_split_type_hw_guided_support[i].info_value; ++i) {
906+
if (0 == strncasecmp(value->string,
907+
ompi_comm_split_type_hw_guided_support[i].info_value,
908+
strlen(ompi_comm_split_type_hw_guided_support[i].info_value))) {
907909
split_type = ompi_comm_split_type_hw_guided_support[i].split_type;
908910
flag = 1;
909911
break;
@@ -936,11 +938,12 @@ int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key,
936938
return rc;
937939
}
938940

939-
global_split_type = tmp[0];
941+
global_orig_split_type = tmp[0];
942+
global_split_type = tmp[4];
940943

941944
if (tmp[0] != -tmp[1] || inter) {
942945
/* at least one rank supplied a different split type check if our split_type is ok */
943-
ok = (MPI_UNDEFINED == split_type) || global_split_type == split_type;
946+
ok = (MPI_UNDEFINED == orig_split_type) || global_orig_split_type == orig_split_type;
944947

945948
rc = comm->c_coll->coll_allreduce (MPI_IN_PLACE, &ok, 1, MPI_INT, MPI_MIN, comm,
946949
comm->c_coll->coll_allreduce_module);
@@ -969,7 +972,7 @@ int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key,
969972
no_reorder = tmp[2] == -tmp[3];
970973
}
971974

972-
if (MPI_UNDEFINED == global_split_type) {
975+
if (MPI_UNDEFINED == global_orig_split_type) {
973976
/* short-circut. every rank provided MPI_UNDEFINED */
974977
*newcomm = MPI_COMM_NULL;
975978
return OMPI_SUCCESS;
@@ -990,7 +993,7 @@ int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key,
990993
* Stage 0: Recognized, but not implemented.
991994
* Stage 1: Do better than that
992995
*/
993-
if (MPI_COMM_TYPE_HW_UNGUIDED == global_split_type) {
996+
if (MPI_COMM_TYPE_HW_UNGUIDED == global_orig_split_type) {
994997
*newcomm = MPI_COMM_NULL;
995998
return OMPI_SUCCESS;
996999
}

0 commit comments

Comments
 (0)