source: proiecte/hpl/openmpi_compiled/share/man/man3/MPI_Buffer_detach.3 @ 97

Last change on this file since 97 was 97, checked in by (none), 14 years ago

Adding compiled files

File size: 3.5 KB
Line 
1.\"Copyright 2006-2008 Sun Microsystems, Inc.
2.\" Copyright (c) 1996 Thinking Machines Corporation
3.TH MPI_Buffer_detach 3 "Dec 08, 2009" "1.4" "Open MPI"
4.SH NAME
5\fBMPI_Buffer_detach\fP \- Removes an existing buffer (for use in MPI_Bsend, etc.)
6
7.SH SYNTAX
8.ft R
9.SH C Syntax
10.nf
11#include <mpi.h>
12int MPI_Buffer_detach(void \fI*buf\fP, int\fI *size\fP)
13
14.SH Fortran Syntax
15.nf
16INCLUDE 'mpif.h'
17MPI_BUFFER_DETACH(\fIBUF\fP,\fI SIZE\fP, \fIIERROR\fP)
18        <type>  \fIBUF\fP(\fI*\fP)
19        INTEGER \fISIZE\fP,\fI IERROR\fP
20
21.SH C++ Syntax
22.nf
23#include <mpi.h>
24int Detach_buffer(void*& \fIbuffer\fP)
25
26.SH OUTPUT PARAMETERS
27.ft R
28.TP 1i
29buf
30Initial buffer address (choice).
31.TP 1i
32size
33Buffer size, in bytes (integer).
34.ft R
35.TP 1i
36IERROR
37Fortran only: Error status (integer).
38
39.SH DESCRIPTION
40.ft R
41Detach 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.
42.sp
43\fBExample:\fP Calls to attach and detach buffers.
44.sp
45.nf
46    #define BUFFSIZE 10000
47    int size
48    char *buff;
49    MPI_Buffer_attach( malloc(BUFFSIZE), BUFFSIZE);
50    /* a buffer of 10000 bytes can now be used by MPI_Bsend */
51    MPI_Buffer_detach( &buff, &size);
52    /* Buffer size reduced to zero */
53    MPI_Buffer_attach( buff, size);
54    /* Buffer of 10000 bytes available again */
55.fi
56
57.SH NOTES
58.ft R
59The reason that 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
60.sp
61.nf
62    int size, mysize, idummy;
63    void *ptr, *myptr, *dummy;
64    MPI_Buffer_detach( &ptr, &size );
65    MPI_Buffer_attach( myptr, mysize );
66    \&...
67    \&... library code \&...
68    \&...
69    MPI_Buffer_detach( &dummy, &idummy );
70    MPI_Buffer_attach( ptr, size );
71.fi
72.sp
73This 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).
74.sp
75\fBFor Fortran:\fP 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.
76.sp
77\fBFor C:\fP Even though the buf argument is declared as void, it is really the address of a void pointer. See Rationale, below, for more details.
78.sp
79Even though the C functions MPI_Buffer_attach and
80MPI_Buffer_detach both have a first argument of type void*, these arguments are used differently: A pointer to the buffer is passed to MPI_Buffer_attach; the address of the pointer is passed to MPI_Buffer_detach, so that this call can return the pointer value.
81
82.SH ERRORS
83Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object.
84.sp
85Before the error value is returned, the current MPI error handler is
86called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN 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. 
87
88.SH SEE ALSO
89.ft R
90.sp
91.nf
92MPI_Buffer_attach
93MPI_Bsend
Note: See TracBrowser for help on using the repository browser.