Dear all:

I ran this simple fortran code and got unexpected result:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
program reduce
implicit none

include 'mpif.h'

integer :: ierr, rank
real*8 :: send(5)

call mpi_init(ierr)
call mpi_comm_rank(mpi_comm_world,rank,ierr)

send = real(rank)

print *, rank,':',send
call
mpi_allreduce(MPI_IN_PLACE,send,size(send),mpi_real8,mpi_sum,mpi_comm_world,ierr)
print *, rank,'#',send

call mpi_finalize(ierr)

end program reduce

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

When running with 3 processes

mpirun -np 3 reduce

The results I'm expecting is the sum of all 3 vectors, but I got the
unexpected result:

          0 :   0.0000000000000000        0.0000000000000000
0.0000000000000000        0.0000000000000000        0.0000000000000000
           2 :   2.0000000000000000        2.0000000000000000
2.0000000000000000        2.0000000000000000        2.0000000000000000
           1 :   1.0000000000000000        1.0000000000000000
1.0000000000000000        1.0000000000000000        1.0000000000000000
           0 #   0.0000000000000000        0.0000000000000000
0.0000000000000000        0.0000000000000000        0.0000000000000000
           1 #   0.0000000000000000        0.0000000000000000
0.0000000000000000        0.0000000000000000        0.0000000000000000
           2 #   0.0000000000000000        0.0000000000000000
0.0000000000000000        0.0000000000000000        0.0000000000000000


During compilation and running there were no errors or warnings.  I install
openMPI via fink.  I believe somehow fink messed up during installation.
Instead of installing MPI from source (which takes hours on my machine), I
would like to know if there is a better than to find out what the problem
is, so that I could fix my current installation rather than reinstall MPI
from scratch.

-- 
David Zhang
University of California, San Diego

Reply via email to