ShaunJ
2008-07-07 22:59:05 UTC
Process A:
MPI_Bsend(buf, count, MPI_BYTE, dest, tag0, MPI_COMM_WORLD);
MPI_Ssend(buf, count, MPI_BYTE, dest, tag1, MPI_COMM_WORLD);
Process B
MPI_Recv(buf, count, MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG,
MPI_COMM_WORLD, &status);
MPI_Recv(buf, count, MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG,
MPI_COMM_WORLD, &status);
Is it guaranteed that process B will receive tag0 before receiving
tag1? Is it possible that the tag0 message will still be holding in an
outgoing buffer of process A while tag1 has been successfully sent and
received?
In the following example [1], it's guaranteed that process one
received the messages in the reverse order they were sent.
[1] http://www.mpi-forum.org/docs/mpi-11-html/node41.html
CALL MPI_COMM_RANK(comm, rank, ierr)
IF (rank.EQ.0) THEN
CALL MPI_BSEND(buf1, count, MPI_REAL, 1, tag1, comm, ierr)
CALL MPI_SSEND(buf2, count, MPI_REAL, 1, tag2, comm, ierr)
ELSE ! rank.EQ.1
CALL MPI_RECV(buf1, count, MPI_REAL, 0, tag2, comm, status, ierr)
CALL MPI_RECV(buf2, count, MPI_REAL, 0, tag1, comm, status, ierr)
END IF
I've read that MPI guarantees that two messages sent from one process,
A, to another process, B, are guaranteed to arrive at process B in
order they were sent [2], but the above example seems to contradict
that -- usefully so. Being that messages can evidently arrive in a
different order than they were sent, I'm trying to figure what under
what conditions messages are guaranteed to arrive in the order they
were sent, and when messages may -- or as in the above example, must
-- arrive out of order.
[2] http://www.csd.uoc.gr/~hy555/dbpp/text/node96.html
Thanks,
Shaun
MPI_Bsend(buf, count, MPI_BYTE, dest, tag0, MPI_COMM_WORLD);
MPI_Ssend(buf, count, MPI_BYTE, dest, tag1, MPI_COMM_WORLD);
Process B
MPI_Recv(buf, count, MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG,
MPI_COMM_WORLD, &status);
MPI_Recv(buf, count, MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG,
MPI_COMM_WORLD, &status);
Is it guaranteed that process B will receive tag0 before receiving
tag1? Is it possible that the tag0 message will still be holding in an
outgoing buffer of process A while tag1 has been successfully sent and
received?
In the following example [1], it's guaranteed that process one
received the messages in the reverse order they were sent.
[1] http://www.mpi-forum.org/docs/mpi-11-html/node41.html
CALL MPI_COMM_RANK(comm, rank, ierr)
IF (rank.EQ.0) THEN
CALL MPI_BSEND(buf1, count, MPI_REAL, 1, tag1, comm, ierr)
CALL MPI_SSEND(buf2, count, MPI_REAL, 1, tag2, comm, ierr)
ELSE ! rank.EQ.1
CALL MPI_RECV(buf1, count, MPI_REAL, 0, tag2, comm, status, ierr)
CALL MPI_RECV(buf2, count, MPI_REAL, 0, tag1, comm, status, ierr)
END IF
I've read that MPI guarantees that two messages sent from one process,
A, to another process, B, are guaranteed to arrive at process B in
order they were sent [2], but the above example seems to contradict
that -- usefully so. Being that messages can evidently arrive in a
different order than they were sent, I'm trying to figure what under
what conditions messages are guaranteed to arrive in the order they
were sent, and when messages may -- or as in the above example, must
-- arrive out of order.
[2] http://www.csd.uoc.gr/~hy555/dbpp/text/node96.html
Thanks,
Shaun