Skip to content

Commit 5435430

Browse files
authored
Merge pull request #11793 from bosilca/topic/11756
Reorder the topology to match the new ranks.
2 parents b827868 + 6a9c5da commit 5435430

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2011-2017 The University of Tennessee and The University
3+
* Copyright (c) 2011-2023 The University of Tennessee and The University
44
* of Tennessee Research Foundation. All rights
55
* reserved.
66
* Copyright (c) 2011-2018 Inria. All rights reserved.
@@ -705,7 +705,6 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module,
705705
if (OMPI_SUCCESS != (err = ompi_comm_split(comm_old, 0, newrank, newcomm, false))) {
706706
goto release_and_return;
707707
}
708-
/* end of TODO */
709708

710709
/* Attach the dist_graph to the newly created communicator */
711710
(*newcomm)->c_flags |= OMPI_COMM_DIST_GRAPH;
@@ -945,7 +944,6 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module,
945944
free(grank_to_lrank);
946945
goto release_and_return;
947946
}
948-
/* end of TODO */
949947

950948
/* Attach the dist_graph to the newly created communicator */
951949
(*newcomm)->c_flags |= OMPI_COMM_DIST_GRAPH;
@@ -956,6 +954,17 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module,
956954
free(lrank_to_grank);
957955
} /* distributed reordering end */
958956

957+
/* Translate the ranks provided by the user to account for the reordered communicator.
958+
* Note that this operation is safe to be done in place, directly into the in/out arrays.
959+
*/
960+
ompi_group_translate_ranks(comm_old->c_remote_group, topo->indegree,
961+
topo->in,
962+
(*newcomm)->c_remote_group,
963+
topo->in);
964+
ompi_group_translate_ranks(comm_old->c_remote_group, topo->outdegree,
965+
topo->out,
966+
(*newcomm)->c_remote_group,
967+
topo->out);
959968
release_and_return:
960969
if (NULL != reqs ) free(reqs);
961970
if (NULL != tracker) free(tracker);

0 commit comments

Comments
 (0)