Previous | Next --- Slide 14 of 60
Back to Lecture Thumbnails
rofer

So, I went to check on which of these various methods OpenMPI offers. It seems MPI_Ssend is a synchronous send, MPI_Isend is a non-blocking send, and MPI_Send is a blocking send. I believe these correspond to Synchronous, Non-blocking async, and Blocking async.

ananyak

^ Where does it say that MPI_Send is a blocking send?

I believe MPI_Send is implementation defined (it can be either sync or async blocking).

http://www.mathcs.emory.edu/~cheung/Courses/561/Syllabus/92-MPI/async.html says that MPI_Send is a sync send, while http://www.mcs.anl.gov/research/projects/mpi/sendmode.html says that MPI_Send can be either sync or async blocking depending on the implementation.

I believe MPI_Bsend is an async blocking send.

ananyak

This raises an interesting question I'm hoping someone (maybe Kayvon or the TAs) can answer. Is MPI_Send usually sync or blocking async? It seems like we avoid MPI_Send and instead stick to the better specified MPI_Bsend, MPI_Isend, or MPI_Ssend. Is that right?

srw

MPI_Send has non-deterministic behavior, which is why sources seem conflicting. I would say that there's no inherent contradiction in the sources, though. We know that:

1) This routine may (or may not!) block until the message is received by the destination process.

Because "it is allowed to buffer, either on the sender or receiver side, or to wait for the matching receive". In other words, you're letting MPI choose which send to use. However, it also guarantees:

2) MPI_Send will not return until you can use the send buffer.

Which makes this different from a non-blocking send. MPI_Isend does not guarantee this.

I think http://www.mcs.anl.gov/research/projects/mpi/sendmode.html was the most useful in explaining this, but http://www.mpich.org/static/docs/v3.1/www3/MPI_Send.html was also helpful.

srw

@ananyak, I think there are a lot of times when it would be good to use MPI_Send. It basically ensures the same behavior as MPI_SSend but without the inherent synchronization, or the same behavior as MPI_Isend except you can modify your variable right after. It's a hybrid send, somewhere in the middle.