I am trying to use MPI_Alltoall in the following program. After
execution all the nodes should show same value for the array su.
However only the root node is showing correct value. other nodes are giving 
garbage value. Please help.

I have used openmpi version "1.1.4". The mpif90 uses intel fortran

cbasu

------------------------------------------------
program main
implicit none
include 'mpif.h'

integer :: status(MPI_Status_size)
integer :: ierr, rank, nProcs
double precision :: s
double precision, pointer :: su(:)

call MPI_Init (ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, nProcs, ierr)

allocate(su(nProcs))
su = 0.0d0
s = 1.0d0
call MPI_Alltoall(s, 1, MPI_DOUBLE_PRECISION, su, 1, &
       & MPI_DOUBLE_PRECISION, MPI_COMM_WORLD, ierr);

! all nodes should have su(1:nProcs) = 1.0 at this pont
print *, rank, su

deallocate(su)

call MPI_Finalize(ierr)
end program main
----------------------------------------------

Reply via email to