views:

58

answers:

2

I used MPI_Comm_split to split the default MPI communicator.If initially there were 10 processes in default communicator ,MPI_COMM_WORLD and ,say, their ranks were identified by id_original. The new communicator consisted of 4 processes with id_original 6,7,8,9.These processes will have ranks defined by , say , id_new in the new communicator. What will be the relation between ranks of processes in these two communicators. Will the processes with id_original 6,7,8,9 will have new ranks 0,1,2,3 respectively in the new communicator or the ordering might be different?

+1  A: 

You should use the "key" argument to MPI_Comm_split to control the order in the new communicator. For example, you could use the rank in MPI_Comm_world (or your "id_original") as the key, like so:

MPI_Comm_split( MPI_COMM_WORLD, id_original >= 6 && id_original <= 9,
                id_original, &newComm ); 
Edric
+1  A: 

According to this (emphasis by me):

Within each subgroup, the processes are ranked in the order defined by the value of the argument key, with ties broken according to their rank in the old group.

So yes, if processes 6-9 provide the same value for key, then they will get ranks 0-3 in the new communicator, respectively. If this is crucial for the correctness of the program, though, then you should make this arrangement explicit in your code using Edric's method.

suszterpatt