I would like to be able to get a unique id for a certain communicator but this seems an impossible task when you get this communicator by a MPI_Comm_split()
call. I know when MPI_Comm_split()
is called collectively each of the resulting disjoint communicators has the same context ID yet different group information. I expected by calling MPI_Comm_group()
, the group handler associated to a certain communicator would be different for each communicator created by the split, but is the same in all of them!
[CODE]
#include <mpi.h>
#include <stdio.h>
int main() {
MPI_Init(NULL, NULL);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm split_comm;
MPI_Comm_split(MPI_COMM_WORLD, rank / 3, rank, &split_comm);
int split_rank;
MPI_Group split_group;
MPI_Comm_group(split_comm, &split_group);
MPI_Comm_rank(split_comm, &split_rank);
printf("rank: %d| comm: %u, group: %u\n", split_rank, split_comm, split_group);
}
If one runs the code above with mpirun -np 6 ./exec
the result is:
rank: 0| comm: 2214592516, group: 2281701376
rank: 1| comm: 2214592514, group: 2281701376
rank: 2| comm: 2214592514, group: 2281701376
rank: 0| comm: 2214592514, group: 2281701376
rank: 1| comm: 2214592514, group: 2281701376
rank: 2| comm: 2214592514, group: 2281701376
So it makes impossible to identify which of the two communicators a process belongs to.
Is there any way of getting an id which identifies uniquely a communicator?
split_rank
to go from 0 to 5... – Gilles