0
votes

In the MPI Standard Section 3.4 (page 37):http://mpi-forum.org/docs/mpi-3.0/mpi30-report.pdf the synchronous send completion means 1. the send-buffer can be reused 2. the receiver has started to receive data.

The standard says "has started" instead of "has completed", so I have a question about this: Imagine a case: The sender calls MPI_Ssend, then a receiver is matched and has started to receive data. At this time, the send is complete and returned. As the MPI standard said, the send-buffer can be reused, so the sender modifies some data of the send-buffer. At the same time, the receiver is receiving data very slowly (e.g. network is very bad), so how can we guarantee the data finally received by the receiver is same as the original data stored in sender's send-buffer?

1
It is up to the MPI library to correctly implement the standard. one option is to return when the receive has completed. An other option is to use a temporary buffer on the sender side.Gilles Gouaillardet
Thank you. I agree. The send-buffer can only be reused after it has been completely stored away.F.L.

1 Answers

0
votes

Ssend is synchronous. It means that Ssend cannot return before the corresponding Recv is called.

Ssend is Blocking. It means that the function return only when it is safe to touch the "send-buffer".

Synchronous and blocking are 2 different thing, I know it can be confusing.

Most implementation of Send works as follow (MPICH,OpenMPI,CRAY-MPI):

  1. For small message the send-buffer is copied to the memory which is reserved for MPI. As soon as the copy is done the send return.
  2. For large message, no copy are done, therefore the Send return once the entire send-buffer has been send to the network (which cannot be done before the Revc has been called, to avoid to overload the network memory)

So a MPI_Send is: Blocking, asynchronous for small message,synchronous for large one.

A Ssend works as follow: As soon as the Recv is started AND the send-buffer is either copied or fully in the network, the Ssend return.

Ssend should be avoided as much as one can. As it slow down the communication (due to the fact that the network need to tell the sender that the recv has started)