Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] programming qsn??
From: Eugene Loh (Eugene.Loh_at_[hidden])
Date: 2009-08-13 21:42:24


amjad ali wrote:

> Please tell me that if have multiple such ISEND-RECV squrntially for
> sending receiving data then DO we need to declare separate
> status(MPI_STATUS_SIZE) with for example status1, status2, ....; or a
> single declaration of it will work for all??

First of all, it really is good form to post receives as early as possible.

Anyhow, when you have multiple requests being completed at once, you
need more than one status. So, you declare an array of statuses. Check
the man page for MPI_Waitall. E.g.,

INCLUDE 'mpif.h'

INTEGER REQS(M)
INTEGER STATS(MPI_STATUS_SIZE,M)

DO I = 1, M
  CALL MPI_IRECV(BUF?, COUNT?, DATATYPE?, SOURCE?, TAG?, COMM?, REQS(I),
IER)
END DO

DO I = 1, N
  CALL MPI_SEND(BUF?, COUNT?, DATATYPE?, DEST?, TAG?, COMM?, IER)
END DO

CALL MPI_WAITALL(M, REQS, STATS, IER)

If you don't care about the statuses, don't declare STATS and just use

CALL MPI_WAITALL(M,REQS,MPI_STATUSES_IGNORE,IER)