[mpich-discuss] MPI_Wait status array and non-blocking sends

Helvio Vairinhos helvio.vairinhos at googlemail.com
Tue Aug 2 06:07:11 CDT 2011


Hi,

I'm new to MPI and I'd like to understand something about non-blocking
sends/receives and MPI_WAIT that I quite don't understand, if not only
for curiosity. I use the MPICH2-1.3.2p1 implementation of MPI for
Cygwin. Consider the following snippet of F90 code, which does basic
non-blocking send and receive, and waits for the completion of each one
of them:

   IF (rank==0) THEN
      buf=1
      CALL MPI_ISEND(buf, 1, MPI_INTEGER, 1, 99, MPI_COMM_WORLD, req, ierr)
      CALL MPI_WAIT(req, status, ierr)
      WRITE(*,*) "MPI_ISEND status:", status
   ELSE IF (rank==1) THEN
      buf=0
      CALL MPI_IRECV(buf, 1, MPI_INTEGER, 0, 99, MPI_COMM_WORLD, req, ierr)
      CALL MPI_WAIT(req, status, ierr)
      WRITE(*,*) "MPI_IRECV status:", status
      WRITE(*,*) "Incoming message:", buf
   ENDIF

The output is:

$ mpif90 mpitest.F90
$ mpiexec -n 2 ./a.exe
 MPI_Isend status:           0           0           0          
0           0
 MPI_Irecv status:           4           0           0         
99           0
 Incoming message:           1

I don't understand why the MPI_WAIT that waits for the completion of the
non-blocking send does not return a proper STATUS array (the STATUS
array is always returned with zero components, regardless of the sending
mode being basic, synchronous, ready or buffered). I thought that
information like tag, size and destination rank would still be encoded
in STATUS at the sending end, after the send is completed. I know that
STATUS makes more sense in the receiving end, but I just wanted to know
if this is normal, i.e. if the MPI_WAIT always completes a sending
routine and returns a zero STATUS array, or if I'm doing something wrong.

Thanks,
Helvio


More information about the mpich-discuss mailing list