1MPI_Buffer_detach(3)                LAM/MPI               MPI_Buffer_detach(3)
2
3
4

NAME

6       MPI_Buffer_detach  -   Removes an existing buffer (for use in MPI_Bsend
7       etc)
8

SYNOPSIS

10       #include <mpi.h>
11       int MPI_Buffer_detach(void *pbuf, int *psize)
12

OUTPUT PARAMETERS

14       pbuf   - initial buffer address (choice)
15       psize  - buffer size, in bytes (integer)
16
17

NOTES

19       The reason that MPI_Buffer_detach returns the address and size  of  the
20       buffer  being  detached  is  to  allow  nested libraries to replace and
21       restore the buffer.  For example, consider
22
23       int size, mysize, idummy;
24       void *ptr, *myptr, *dummy;
25       MPI_Buffer_detach(&ptr, &size);
26       MPI_Buffer_attach(myptr, mysize);
27       // ...library code...
28       MPI_Buffer_detach(&dummy, &idummy);
29       MPI_Buffer_attach(ptr, size);
30
31
32       This is much like the action of the Unix signal  routine  and  has  the
33       same  strengths (it is simple) and weaknesses (it only works for nested
34       usages).
35
36       Note that for this approach  to  work,  MPI_Buffer_detach  must  return
37       MPI_SUCCESS  even  when there is no buffer to detach.  In that case, it
38       returns a size of zero.  The MPI  1.1  standard  for  MPI_BUFFER_DETACH
39       contains the text
40
41       The statements made in this section describe the behavior of MPI
42       for buffered-mode sends. When no buffer is currently associated,
43       MPI behaves as if a zero-sized buffer is associated with the
44       process.
45
46
47       This  could  be  read  as  applying only to the various Bsend routines.
48       This implementation takes the position that this  applies  to  MPI_BUF‐
49       FER_DETACH as well.
50
51

NOTES FOR FORTRAN

53       All  MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK ) have
54       an additional argument ierr at the end of the argument list.   ierr  is
55       an  integer and has the same meaning as the return value of the routine
56       in C.  In Fortran, MPI routines are subroutines, and are  invoked  with
57       the call statement.
58
59       All MPI objects (e.g., MPI_Datatype , MPI_Comm ) are of type INTEGER in
60       Fortran.
61
62       The Fortran binding for this routine  is  different.   Because  Fortran
63       does  not  have  pointers, it is impossible to provide a way to use the
64       output of this routine to exchange buffers.  In  this  case,  only  the
65       size field is set.
66
67

NOTES FOR C

69       Even  though the pbuf argument is declared as void * , it is really the
70       address of a void pointer (i.e., void ** ).  See the rationale  in  the
71       MPI Standard for more details.
72
73

MORE INFORMATION

75       For more information, please see the official MPI Forum web site, which
76       contains the text of both the MPI-1 and MPI-2 standards.   These  docu‐
77       ments  contain  detailed  information  about each MPI function (most of
78       which is not duplicated in these man pages).
79
80       http://www.mpi-forum.org/
81
82
83

ACKNOWLEDGEMENTS

85       The LAM Team would like the thank the MPICH Team for the handy  program
86       to  generate  man  pages ("doctext" from ftp://ftp.mcs.anl.gov/pub/sow‐
87       ing/sowing.tar.gz ), the initial formatting, and some initial text  for
88       most of the MPI-1 man pages.
89

LOCATION

91       bufdetach.c
92
93
94
95LAM/MPI 7.1.2                      2/23/2006              MPI_Buffer_detach(3)
Impressum