7
votes

say i have the 3 non blocking sends like this

  1. MPI_Isend ();
  2. MPI_Isend ();
  3. MPI_Isend ();

and the 3 corresponding receives

  1. MPI_Recv();
  2. MPI_Recv();
  3. MPI_Recv();

Now assume that the 2nd Isend doesnt send so since its non blocking the 3rd one will be send. Now will the MPI_Recv functions get intended ones ?

I mean will the 1st MPI_ISend send data to the 1st receive and the 2nd MPI_ISent to the 2nd MPI_Recv and so on.

1

1 Answers

1
votes

Updated: Jeremiah Willcock below in comments is I think right, and this answer was wrong.

If the three ISends are called sequentially, and the receives all match them, then it doesn't matter if one is send operation is bigger, or faster, or whatever; MPI's non-overtaking guarantee tells you that the messages will arrive (and thus be available for the Recv) in the order the Isends were made.

If the call to the ISend was delayed, which was how I interpreted the question initially, or if the call failed as suggested (but note that you'd have other problems later if the call failed) then the original answer holds: if the Recieves match any all of the Isends, and the call to the second ISend gets held up somehow, then the 1st MPI_Recv() will get the first Isend, the second Recv will get the third Isend, and the third will hang until that second Isend happens.

If you want to ensure that the first MPI_Recv receives a particular message, you should use tags to distinguish the various messages, and have the receive specify that tag.