Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disadvantages of MPI_Bsend?

Tags:

mpi

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:

  1. Why? Is it because Bsend may not be supported by all implementations?
  2. What is the oldest version of Open MPI that supports MPI_Bsend?
  3. Are there other cautions I should observe about using MPI_Bsend?
like image 216
taciteloquence Avatar asked Sep 14 '18 11:09

taciteloquence


1 Answers

Why is MPI_BSend problematic?

Buffered operations in MPI require the user to provide a large-enough buffer. MPI describes an operational model how much buffer may be used for each operation - so you can theoretically compute how much buffer will be needed in total. However, in in sufficiently complex applications it is not feasible to correctly compute the amount of buffer that is needed. Not having enough buffer space is an unrecoverable error. This error may be a very nasty heisenbug randomly occurring under specific circumstances.

Note that buffered mode and non-blocking mode is different (even orthogonal) in MPI. It is easier to write a correct MPI program using non-blocking primitives, i.e. using MPI_Isend. This is generally recommended.

What about MPI_BSend support?

The "late addition" quote is misleading. It was already in the very first MPI standard 24 years ago. I wouldn't worry about support by libraries, but rather the other issues I mentioned.

like image 81
Zulan Avatar answered Nov 10 '22 08:11

Zulan