Manual Pages for UNIX Darwin command on man MPI_Buffer_detach
MyWebUniversity

Manual Pages for UNIX Darwin command on man MPI_Buffer_detach

MPIBufferdetach(3OpenMPI) MPIBufferdetach(3OpenMPI)

NAME

MMPPIIBBuuffffeerrddeettaacchh - Removes an existing buffer (for use in MPIBsend,

etc.) SSYYNNTTAAXX CC SSyynnttaaxx

#include

int MPIBufferdetach(void *buf, int *size) FFoorrttrraann SSyynnttaaxx INCLUDE 'mpif.h'

MPIBUFFERDETACH(BUF, SIZE, IERROR)

BUF(*)

INTEGER SIZE, IERROR

CC++++ SSyynnttaaxx

#include

int Detachbuffer(void*& buffer) OOUUTTPPUUTT PPAARRAAMMEETTEERRSS buf Initial buffer address (choice). size Buffer size, in bytes (integer).

IERROR Fortran only: Error status (integer).

DESCRIPTION

Detach the buffer currently associated with MPI. The call returns the address and the size of the detached buffer. This operation will block until all messages currently in the buffer have been transmitted. Upon return of this function, the user may reuse or deallocate the space taken by the buffer. EExxaammppllee:: Calls to attach and detach buffers.

#define BUFFSIZE 10000

int size char *buff; MPIBufferattach( malloc(BUFFSIZE), BUFFSIZE); /* a buffer of 10000 bytes can now be used by MPIBsend */ MPIBufferdetach( &buff, &size); /* Buffer size reduced to zero */ MPIBufferattach( buff, size); /* Buffer of 10000 bytes available again */ NNOOTTEESS The reason that MPIBufferdetach returns the address and size of the buffer being detached is to allow nested libraries to replace and restore the buffer. For example, consider int size, mysize, idummy; void *ptr, *myptr, *dummy; MPIBufferdetach( &ptr, &size ); MPIBufferattach( myptr, mysize ); ... ... library code ... ... MPIBufferdetach( &dummy, &idummy ); MPIBufferattach( ptr, size ); This is much like the action of the UNIX signal routine and has the same strengths (it's simple) and weaknesses (it only works for nested usages). FFoorr FFoorrttrraann:: The Fortran binding for this routine is different. 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. FFoorr CC:: Even though the buf argument is declared as void, it is really the address of a void pointer. See Rationale, below, for more details. Even though the C functions MPIBufferattach and MPIBufferdetach

both have a first argument of type void*, these arguments are used dif-

ferently: A pointer to the buffer is passed to MPIBufferattach; the address of the pointer is passed to MPIBufferdetach, so that this call can return the pointer value. EERRRROORRSS Almost all MPI routines return an error value; C routines as the value

of the function and Fortran routines in the last argument. C++ func-

tions do not return errors. If the default error handler is set to

MPI::ERRORSTHROWEXCEPTIONS, then on error the C++ exception mechanism

will be used to throw an MPI:Exception object. 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

MPICommseterrhandler; the predefined error handler MPIERRORSRETURN

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

MPIBufferattach MPIBsend Open MPI 1.2 September 2006 MPIBufferdetach(3OpenMPI)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™