5

I knew if both sides are non-blocking send and receive, then a MPI_Wait or MPI_Test is required. But I wondered If we mix non-blocking send and blocking receive, do I still need to call MPI_Wait considering that blocking receive can ensure the completion of the communication?

Zulan
  • 21,896
  • 6
  • 49
  • 109
Jennifer Q
  • 257
  • 3
  • 12

1 Answers1

4

The difference between non-blocking and blocking communication mode is only locally. You may freely mix different kinds of send and receive. On whichever side you use non-blocking primitives, you must always issue an MPI_Wait or something similar to complete the communication.

This is necessary to clean up resources: If you never complete a non-blocking send, you would never be allowed to reuse the send buffer and accumulate lingering request objects.

Zulan
  • 21,896
  • 6
  • 49
  • 109
  • note most MPI implementations do not have a progress thread. from a very pragmatic point of view, `MPI_Isend()` of a large message will not transfer anything until `MPI_{Recv,Wait,Test,Probe}()` and friends are called. – Gilles Gouaillardet May 27 '18 at 01:41
  • valid point. I didn't want to go into the details of progress guarantee - the way I remember it's more complicated than just the direci completion functions. – Zulan May 27 '18 at 17:46