I recently encountered a deadlock that I have been able to resolve by using MPI_Bsend
instead of MPI_Send
. If I understand correctly MPI_Bsend is a non-blocking send and it is safe to modify the thing I send without worrying about when the send operation it complete, so
double x = 1;
MPI_Bsend(&x,1,MPI_DOUBLE,master,1,MPI_COMM_WORLD);
x = 0;
will always result in x being sent at 1.
When reading the documentation on MPI send modes I encountered this warning about MPI_Bsend
A late add-on to the MPI specification. Should be used only when absolutely necessary.
My questions are:
- Why? Is it because Bsend may not be supported by all implementations?
- What is the oldest version of Open MPI that supports MPI_Bsend?
- Are there other cautions I should observe about using MPI_Bsend?
MPI_Bsend()
semantic open-mpi.org/doc/v2.0/man3/MPI_Bsend.3.php mpi-forum.org/docs/mpi-1.1/mpi-11-html/node40.html – Gilles GouaillardetMPI_Bsend()
. – Gilles GouaillardetMPI_Bsend()
is a rope you will likely end up hanging yourself with, so you'd rather be safe not using it. For example, you canmalloc()
a buffer,MPI_Isend()
it and free it after the relatedMPI_Wait()
completes. – Gilles Gouaillardet