<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=447365917-19102007><FONT face=Arial
color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=447365917-19102007></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=447365917-19102007><FONT face=Arial
color=#0000ff size=2>Rajeev</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=447365917-19102007> </SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> owner-mpich-discuss@mcs.anl.gov
[mailto:owner-mpich-discuss@mcs.anl.gov] <B>On Behalf Of </B>Altu
59<BR><B>Sent:</B> Friday, October 19, 2007 12:15 PM<BR><B>To:</B>
mpich-discuss@mcs.anl.gov<BR><B>Subject:</B> [MPICH] MPI_Recv
semantics<BR></FONT><BR></DIV>
<DIV></DIV>Hi,<BR><BR>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:<BR><BR>for example, node with node rank 0
does:<BR><BR>while (true) {<BR><BR> for each
node_rank (1, 2, 3, 4) in other
nodes<BR> MPI_Send(&MESSAGE, 1,
MPI_INT, node_rank, 1, MPI_COMM_WORLD);<BR><BR> for each
node_rank (1, 2, 3, 4) in other
nodes<BR> MPI_Recv(&message, 1,
MPI_INT, node_rank, 1, MPI_COMM_WORLD, &status); <BR>}<BR><BR>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.<BR><BR>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. <BR><BR>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.<BR><BR>Thanks in
advance,<BR>Al<BR></BLOCKQUOTE></BODY></HTML>