MPI_Put is nonblocking. You are changing the contents of the source buffer before the put is complete. Rajeev On Mar 29, 2013, at 12:01 PM, Timothy Stitt wrote:
Hi all,
I've come across some strange behavior with a code that uses MPI_PUT(). I can confirm that this problem appears in older MPICH2 v1.4.x releases as well as the latest MPICH v3.0.3 release. I can also confirm that I receive the correct results when using Open MPI.
I am attaching a reproducer code below that simulates the problem I am having (following the code will hopefully explain its purpose better than what I can describe here in a few lines). This case is hardcoded for a 4-process run. For some reason MPICH implementations are losing some data elements and duplicating others after the communication is complete. I would be grateful if someone can confirm whether this is indeed an implementation bug or a subtle problem with how I've implemented the one-sided communication.
Thanks in advance,
Tim.
program reproducer
use mpi
implicit none
integer :: error,dum_com(2),my_rank,i integer :: win_values_points, type_integer,NProc=4 INTEGER(KIND=MPI_ADDRESS_KIND) :: win_values_size, target_disp integer,allocatable :: neighbor_values(:), ncount_in(:)
call MPI_INIT(error) call MPI_COMM_RANK(MPI_COMM_WORLD,my_rank,error)
CALL MPI_Type_size(MPI_INTEGER,type_integer,error)
! Calculate Size Of Window (in bytes) win_values_size=2*type_integer*NProc
! Allocate Window Storage allocate(neighbor_values(0:2*Nproc-1)) neighbor_values=0
! Define Input Values allocate(ncount_in(NProc)) if (my_rank .eq. 0) ncount_in = (/1,2,3,4/) if (my_rank .eq. 1) ncount_in = (/5,6,7,8/) if (my_rank .eq. 2) ncount_in = (/9,10,11,12/) if (my_rank .eq. 3) ncount_in = (/13,14,15,16/)
! Create Window CALL MPI_WIN_CREATE(neighbor_values, win_values_size, type_integer, MPI_INFO_NULL, MPI_COMM_WORLD, win_values_points, error) ! Create Neighbor Storage Win dow call MPI_Win_Fence(0,win_values_points,error)
! Print pre-communication data print*,my_rank,ncount_in call flush(5) call MPI_BARRIER(MPI_COMM_WORLD,error)
! Communicate Data Values to all proceses do i = 1,4 target_disp=2*my_rank dum_com(1)=ncount_in(i) dum_com(2)=99 CALL MPI_PUT(dum_com,2,MPI_INTEGER,Nproc-i,target_disp,2,MPI_INTEGER,win_values_points,error) end do
call MPI_Win_Fence(0,win_values_points,error)
! Print post-communication values print * print *,my_rank,neighbor_values call flush(5) call MPI_BARRIER(MPI_COMM_WORLD,error)
! Free Window Storage call mpi_win_free(win_values_points,error)
call MPI_FINALIZE(error)
end program reproducer
_______________________________________________ discuss mailing list [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss