MPI_BUFFER_DETACH(3)MPI_BUFFER_DETACH(3)NAME
MPI_Buffer_detach - Removes an existing buffer
SYNOPSIS
C:
#include <mpi.h>
int MPI_Buffer_detach( bufferptr, size )
void *bufferptr;
int *size;
C++:
#include <mpi.h>
int Detach_buffer(
void*& buffer)
Fortran:
INCLUDE "mpif.h" (or USE MPI)
<type> BUFFER_ADDR(*)
INTEGER size, ierror
CALL MPI_BUFFER_DETACH(buffer_addr, size, ierror)
STANDARDS
This release implements the MPI 1.2 standard, as documented by the MPI
Forum in the spring 1997 release of MPI: A Message Passing Interface
Standard.
DESCRIPTION
The MPI_Buffer_detach routine removes an existing buffer. This routine
accepts the following parameters:
bufferptr Specifies the initial buffer address (choice)
buffer_addr
Specifies the initial buffer address (choice)
size Specifies the buffer size, in bytes (integer)
ierror Specifies the return code value for successful completion,
which is in MPI_SUCCESS. MPI_SUCCESS is defined in the mpif.h
file.
Page 1
MPI_BUFFER_DETACH(3)MPI_BUFFER_DETACH(3)NOTES
The reason MPI_Buffer_detach returns the address and size of the buffer
being detached is to allow nested libraries to replace and restore the
buffer. For example, consider the following code:
int size, mysize, idummy;
void *ptr, *myptr, *dummy;
MPI_Buffer_detach( &ptr, &size );
MPI_Buffer_attach( myptr, mysize );
library code
MPI_Buffer_detach( &dummy, &idummy );
MPI_Buffer_attach( ptr, size );
This is much like the action of the UNIX signal routine and has the same
strengths (its simplicity) and weaknesses (it works only for nested
uses).
The Fortran binding for this routine is different from the C
implementation. Because Fortran does not have pointers, it is impossible
to provide a way to use the output of this routine to exchange buffers.
In this case, only the size field is set.
Even though the bufferptr argument is declared as void *, it is really
the address of a void pointer. For more details, see the standard.
SEE ALSOintro_streams(3), MPI_Bsend(3), MPI_Buffer_attach(3), MPI_Ibsend(3)
Page 2