My question is probably stupid but still I'm gonna ask it to be sure !
Question : Do you expect the two codes below to work the same using MPI_Comm_Split to build 1 sub-communicator ? (for example, let's say I'm running the code with 6 procs with a rank between 0 and 5)
NB : The code is in fortran 90 with intel compiler 2019 and I use Mpich for the Mpi.
CODE 1
call Mpi_Init(ierror)
call Mpi_Comm_Rank(mpi_comm_world,rank,ierror)
if (rank > 2) then
call Mpi_Comm_Split(mpi_comm_world,0,rank,new_comm,ierror)
else
call Mpi_Comm_Split(mpi_comm_world,mpi_undefined,rank,new_comm,ierror)
endif
CODE 2
call Mpi_Init(ierror)
call Mpi_Comm_Rank(mpi_comm_world,rank,ierror)
if (rank > 2) then
color = 0
else
color = mpi_undefined
endif
call Mpi_Comm_Split(mpi_comm_world,color,rank,new_comm,ierror)
The Mpi_Comm_Split is not called the same way in the 2 codes but to me, it should behave the same but I'm not sure... I read that Mpi_Comm_Split has to be invoked at the same line but how procs can know that the call of Mpi_Comm_Split is done at a one line or another one (it doesn't make anysense to me) ?!
NB : With Mpich and intel fortran, I tested it and both implentation of the communicator splitting works, but I'm afraid of the behavior of different Mpi compilers...