The problem is because you are doing non-blocking sends and never
waiting for them to finish before deallocating the buffer. If you use
ISEND, you must use some form of TEST or WAIT to complete the message
passing before you are allowed to touch (or free) the buffer containing
the message.
You might want to either use blocking communication or look up the
semantics of non-blocking communication in the MPI-1 standard, a good
MPI book, or an MPI tutorial (there's a bit more to it that you should
be aware of than my brief description).
On Oct 27, 2004, at 7:39 PM, Konstantin Skaburskas wrote:
> Hi!
>
> I tried to run trivial FORTRAN90 program (see below) on one physical
> processor with:
> $ mpirun -np 2 test_prog
>
> Program execution shows that the data sent from rank 0 to rank 1
> arrives
> corrupted (or I'm missing something completely). It happens only after
> the
> message size gets over 64KB. If I run this program with "-ssi rpi
> lamd" no
> data corruption occurs. Can anyone explain me this behaviour?
>
> LAM-MPI 7.0.6 and the program was compiled with Intel 8.0 compilers.
> CC=icc
> CXX=icc
> FC=ifort
>
> $ export CC CXX FC
>
> $ ./configure --prefix=/usr/local/lam-7.0.6_intel --with-trillium \
> --with-prefix-memcpy --with-debug --with-tv-debug
> --enable-tv-dll-force \
> --enable-shared --with-purify --with-rsh="ssh -x"
>
> $ mpif77 -u -o test_prog test_prog.f90
>
> I also tried it with Sun's HPC 5.0 and Sun Fortran 95 6.2 compiler -
> everything is OK for MPI_REAL and MPI_DOUBLE_PRECISION.
>
> ------------------------------------------------------------------
> program test_prog
> implicit none
>
> include 'mpif.h'
>
> integer, parameter :: rk = selected_real_kind(15,307)
> !integer, parameter :: rk = selected_real_kind(6,37)
>
> integer :: i
> integer :: myrank, nprocs, ierr, request, status(MPI_STATUS_SIZE)
>
> integer :: bufsize
> integer :: bits
>
> real(kind=rk), dimension(:), pointer :: bufs, bufr
> real(kind=rk) :: chkval
>
> integer :: MPI_kind
>
> ! define MPI_fkind
> if (precision(1.0_rk) >= 15) then
> MPI_kind = MPI_DOUBLE_PRECISION
> bits = 64
> bufsize = 8193 ! 8192=>8193 array elements; 65536=>65544 bytes
> else
> MPI_kind = MPI_REAL
> bits = 32
> bufsize = 8193*2 ! 8192*2=>8193*2 array elements; 65536=>65544
> bytes
> end if
>
> call MPI_INIT(ierr)
> call MPI_COMM_RANK(MPI_COMM_WORLD, myrank, ierr)
> call MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, ierr)
>
> if (nprocs /= 2) &
> call MPI_ABORT(MPI_COMM_WORLD, ierr)
>
> if (myrank == 0) then
> write(*,'(a,i2,a,i6,a)') '<',myrank,'> size of send/recv
> buffers:',&
> bits*bufsize/8,' bytes'
>
> chkval = 1.1_rk
> call MPI_ISEND(chkval, 1, MPI_kind, &
> 1, 11, MPI_COMM_WORLD, request, ierr)
>
> allocate(bufs(bufsize))
> bufs = chkval
> call MPI_ISEND(bufs, bufsize, MPI_kind, &
> 1, 12, MPI_COMM_WORLD, request, ierr)
> else
> call MPI_RECV(chkval, 1, MPI_kind, &
> 0, 11, MPI_COMM_WORLD, status, ierr)
>
> allocate(bufr(bufsize))
> call MPI_RECV(bufr, bufsize, MPI_kind, &
> 0, 12, MPI_COMM_WORLD, status, ierr)
>
> write(*,'(a,i2,a,f10.7)') '<',myrank,'> chkval=',chkval
> if (any(bufr /= chkval)) &
> write(*,'(a,i2,a)') '<',myrank,'> problems with ''bufr'''
> do i = 1,bufsize
> if (bufr(i) /= chkval) then
> write(*,'(a,i2,a,i5,a,f10.7,a,f10.7)') &
> '<',myrank,'> bufr(',i,')=',bufr(i), ':',bufr(i)-chkval
> end if
> end do
> end if
>
> if (myrank == 0) then
> deallocate(bufs)
> else
> deallocate(bufr)
> end if
>
> call MPI_BARRIER(MPI_COMM_WORLD, ierr)
> call MPI_FINALIZE(ierr)
>
> end program test_prog
> -----------------------------------------------------------------------
>
> Regards,
> Konstantin
>
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
--
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
|