I'm trying to run this bit of code:
integer :: ierr, myrank, a(2) = 0
if (myrank == 0) a(1) = 1; a(2) = 2
if (myrank == 1) a(1) = 3; a(2) = 4
write(*,*) myrank, a(:)
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.