I was commenting on one of Diego's previous solutions where all non-master
processes were using the color set to MPI_COMM_NULL in MPI_COMM_SPLIT.
cleanest solution.
George.
Post by Jeff Squyres (jsquyres)George --
Just to be clear, I was not suggesting that he split on a color of
-----
CALL MPI_GROUP_INCL(GROUP_WORLD, nPSObranch, MRANKS, MASTER_GROUP,ierr)
CALL MPI_COMM_CREATE_GROUP(MPI_COMM_WORLD,MASTER_GROUP,0,
MASTER_COMM,iErr)
!
IF(MPI_COMM_NULL .NE. MASTER_COMM)THEN
CALL MPI_COMM_RANK(MASTER_COMM, MPImaster%rank,MPIlocal%iErr)
CALL MPI_COMM_SIZE(MASTER_COMM, MPImaster%nCPU,MPIlocal%iErr)
ELSE
MPImaster%rank = MPI_PROC_NULL
ENDIF
...
IF(MPImaster%rank.GE.0)THEN
CALL MPI_SCATTER(PP, 10, MPI_DOUBLE, PPL, 10,MPI_DOUBLE, 0, MASTER_COMM, iErr)
ENDIF
-----
In particular, the last "IF(MPImaster%rank.GE.0)" -- he's checking to see
if the MPImaster%rank was set to MPI_PROC_NULL. I was just suggesting that
he change that to "IF(MPI_COMM_NULL .NE. MASTER_COMM)" -- i.e., he
shouldn't make any assumptions about the value of MPI_PROC_NULL, etc.
Post by George BosilcaDiego,
Setting the color to MPI_COMM_NULL is not good, as it results in some
random value (and not the MPI_UNDEFINED that do not generate a
communicator). Change the color to MPI_UNDEFINED and your application
should work just fine (in the sense that all processes not in the master
communicator will have the master_comm variable set to MPI_COMM_NULL).
Post by George BosilcaGeorge.
Dear Jeff, Dear all,
thanks, I will try immediately.
thanks again
Diego
Just like in your original code snippet, you can
If (master_comm .ne. Mpi_comm_null) then
...
Sent from my phone. No type good.
Dear all, Dear Jeff,
I am very sorry, but I do not know how to do this kind of comparison.
CALL MPI_GROUP_INCL(GROUP_WORLD, nPSObranch, MRANKS, MASTER_GROUP,ierr)
CALL MPI_COMM_CREATE_GROUP(MPI_COMM_WORLD,MASTER_GROUP,0,
MASTER_COMM,iErr)
Post by George Bosilca!
IF(MPI_COMM_NULL .NE. MASTER_COMM)THEN
CALL MPI_COMM_RANK(MASTER_COMM, MPImaster%rank,MPIlocal%iErr)
CALL MPI_COMM_SIZE(MASTER_COMM, MPImaster%nCPU,MPIlocal%iErr)
ELSE
MPImaster%rank = MPI_PROC_NULL
ENDIF
and then
IF(MPImaster%rank.GE.0)THEN
CALL MPI_SCATTER(PP, 10, MPI_DOUBLE, PPL, 10,MPI_DOUBLE, 0,
MASTER_COMM, iErr)
Post by George BosilcaENDIF
What I should compare?
Thanks again
Diego
CALL MPI_SCATTER(PP, npart, MPI_DOUBLE, PPL, 10,MPI_DOUBLE, 0,
MASTER_COMM, iErr)
Post by George BosilcaI get an error. This because some CPU does not belong to MATER_COMM.
IF(rank.LT.0)THEN
CALL MPI_SCATTER(PP, npart, MPI_DOUBLE, PPL, 10,MPI_DOUBLE, 0,
MASTER_COMM, iErr)
Post by George BosilcaENDIF
MPI_PROC_NULL is a sentinel value; I don't think you can make any
assumptions about its value (i.e., that it's negative). In practice, it
probably always is, but if you want to check the rank, you should compare
it to MPI_PROC_NULL.
Post by George BosilcaThat being said, comparing MASTER_COMM to MPI_COMM_NULL is no more
expensive than comparing an integer. So that might be a bit more expressive
to read / easier to maintain over time, and it won't cost you any
performance.
Post by George Bosilca--
Jeff Squyres
_______________________________________________
users mailing list
https://lists.open-mpi.org/mailman/listinfo/users
_______________________________________________
users mailing list
https://lists.open-mpi.org/mailman/listinfo/users
_______________________________________________
users mailing list
https://lists.open-mpi.org/mailman/listinfo/users
_______________________________________________
users mailing list
https://lists.open-mpi.org/mailman/listinfo/users
_______________________________________________
users mailing list
https://lists.open-mpi.org/mailman/listinfo/users
--
Jeff Squyres
_______________________________________________
users mailing list
https://lists.open-mpi.org/mailman/listinfo/users