[mpich-discuss] Value of fortran communicator handles

marco restelli mrestelli at gmail.com
Tue May 20 09:33:09 CDT 2014


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



More information about the discuss mailing list