Open MPI logo

MPI_Buffer_attach(3) man page (version 5.0.0rc2)

  |   Home   |   Support   |   FAQ   |  

« Return to documentation listing

Table of Contents

Name

C]MPI_Buffer_attachR] - Attaches a user-defined buffer for sending.

Syntax

C Syntax



C]#include <mpi.h>int MPI_Buffer_attach(void *buf, int size)R]Fortran Syntax



C]USE MPI! or the older form: INCLUDE [aq]mpif.h[aq]MPI_BUFFER_ATTACH(BUF, SIZE, IERROR) <type> BUF(*) INTEGER SIZE, IERRORR]Fortran 2008 Syntax



C]USE mpi_f08MPI_Buffer_attach(buffer, size, ierror) TYPE(*), DIMENSION(..), ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: size INTEGER, OPTIONAL, INTENT(OUT) :: ierrorR]Input Parameters

[bu]
C]bufR] : Initial buffer address (choice).
[bu]
C]sizeR] : Buffer size, in bytes (integer).

Output Parameter

[bu]
C]IERRORR] : Fortran only: Error status (integer).

Description

Provides to MPI a buffer in the user[cq]s memory to be used for buffering outgoing messages. The buffer is used only by messages sent in buffered mode. Only one buffer can be attached to a process at a time.

Notes

The size given should be the sum of the sizes of all outstanding Bsends that you intend to have, plus C]MPI_BSEND_OVERHEADR] bytes for each Bsend that you do. For the purposes of calculating size, you should use C]MPI_Pack_sizeR]. In other words, in the code


C]MPI_Buffer_attach( buf, size );MPI_Bsend( ..., count=20, datatype=type1, ... );//...MPI_Bsend( ..., count=40, datatype=type2, ... );R]the value of size in the C]MPI_Buffer_attachR] call should be
greater than the value computed by

C]MPI_Pack_size( 20, type1, comm, &s1 );MPI_Pack_size( 40, type2, comm, &s2 );size = s1 + s2 + 2 * MPI_BSEND_OVERHEAD;R]C]MPI_BSEND_OVERHEADR] gives the maximum amount of buffer space
that may be used by the Bsend routines. This value is in mpi.h for C and mpif.h for Fortran.

Errors

Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument.

Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with C]MPI_Comm_set_errhandlerR]; the predefined error handler C]MPI_ERRORS_RETURNR] may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.

See Also

MPI_Buffer_detach(3)


Table of Contents

« Return to documentation listing