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?