1
1

Finished converting MPI_B section into markdown files

Signed-off-by: Colton Kammes <ckammes@nd.edu>
Этот коммит содержится в:
Colton Kammes 2020-10-25 15:45:19 -04:00
родитель 593a918379
Коммит cded23fe9b
9 изменённых файлов: 388 добавлений и 409 удалений

Просмотреть файл

@ -1,117 +0,0 @@
.\" -*- nroff -*-
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.\" Copyright (c) 2020 Google, LLC. All rights reserved.
.\" $COPYRIGHT$
.TH MPI_Bsend 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Bsend\fP \- Basic send with user-specified buffering.
.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <mpi.h>
int MPI_Bsend(const void \fI*buf\fP, int\fI count\fP, MPI_Datatype\fI datatype\fP,
int\fI dest\fP, int\fI tag\fP, MPI_Comm\fI comm\fP)
.fi
.SH Fortran Syntax
.nf
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_BSEND(\fIBUF\fP,\fI COUNT\fP,\fIDATATYPE\fP,\fI DEST\fP,\fI TAG\fP,\fI COMM\fP,\fI IERROR\fP)
<type> \fIBUF\fP(*)
INTEGER \fICOUNT\fP,\fI DATATYPE\fP,\fI DEST\fP,\fI TAG\fP,\fI COMM\fP,\fI IERROR\fP
.fi
.SH Fortran 2008 Syntax
.nf
USE mpi_f08
MPI_Bsend(\fIbuf\fP, \fIcount\fP, \fIdatatype\fP, \fIdest\fP, \fItag\fP, \fIcomm\fP, \fIierror\fP)
TYPE(*), DIMENSION(..), INTENT(IN) :: \fIbuf\fP
INTEGER, INTENT(IN) :: \fIcount\fP, \fIdest\fP, \fItag\fP
TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP
TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP
INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP
.fi
.SH INPUT PARAMETERS
.ft R
.TP 1i
buf
Initial address of send buffer (choice).
.TP 1i
count
Number of entries in send buffer (nonnegative integer).
.TP 1i
datatype
Datatype of each send buffer element (handle).
.TP 1i
dest
Rank of destination (integer).
.TP 1i
tag
Message tag (integer).
.TP 1i
comm
Communicator (handle).
.SH OUTPUT PARAMETER
.ft R
.TP 1i
IERROR
Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
MPI_Bsend performs a buffered-mode, blocking send.
.SH NOTES
.ft R
This send is provided as a convenience function; it allows the user to send messages without worrying about where they are buffered (because the user must have provided buffer space with MPI_Buffer_attach).
.sp
In deciding how much buffer space to allocate, remember that the buffer space
is not available for reuse by subsequent \fIMPI_Bsend\fPs unless you are certain
that the message
has been received (not just that it should have been received). For example,
this code does not allocate enough buffer space:
.nf
MPI_Buffer_attach( b, n*sizeof(double) + MPI_BSEND_OVERHEAD );
for (i=0; i<m; i++) {
MPI_Bsend( buf, n, MPI_DOUBLE, ... );
}
.fi
because only enough buffer space is provided for a single send, and the
loop may start a second
.I MPI_Bsend
before the first is done making use of the
buffer.
In C, you can
force the messages to be delivered by
MPI_Buffer_detach( &b, &n );
MPI_Buffer_attach( b, n );
(The
.I MPI_Buffer_detach
will not complete until all buffered messages are
delivered.)
.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument.
.sp
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 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.
.SH SEE ALSO
.ft R
.nf
MPI_Buffer_attach
MPI_Ibsend
MPI_Bsend_init

91
ompi/mpi/man/man3/MPI_Bsend.md Обычный файл
Просмотреть файл

@ -0,0 +1,91 @@
# Name
`MPI_Bsend` - Basic send with user-specified buffering.
# Syntax
## C Syntax
```c
#include <mpi.h>
int MPI_Bsend(const void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm)
```
## Fortran Syntax
```fortran
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_BSEND(BUF, COUNT,DATATYPE, DEST, TAG, COMM, IERROR)
<type> BUF(*)
INTEGER COUNT, DATATYPE, DEST, TAG, COMM, IERROR
```
## Fortran 2008 Syntax
```fortran
USE mpi_f08
MPI_Bsend(buf, count, datatype, dest, tag, comm, ierror)
TYPE(*), DIMENSION(..), INTENT(IN) :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
```
# Input Parameters
* `buf` : Initial address of send buffer (choice).
* `count` : Number of entries in send buffer (nonnegative integer).
* `datatype` : Datatype of each send buffer element (handle).
* `dest` : Rank of destination (integer).
* `tag` : Message tag (integer).
* `comm` : Communicator (handle).
# Output Parameters
* `IERROR` : Fortran only: Error status (integer).
# Description
`MPI_Bsend` performs a buffered-mode, blocking send.
# Notes
This send is provided as a convenience function; it allows the user to
send messages without worrying about where they are buffered (because
the user must have provided buffer space with `MPI_Buffer_attach`).
In deciding how much buffer space to allocate, remember that the buffer
space is not available for reuse by subsequent `MPI_Bsend`s unless you
are certain that the message has been received (not just that it should
have been received). For example, this code does not allocate enough
buffer space:
```c
MPI_Buffer_attach( b, n*sizeof(double) + MPI_BSEND_OVERHEAD );
for (i=0; i<m; i++) {
MPI_Bsend( buf, n, MPI_DOUBLE, ... );
}
```
because only enough buffer space is provided for a single send, and the
loop may start a second `MPI_Bsend` before the first is done making use
of the buffer.
In C, you can force the messages to be delivered by `MPI_Buffer_detach(
&b, &n );` `MPI_Buffer_attach( b, n );` (The `MPI_Buffer_detach` will not
complete until all buffered messages are delivered.)
# Errors
Almost all MPI routines return an error value; C routines as the value;
C routines as the value of the function and Fortran routines in the last
argument.
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 `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.

Просмотреть файл

@ -1,96 +0,0 @@
.\" -*- nroff -*-
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.\" Copyright (c) 2020 Google, LLC. All rights reserved.
.\" $COPYRIGHT$
.TH MPI_Bsend_init 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Bsend_init\fP \- Builds a handle for a buffered send.
.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <mpi.h>
int MPI_Bsend_init(const void \fI*buf\fP, int\fI count\fP, MPI_Datatype\fI datatype\fP,
int\fI dest\fP, int\fI tag\fP, MPI_Comm\fI comm\fP, MPI_Request\fI *request\fP)
.fi
.SH Fortran Syntax
.nf
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_BSEND_INIT(\fIBUF\fP,\fI COUNT\fP, \fIDATATYPE\fP,\fI DEST\fP,\fI TAG\fP,\fI COMM\fP,\fI REQUEST\fP,
\fIIERROR\fP)
<type> \fIBUF\fP(\fI*\fP)
INTEGER \fICOUNT\fP,\fI DATATYPE\fP, \fIDEST\fP,\fI TAG\fP,
INTEGER \fICOMM\fP,\fI REQUEST\fP,\fI IERROR
.fi
.SH Fortran 2008 Syntax
.nf
USE mpi_f08
MPI_Bsend_init(\fIbuf\fP, \fIcount\fP, \fIdatatype\fP, \fIdest\fP, \fItag\fP, \fIcomm\fP, \fIrequest\fP, \fIierror\fP)
TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIbuf\fP
INTEGER, INTENT(IN) :: \fIcount\fP, \fIdest\fP, \fItag\fP
TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP
TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP
TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP
INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP
.fi
.SH INPUT PARAMETERS
.ft R
.TP 1i
buf
Initial address of send buffer (choice).
.TP 1i
count
Number of elements sent (integer).
.TP 1i
datatype
Type of each element (handle).
.TP 1i
dest
Rank of destination (integer).
.TP 1i
tag
Message tag (integer).
.TP 1i
comm
Communicator (handle).
.SH OUTPUT PARAMETERS
.ft R
.TP 1i
request
Communication request (handle).
.ft R
.TP 1i
IERROR
Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
Creates a persistent communication request for a buffered mode send, and binds to it all the arguments of a send operation.
.sp
A communication (send or receive) that uses a persistent request is initiated by the function MPI_Start.
.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument.
.sp
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 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.
.SH SEE ALSO
.ft R
.nf
MPI_Send_init
MPI_Ssend_init
MPI_Rsend_init
MPI_Recv_init
MPI_Start
MPI_Startall

85
ompi/mpi/man/man3/MPI_Bsend_init.md Обычный файл
Просмотреть файл

@ -0,0 +1,85 @@
# Name
`MPI_Bsend_init` - Builds a handle for a buffered send.
# Syntax
## C Syntax
```c
#include <mpi.h>
int MPI_Bsend_init(const void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm, MPI_Request *request)
```
## Fortran Syntax
```fortran
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_BSEND_INIT(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR)
<type> BUF(*)
INTEGER COUNT, DATATYPE, DEST, TAG,
INTEGER COMM, REQUEST, IERROR
```
## Fortran 2008 Syntax
```fortran
USE mpi_f08
MPI_Bsend_init(buf, count, datatype, dest, tag, comm, request, ierror)
TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
TYPE(MPI_Request), INTENT(OUT) :: request
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
```
# Input Parameters
* `buf` : Initial address of send buffer (choice).
* `count` : Number of elements sent (integer).
* `datatype` : Type of each element (handle).
* `dest` : Rank of destination (integer).
* `tag` : Message tag (integer).
* `comm` : Communicator (handle).
# Output Parameters
* `request` : Communication request (handle).
* `IERROR` : Fortran only: Error status (integer).
# Description
Creates a persistent communication `request` for a buffered mode send, and
binds to it all the arguments of a send operation.
A communication (send or receive) that uses a persistent `request` is
initiated by the function `MPI_Start`.
# Errors
Almost all MPI routines return an error value; C routines as the value
of the function and Fortran routines in the last argument.
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
`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.
# See Also
[MPI_Send_init(3)](MPI_Send_init.html)
[MPI_Ssend_init(3)](MPI_Ssend_init.html)
[MPI_Rsend_init(3)](MPI_Rsend_init.html)
[MPI_Recv_init(3)](MPI_Recv_init.html)
[MPI_Start(3)](MPI_Start.html)
[MPI_Startall(3)](MPI_Startall.html)

Просмотреть файл

@ -1,87 +0,0 @@
.\" -*- nroff -*-
.\" Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines
.\" Copyright (c) 2020 Google, LLC. All rights reserved.
.\" $COPYRIGHT$
.TH MPI_Buffer_attach 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Buffer_attach\fP \- Attaches a user-defined buffer for sending.
.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <mpi.h>
int MPI_Buffer_attach(void \fI*buf\fP, int\fI size\fP)
.fi
.SH Fortran Syntax
.nf
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_BUFFER_ATTACH(\fIBUF\fP,\fI SIZE\fP, \fIIERROR\fP)
<type> \fIBUF\fP(\fI*\fP)
INTEGER \fISIZE\fP,\fI IERROR \fP
.fi
.SH Fortran 2008 Syntax
.nf
USE mpi_f08
MPI_Buffer_attach(\fIbuffer\fP, \fIsize\fP, \fIierror\fP)
TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIbuffer\fP
INTEGER, INTENT(IN) :: \fIsize\fP
INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP
.fi
.SH INPUT PARAMETERS
.ft R
.TP 1i
buf
Initial buffer address (choice).
.TP 1i
size
Buffer size, in bytes (integer).
.SH OUTPUT PARAMETER
.ft R
.TP 1i
IERROR
Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
Provides to MPI a buffer in the user'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 to a process at a time.
.SH NOTES
.ft R
The size given should be the sum of the sizes of all outstanding Bsends that you intend to have, plus MPI_BSEND_OVERHEAD bytes for each Bsend that you do. For the purposes of calculating size, you should use MPI_Pack_size. In other words, in the code
.sp
.nf
MPI_Buffer_attach( buf, size );
MPI_Bsend( \&..., count=20, datatype=type1, \&... );
\&...
MPI_Bsend( \&..., count=40, datatype=type2, \&... );
.fi
.sp
the value of size in the MPI_Buffer_attach call should be greater than the value computed by
.sp
.nf
MPI_Pack_size( 20, type1, comm, &s1 );
MPI_Pack_size( 40, type2, comm, &s2 );
size = s1 + s2 + 2 * MPI_BSEND_OVERHEAD;
.fi
.sp
MPI_BSEND_OVERHEAD gives the maximum amount of buffer space that may be used by the Bsend routines. This value is in mpi.h for C and mpif.h for Fortran.
.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument.
.sp
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 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.
.SH SEE ALSO
.ft R
.sp
MPI_Buffer_detach

92
ompi/mpi/man/man3/MPI_Buffer_attach.md Обычный файл
Просмотреть файл

@ -0,0 +1,92 @@
# Name
`MPI_Buffer_attach` - Attaches a user-defined buffer for sending.
# Syntax
## C Syntax
```c
#include <mpi.h>
int MPI_Buffer_attach(void *buf, int size)
```
## Fortran Syntax
```fortran
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_BUFFER_ATTACH(BUF, SIZE, IERROR)
<type> BUF(*)
INTEGER SIZE, IERROR
```
## Fortran 2008 Syntax
```fortran
USE mpi_f08
MPI_Buffer_attach(buffer, size, ierror)
TYPE(*), DIMENSION(..), ASYNCHRONOUS :: buffer
INTEGER, INTENT(IN) :: size
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
```
# Input Parameters
* `buf` : Initial buffer address (choice).
* `size` : Buffer size, in bytes (integer).
# Output Parameter
* `IERROR` : Fortran only: Error status (integer).
# Description
Provides to MPI a buffer in the user'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 to a process at a time.
# Notes
The size given should be the sum of the sizes of all outstanding Bsends
that you intend to have, plus `MPI_BSEND_OVERHEAD` bytes for each Bsend
that you do. For the purposes of calculating size, you should use
`MPI_Pack_size`. In other words, in the code
```c
MPI_Buffer_attach( buf, size );
MPI_Bsend( ..., count=20, datatype=type1, ... );
//...
MPI_Bsend( ..., count=40, datatype=type2, ... );
```
the value of size in the `MPI_Buffer_attach` call should be greater than the value computed by
```c
MPI_Pack_size( 20, type1, comm, &s1 );
MPI_Pack_size( 40, type2, comm, &s2 );
size = s1 + s2 + 2 * MPI_BSEND_OVERHEAD;
```
`MPI_BSEND_OVERHEAD` gives the maximum amount of buffer space that may be
used by the Bsend routines. This value is in mpi.h for C and mpif.h
for Fortran.
# Errors
Almost all MPI routines return an error value; C routines as the value
of the function and Fortran routines in the last argument.
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
`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.
# See Also
[MPI_Buffer_detach(3)](MPI_Buffer_detach.html)

Просмотреть файл

@ -1,105 +0,0 @@
.\" -*- nroff -*-
.\" Copyright 2014 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.\" Copyright (c) 2020 Google, LLC. All rights reserved.
.\" $COPYRIGHT$
.TH MPI_Buffer_detach 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Buffer_detach\fP \- Removes an existing buffer (for use in MPI_Bsend, etc.)
.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <mpi.h>
int MPI_Buffer_detach(void \fI*buf\fP, int\fI *size\fP)
.fi
.SH Fortran Syntax
.nf
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_BUFFER_DETACH(\fIBUF\fP,\fI SIZE\fP, \fIIERROR\fP)
<type> \fIBUF\fP(\fI*\fP)
INTEGER \fISIZE\fP,\fI IERROR\fP
.fi
.SH Fortran 2008 Syntax
.nf
USE mpi_f08
MPI_Buffer_detach(\fIbuffer_addr\fP, \fIsize\fP, \fIierror\fP)
USE, INTRINSIC :: \fIISO_C_BINDING\fP, \fIONLY \fP
TYPE(C_PTR), INTENT(OUT) :: \fIbuffer_addr\fP
INTEGER, INTENT(OUT) :: \fIsize\fP
INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP
.fi
.SH OUTPUT PARAMETERS
.ft R
.TP 1i
buf
Initial buffer address (choice).
.TP 1i
size
Buffer size, in bytes (integer).
.ft R
.TP 1i
IERROR
Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
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.
.sp
\fBExample:\fP Calls to attach and detach buffers.
.sp
.nf
#define BUFFSIZE 10000
int size
char *buff;
MPI_Buffer_attach( malloc(BUFFSIZE), BUFFSIZE);
/* a buffer of 10000 bytes can now be used by MPI_Bsend */
MPI_Buffer_detach( &buff, &size);
/* Buffer size reduced to zero */
MPI_Buffer_attach( buff, size);
/* Buffer of 10000 bytes available again */
.fi
.SH NOTES
.ft R
The 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
.sp
.nf
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 );
.fi
.sp
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).
.sp
\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.
.sp
\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.
.sp
Even though the C functions MPI_Buffer_attach and
MPI_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.
.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument.
.sp
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 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.
.SH SEE ALSO
.ft R
.sp
.nf
MPI_Buffer_attach
MPI_Bsend

116
ompi/mpi/man/man3/MPI_Buffer_detach.md Обычный файл
Просмотреть файл

@ -0,0 +1,116 @@
# Name
`MPI_Buffer_detach` - Removes an existing buffer (for use in
in `MPI_Bsend`, etc.)
# Syntax
## C Syntax
```c
#include <mpi.h>
int MPI_Buffer_detach(void *buf, int *size)
```
## Fortran Syntax
```fortran
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_BUFFER_DETACH(BUF, SIZE, IERROR)
<type> BUF(*)
INTEGER SIZE, IERROR
```
## Fortran 2008 Syntax
```fortran
USE mpi_f08
MPI_Buffer_detach(buffer_addr, size, ierror)
USE, INTRINSIC :: ISO_C_BINDING, ONLY
TYPE(C_PTR), INTENT(OUT) :: buffer_addr
INTEGER, INTENT(OUT) :: size
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
```
# Output Parameters
* `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.
Example: Calls to attach and detach buffers.
```c
#define BUFFSIZE 10000
int size
char *buff;
MPI_Buffer_attach( malloc(BUFFSIZE), BUFFSIZE);
/* a buffer of 10000 bytes can now be used by MPI_Bsend */
MPI_Buffer_detach( &buff, &size);
/* Buffer size reduced to zero */
MPI_Buffer_attach( buff, size);
/* Buffer of 10000 bytes available again */
```
# Notes
The 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
```c
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 (it's simple) and weaknesses (it only works for
nested usages).
For Fortran: 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.
For C: 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 `MPI_Buffer_attach` and `MPI_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.
# Errors
Almost all MPI routines return an error value; C routines as the value
of the function and Fortran routines in the last argument.
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
`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.
# See Also
[MPI_Buffer_attach(3)](MPI_Buffer_attach.html)
[MPI_Bsend(3)](MPI_Bsend.html)

Просмотреть файл

@ -25,6 +25,10 @@ include $(top_srcdir)/Makefile.ompi-rules
MD_FILES = \
MPI_Barrier.md \
MPI_Bsend.md \
MPI_Bsend_init.md \
MPI_Buffer_attach.md \
MPI_Buffer_detach.md \
MPI_T_init_thread.3.md \
MPI_Status_f2c.3.md \
MPI_Status_f082c.3.md \
@ -58,10 +62,6 @@ TEMPLATE_FILES = \
MPI_Attr_put.3in \
MPI_Ibarrier.3in \
MPI_Ibcast.3in \
MPI_Bsend.3in \
MPI_Bsend_init.3in \
MPI_Buffer_attach.3in \
MPI_Buffer_detach.3in \
MPI_Cancel.3in \
MPI_Cart_coords.3in \
MPI_Cart_create.3in \