say i have the 3 non blocking sends like this
- MPI_Isend ();
- MPI_Isend ();
- MPI_Isend ();
and the 3 corresponding receives
- MPI_Recv();
- MPI_Recv();
- 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.
A nonblocking send will return as soon as possible, whereas a blocking send will return after the data has been copied out of the sender memory. The use of nonblocking sends is advantageous in these cases only if data copying can be concurrent with computation.
Non-blocking means computation and transferring data can happen in the same time for a single process.
Non-blocking MPI send calls An MPI_Isend creates a send request and returns a request object. It may or may not have sent the message, or buffered it. The caller is responsible for not changing the buffer until after waiting upon the resulting request object.
The MPI standard requires that a blocking send call blocks (and hence NOT return to the call) until the send buffer is safe to be reused. Similarly, the Standard requires that a blocking receive call blocks until the receive buffer actually contains the intended message.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With