Buffer Allocation and Usage



next up previous contents
Next: Model Implementation of Up: Communication Modes Previous: Persistent Requests

Buffer Allocation and Usage

  buffered modemode, bufferedbuffer attach

An application must specify a buffer to be used for buffering messages sent in buffered mode. Buffering is done by the sender.

  MPI_BUFFER_ATTACH(buffer,size)

    IN    buffer      initial buffer address
    IN    size        buffer size in bytes
MPI_Buffer_attach( void* buffer, int size)

MPI_BUFFER_ATTACH( BUFFER, SIZE, IERROR)<type> BUFFER(*)
INTEGER SIZE, IERROR

MPI_BUFFER_ATTACH provides to MPI a buffer in the application'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 at a time (per process).

  MPI_BUFFER_ATTACH(buffer,size)

    IN    buffer      initial buffer address
    IN    size        buffer size in bytes
MPI_Buffer_detach( void* buffer, int* size)

MPI_BUFFER_DETACH( BUFFER, SIZE, IERROR)<type> BUFFER(*)
INTEGER SIZE, IERROR

MPI_BUFFER_DETACH detaches 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.

Now the question arises: how is the attached buffer to be used? The answer is that MPI must behave as if buffer policy outgoing message data were buffered by the sending process, in the specified buffer space, using a circular, contiguous-space allocation policy. We outline below a model implementation that defines this policy. MPI may provide more buffering, and may use a better buffer allocation algorithm than described below. On the other hand, MPI may signal an error whenever the simple buffering allocator described below would run out of space.



Jack Dongarra
Fri Sep 1 06:16:55 EDT 1995