On Aug 1, 2017, at 5:56 AM, Diego Avesani <diego.aves...@gmail.com> wrote:
> 
> If I do this:
> 
> CALL MPI_SCATTER(PP, npart, MPI_DOUBLE, PPL, 10,MPI_DOUBLE, 0, MASTER_COMM, 
> iErr)
> 
> I get an error. This because some CPU does not belong to MATER_COMM. The 
> alternative should be:
> 
> IF(rank.LT.0)THEN
>     CALL MPI_SCATTER(PP, npart, MPI_DOUBLE, PPL, 10,MPI_DOUBLE, 0, 
> MASTER_COMM, iErr)
> ENDIF

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.

That 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.

-- 
Jeff Squyres
jsquy...@cisco.com

_______________________________________________
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users

Reply via email to