[MPICH] MPI_Recv semantics
Rajeev Thakur
thakur at mcs.anl.gov
Fri Oct 19 13:00:58 CDT 2007
It won't deadlock as long as all processes reach their Recv loop. However If
you call blocking Sends before the receives, and the sends are large enough,
the Send may block waiting for the Recv to be called on the receiver. You
need to use nonblocking sends instead.
Rajeev
_____
From: owner-mpich-discuss at mcs.anl.gov
[mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Altu 59
Sent: Friday, October 19, 2007 12:15 PM
To: mpich-discuss at mcs.anl.gov
Subject: [MPICH] MPI_Recv semantics
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/20071019/72e043cd/attachment.htm>
More information about the mpich-discuss
mailing list