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>