[mpich-discuss] Value of fortran communicator handles

Kenneth Raffenetti raffenet at mcs.anl.gov
Tue May 20 09:39:04 CDT 2014


Marco,

Yes, this is expected. Communicator handles are opaque objects. No 
guarantees are made by MPI about their values to the user. To reason 
about them, you need to use MPI_COMM_COMPARE.

Ken

On 05/20/2014 09:33 AM, marco restelli wrote:
> Hi,
>     I noticed that the attached fortran code produces this output:
>
> $ mpiexec -n 4 -l ./mpitest
> [0]  color =            1 ; newcomm =  -2080374780
> [1]  color =            1 ; newcomm =  -2080374782
> [2]  color =            2 ; newcomm =  -2080374782
> [3]  color =            2 ; newcomm =  -2080374782
>
> I know that I am not supposed to use the values of the communicator
> handles, but I was surprised to see that two processors in the same
> communicator have two different values for such an handle.
>
> More precisely, I was assuming that newcomm had one value on procs 0
> and 1 and another value on 2 and 3.
>
> So my question is whether this is the expected behaviour or not. (In
> fact, I need to debug another problem in my code and I wonder whether
> this could be related or not).
>
> Thank you,
>     Marco
>
>
>
> mpich: version 1.5
> gfortran: 4.7.3
>
>
>
> program mpitest
>
>   implicit none
>   include "mpif.h"
>
>   integer :: key, color, newcomm, mpi_id, ierr
>
>    call mpi_init(ierr)
>    call mpi_comm_rank(mpi_comm_world,mpi_id,ierr)
>
>    key = 1 ! same ordering as in comm
>    select case(mpi_id)
>     case(0)
>      color = 1
>     case(1)
>      color = 1
>     case(2)
>      color = 2
>     case(3)
>      color = 2
>    end select
>    call mpi_comm_split( mpi_comm_world , color,key , newcomm , ierr)
>
>    write(*,*) "color = ",color, "; newcomm = ",newcomm
>
>    call mpi_finalize(ierr)
>
> end program mpitest
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
>



More information about the discuss mailing list