0
votes

I'm trying to understand the specific of MPI send modes (send, bsend, ssend, rsend) and I have next questions:

  1. MPI_Send uses some buffer if the is not initialized appropriate MPI_|i|recv and message size not too big and not exceeded buffer size (otherwise, MPI_Send will wait appropriate recv). I know, it's true (this situation described here: Deadlock with MPI ).
  2. MPI_Bsend uses buffer (denoted MPI_Buffer_attach function) only when not initialized appropriate recv. It's true?
  3. Buffer for MPI_Bsend is the same as that buffer for MPI_send?
  4. MPI_Ssend never uses buffer. It's true? Or behavior of MPI_Ssend like MPI_Send (buffer uses, if message size is not exceeded buffer size)?

If an answer on my questions "it's not true", could not you give me detailed answer with explanations?

1
Can you restate your questions clearly especially the first one?Angelos
Your question is hard to understand in its current state, but the preliminary answers would be: 1. it's implementation-dependent; 2. not true; 3. not true; 4. synchronous sends are never buffered.Hristo Iliev
Synchronous sends could be buffered on the destination process, as a way of reducing latency if the receiver is late relative to the sender. Heck, an implementation could legitimately buffer a synchronous send on the sending process too, it would just seem silly. A case where it would make sense is when sending a non-contiguous type, with a network that can only handle contiguous buffers. So, serialize into a buffer, and then don't complete the operation until the recipient has matched.Phil Miller

1 Answers

1
votes

MPI_Send precise behavior is subject to change depending on the implementation. In addition, some implementations allow the threshold size to be tuned by the user.

Check MPI's Send Modes for some detailed information. If you want to make sure your program is portable to other MPI implementations, refer to MPI standard (section 3.4: Communication Modes). For the standard mode (MPI_Send), here's what the standard says (as of MPI 3.1).

The send call described in Section 3.2.1 uses the standard communication mode. In this mode, it is up to MPI to decide whether outgoing messages will be buffered. MPI may buffer outgoing messages. In such a case, the send call may complete before a matching receive is invoked. On the other hand, buffer space may be unavailable, or MPI may choose not to buffer outgoing messages, for performance reasons. In this case, the send call will not complete until a matching receive has been posted, and the data has been moved to the receiver.

Thus, a send in standard mode can be started whether or not a matching receive has been posted. It may complete before a matching receive is posted. The standard mode send is non-local: successful completion of the send operation may depend on the occurrence of a matching receive.

The main misconception you have is that you think MPI_Send uses buffering if MPI_Recv has not been called by the receiver process. Actually, it usually depends on message size regardless if the matching receive has been called.

If buffering is used, the user's send buffer is released after the data is copied to a temporary buffer. Then, the program can continue its execution regardless the corresponding receive has been issued or not.