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>&nbsp;&nbsp;&nbsp;for  each node_rank&nbsp;(1,&nbsp;2,&nbsp;3,&nbsp;4) in other nodes<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MPI_Send(&amp;MESSAGE, 1, MPI_INT, node_rank, 1, MPI_COMM_WORLD);<br><br>&nbsp;&nbsp;&nbsp;for each node_rank (1, 2, 3, 4) in other nodes<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MPI_Recv(&amp;message, 1, MPI_INT, node_rank, 1, MPI_COMM_WORLD, &amp;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>