Is it possible to micromanage a Cartesian topology for a
sub-(group-)communicator?
E.g., Using mpi_cart_create on mpi_comm_world, I create the following
topology:
rank vs. 2D Cartesian position
3 7 11
2 6 10
1 5 9
0 4 8
Can I now create a new sub-communicator with ranks 0, 9, 6, and 11
(precisely one rank in each row) -- and attached to it a Cartesian
topology (still 2D, except the dimension is 1 in the second
direction):
11
6
9
0
Importantly, the order is [0, 9, 6, 11] and not, e.g., [0, 6, 9, 11].
I've found that mpi_cart_create, called with the subcommunicator, will do
what I want (though it renames the ranks 0->0, 9->1, 6->2, 11->3), but is
that guaranteed?
Questions:
- Is mpi_cart_create, called on a subcommunicator with 1 rank per row,
guaranteed to preserve the topology in the other dimensions?
- If not, is there a way I can specify the Cartesian topology, so that,
e.g., mpi_cart_coords works?
- Is there a way to prevent the renaming of the ranks, or do Cartesian
communicators have to have sequential ranks?
Motivation: I want these ranks to collect all the data from their entire
row, e.g., for I/O. I have a collection of methods that manipulate data,
but they make use of functions like mpi_cart_coords, and it would be nice
if I didn't have to re-implement all those functions. I could use
mpi_cart_sub -- except that there's a danger that ranks 0,
1, 2, 3 will be on the same compute node, so I don't want those
particular ranks each to collect all the data from their rows.
A related question: is there a way, within MPI, to specify how
mpi_cart_create orders the ranks, e.g.,
3 7 11
2 6 10
1 5 9
0 4 8
vs.
9 10 11
6 7 8
3 4 5
0 1 2
Thanks,
Greg.