difference between MPI_Send() and MPI_Ssend()?

前端 未结 1 486
隐瞒了意图╮
隐瞒了意图╮ 2020-12-28 16:00

I know MPI_Send() is a blocking call ,which waits until it is safe to modify the application buffer for reuse. For making the send call synchronous(there should

相关标签:
1条回答
  • 2020-12-28 17:04

    There is a small but important difference between the two (you can find it in the MPI 3.0 Standard document in Section 3.4). With a regular MPI_SEND, the implementation will return to the application when the buffer is available for reuse. This could be before the receiving process has actually posted the receive. For instance, it could be when a small message has been copied into an internal buffer and the application buffer is no longer needed. However, for large messages that may not be buffered internally, the call may not return until enough of the message has been sent to the remote process that the buffer is no longer needed.

    The difference between this and MPI_SSEND is that the latter will always wait until the receive has been posted on the receiving end. Even if the message is small and can be buffered internally, it will still wait until the message has started to be received on the other side.

    MPI_SSEND is a way of ensuring that both processes have reached a certain point in their execution without having to do an MPI_BARRIER, for instance. If your application is sending and receiving to and from the same rank, it's not safe to do either MPI_SEND OR MPI_SSEND, as either one could block indefinitely. Instead, you should use MPI_ISEND and MPI_IRECV so that the calls will return immediately and the actual send/receive can be done at the same time (in the call to MPI_WAITALL).

    0 讨论(0)
提交回复
热议问题