Hello,

I'm trying to run this bit of code:

program test
use mpi
integer :: ierr, myrank, a(2) = 0
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD,myrank,ierr)
if (myrank == 0) a(1) = 1; a(2) = 2
if (myrank == 1) a(1) = 3; a(2) = 4
call
MPI_Allreduce(MPI_IN_PLACE,a,2,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,ierr)
write(*,*) myrank, a(:)
call MPI_Finalize(ierr)
end program test

but the output is not what I'd expect:

$ openmpif90 test.f90
$ openmpirun -np 2 a.out
           0           0           0
           1           0           0

I tried a version without MPI_IN_PLACE and the call to MPI_Allreduce
works fine in that case.  Am I doing something wrong with MPI_IN_PLACE? 
I'm using OpenMPI 1.6.5 compiled with gcc 4.8.1 on Mac OS 10.8.

Thanks,
-- 
  Hugo Gagnon

Reply via email to