On a 2-core system, for the following code
if(rank == 0)
{
MPI_Isend(A) // to rank 1
// Do something else.
MPI_Isend(B) // to rank 1
// Do something else.
MPI_Wait(B is sent)
MPI_Wait(A is sent)
}
else
{
MPI_Irecv(buffer1) // Listen to rank 0
// Do something else.
MPI_Irecv(buffer2) // Listen to rank 0
// Do something else.
MPI_Wait(buffer2 is finished receiving)
MPI_Wait(buffer1 is finished receiving)
}
Would rank 1 be guaranteed to receive A in buffer 1, and B in buffer 2?
Thank you!
MPI messages are "non-overtaking". Two messages from the same source can not arrive in a different order from how they are sent (blocking case) or initiated (non-blocking case). Of course, you can always set your mind at ease by specifying different tags.