[MPICH] MPI_Recv semantics

Altu 59 altu59 at gmail.com
Fri Oct 19 12:14:35 CDT 2007


Hi,

I am writing an MPI program that is comprised of 5 nodes. In each loop, each
node sends a message to other nodes and then receives a message from the
others:

for example, node with node rank 0 does:

while (true) {

   for each node_rank (1, 2, 3, 4) in other nodes
      MPI_Send(&MESSAGE, 1, MPI_INT, node_rank, 1, MPI_COMM_WORLD);

   for each node_rank (1, 2, 3, 4) in other nodes
      MPI_Recv(&message, 1, MPI_INT, node_rank, 1, MPI_COMM_WORLD, &status);
}

Obviously, the nodes do not receive the messages in a predictable order.
Node 0 might receive message from node 3, then 2, then 4, then 1, for
example.

The logic of my program is a little bit more complex. But my question is, if
a node in its loop, instead of MPI_ANY_SOURCE, receive a message from node
1, 2, 3, and 4 but it receives in the order like 3, 2, 4, 1, will it
deadlock or it just waits for 1 to arrive, then fetch it, and then, although
that 2 was receives before 1, it then fetches the message from 2 from its
queue and on and on.

If I have not explained my question vividly and it is a little bit vague,
just let me know so I will explain more about it.

Thanks in advance,
Al
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20071020/528ebd81/attachment.htm>


More information about the mpich-discuss mailing list