Skip to content

Reorder the topology to match the new ranks. #11793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2023
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
15 changes: 12 additions & 3 deletions ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011-2017 The University of Tennessee and The University
* Copyright (c) 2011-2023 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2011-2018 Inria. All rights reserved.
Expand Down Expand Up @@ -705,7 +705,6 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module,
if (OMPI_SUCCESS != (err = ompi_comm_split(comm_old, 0, newrank, newcomm, false))) {
goto release_and_return;
}
/* end of TODO */

/* Attach the dist_graph to the newly created communicator */
(*newcomm)->c_flags |= OMPI_COMM_DIST_GRAPH;
Expand Down Expand Up @@ -945,7 +944,6 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module,
free(grank_to_lrank);
goto release_and_return;
}
/* end of TODO */

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

/* Translate the ranks provided by the user to account for the reordered communicator.
* Note that this operation is safe to be done in place, directly into the in/out arrays.
*/
ompi_group_translate_ranks(comm_old->c_remote_group, topo->indegree,
topo->in,
(*newcomm)->c_remote_group,
topo->in);
ompi_group_translate_ranks(comm_old->c_remote_group, topo->outdegree,
topo->out,
(*newcomm)->c_remote_group,
topo->out);
release_and_return:
if (NULL != reqs ) free(reqs);
if (NULL != tracker) free(tracker);
Expand Down