[97] | 1 | .\"Copyright 2006-2008 Sun Microsystems, Inc. |
---|
| 2 | .\" Copyright (c) 1996 Thinking Machines Corporation |
---|
| 3 | .TH MPI_Sendrecv_replace 3 "Dec 08, 2009" "1.4" "Open MPI" |
---|
| 4 | .SH NAME |
---|
| 5 | \fBMPI_Sendrecv_replace\fP \- Sends and receives a message using a single buffer. |
---|
| 6 | |
---|
| 7 | .SH SYNTAX |
---|
| 8 | .ft R |
---|
| 9 | .SH C Syntax |
---|
| 10 | .nf |
---|
| 11 | #include <mpi.h> |
---|
| 12 | int MPI_Sendrecv_replace(void *\fIbuf\fP, int\fI count\fP, MPI_Datatype\fI datatype\fP, |
---|
| 13 | int\fI dest\fP, int\fI sendtag\fP, int\fI source\fP, int\fI recvtag\fP, MPI_Comm\fI comm\fP, |
---|
| 14 | MPI_Status\fI *status\fP) |
---|
| 15 | |
---|
| 16 | .SH Fortran Syntax |
---|
| 17 | .nf |
---|
| 18 | INCLUDE 'mpif.h' |
---|
| 19 | MPI_SENDRECV_REPLACE(\fIBUF, COUNT, DATATYPE, DEST, SENDTAG, SOURCE, |
---|
| 20 | RECVTAG, COMM, STATUS, IERROR\fP) |
---|
| 21 | <type> \fIBUF\fP(*) |
---|
| 22 | INTEGER \fICOUNT, DATATYPE, DEST, SENDTAG\fP |
---|
| 23 | INTEGER \fISOURCE, RECVTAG, COMM\fP |
---|
| 24 | INTEGER \fISTATUS(MPI_STATUS_SIZE), IERROR\fP |
---|
| 25 | |
---|
| 26 | .SH C++ Syntax |
---|
| 27 | .nf |
---|
| 28 | #include <mpi.h> |
---|
| 29 | void Comm::Sendrecv_replace(void* \fIbuf\fP, int \fIcount\fP, const |
---|
| 30 | Datatype& \fIdatatype\fP, int \fIdest\fP, int \fIsendtag\fP, int \fIsource\fP, |
---|
| 31 | int \fIrecvtag\fP, Status& \fIstatus\fP) const |
---|
| 32 | |
---|
| 33 | void Comm::Sendrecv_replace(void* \fIbuf\fP, int \fIcount\fP, const |
---|
| 34 | Datatype& \fIdatatype\fP, int \fIdest\fP, int \fIsendtag\fP, int \fIsource\fP, |
---|
| 35 | int \fIrecvtag\fP) const |
---|
| 36 | |
---|
| 37 | .SH INPUT/OUTPUT PARAMETER |
---|
| 38 | .ft R |
---|
| 39 | .TP 1i |
---|
| 40 | buf |
---|
| 41 | Initial address of send and receive buffer (choice). |
---|
| 42 | |
---|
| 43 | .SH INPUT PARAMETERS |
---|
| 44 | .ft R |
---|
| 45 | .TP 1i |
---|
| 46 | count |
---|
| 47 | Number of elements in send and receive buffer (integer). |
---|
| 48 | .TP 1i |
---|
| 49 | datatype |
---|
| 50 | Type of elements to send and receive (handle). |
---|
| 51 | .TP 1i |
---|
| 52 | dest |
---|
| 53 | Rank of destination (integer). |
---|
| 54 | .TP 1i |
---|
| 55 | sendtag |
---|
| 56 | Send message tag (integer). |
---|
| 57 | .TP 1i |
---|
| 58 | source |
---|
| 59 | Rank of source (integer). |
---|
| 60 | .TP 1i |
---|
| 61 | recvtag |
---|
| 62 | Receive message tag (integer). |
---|
| 63 | .TP 1i |
---|
| 64 | comm |
---|
| 65 | Communicator (handle). |
---|
| 66 | |
---|
| 67 | .SH OUTPUT PARAMETERS |
---|
| 68 | .ft R |
---|
| 69 | .TP 1i |
---|
| 70 | status |
---|
| 71 | Status object (status). |
---|
| 72 | .TP 1i |
---|
| 73 | IERROR |
---|
| 74 | Fortran only: Error status (integer). |
---|
| 75 | |
---|
| 76 | .SH DESCRIPTION |
---|
| 77 | .ft R |
---|
| 78 | The send-receive operations combine in one call the sending of a message to one destination and the receiving of another message, from another process. The two (source and destination) are possibly the same. A send-receive operation is useful for executing a shift operation across a chain of processes. If blocking sends and receives are used for such a shift, then one needs to order the sends and receives correctly (for example, even processes send, then receive; odd processes receive first, then send) in order to prevent cyclic dependencies that may lead to deadlock. When a send-receive operation is used, the communication subsystem takes care of these issues. The send-receive operation can be used in conjunction with the functions described in Chapter 6 of the MPI Standard, "Process Topologies," in order to perform shifts on various logical topologies. Also, a send-receive operation is useful for implementing remote procedure calls. |
---|
| 79 | .sp |
---|
| 80 | A message sent by a send-receive operation can be received by a regular receive operation or probed by a probe operation; a send-receive operation can receive a message sent by a regular send operation. |
---|
| 81 | .sp |
---|
| 82 | MPI_Sendrecv_replace executes a blocking send and receive. The same buffer is used both for the send and for the receive, so that the message sent is replaced by the message received. |
---|
| 83 | .sp |
---|
| 84 | The semantics of a send-receive operation is what would be obtained if the caller forked two concurrent threads, one to execute the send, and one to execute the receive, followed by a join of these two threads. |
---|
| 85 | |
---|
| 86 | .SH ERRORS |
---|
| 87 | Almost 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. |
---|
| 88 | .sp |
---|
| 89 | Before the error value is returned, the current MPI error handler is |
---|
| 90 | 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. |
---|
| 91 | |
---|
| 92 | .SH SEE ALSO |
---|
| 93 | .ft R |
---|
| 94 | .sp |
---|
| 95 | MPI_Sendrecv |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | |
---|