Buffered Send


Up: Buffering issues Next: Reusing the same buffer Previous: Communication Modes

MPI provides a send routine that may be used when MPI_Isend is awkward to use (e.g., lots of small messages).

MPI_Bsend makes use of a user-provided buffer to save any messages that can not be immediately sent.


int  bufsize; 
char *buf = malloc(bufsize); 
MPI_Buffer_attach( buf, bufsize ); 
... 
MPI_Bsend( ... same as MPI_Send ... ); 
... 
MPI_Buffer_detach( &buf, &bufsize ); 
The MPI_Buffer_detach call does not complete until all messages are sent.

127 The performance of MPI_Bsend depends on the implementation of MPI and may also depend on the size of the message. For example, making a message one byte longer may cause a significant drop in performance.



Up: Buffering issues Next: Reusing the same buffer Previous: Communication Modes