MPI_SENDRECV, MPI_Sendrecv Purpose Performs a blocking send and receive operation. C synopsis #include int MPI_Sendrecv(void *sendbuf,int sendcount,MPI_Datatype sendtype, int dest,int sendtag,void *recvbuf,int recvcount, MPI_Datatype recvtype,int source,int recvtag, MPI_Comm comm,MPI_Status *status); C++ synopsis #include mpi.h void MPI::Comm::Sendrecv(const void* sendbuf, int sendcount, const MPI::Datatype& sendtype, int dest, int sendtag, void* recvbuf, int recvcount, const MPI::Datatype& recvtype, int source, int recvtag) const; #include mpi.h void MPI::Comm::Sendrecv(const void* sendbuf, int sendcount, const MPI::Datatype& sendtype, int dest, int sendtag, void* recvbuf, int recvcount, const MPI::Datatype& recvtype, int source, int recvtag, MPI::Status& status) const; FORTRAN synopsis include 'mpif.h' or use mpi MPI_SENDRECV(CHOICE SENDBUF,INTEGER SENDCOUNT,INTEGER SENDTYPE, INTEGER DEST,INTEGER SENDTAG,CHOICE RECVBUF,INTEGER RECVCOUNT, INTEGER RECVTYPE,INTEGER SOURCE,INTEGER RECVTAG,INTEGER COMM, INTEGER STATUS(MPI_STATUS_SIZE),INTEGER IERROR) Parameters sendbuf is the initial address of the send buffer (choice) (IN) sendcount is the number of elements to be sent (integer) (IN) sendtype is the type of elements in the send buffer (handle) (IN) dest is the rank of the destination task (integer) (IN) sendtag is the send tag (integer) (IN) recvbuf is the initial address of the receive buffer (choice) (OUT) recvcount is the number of elements to be received (integer) (IN) recvtype is the type of elements in the receive buffer (handle) (IN) source is the rank of the source task or MPI_ANY_SOURCE (integer) (IN) recvtag is the receive tag or MPI_ANY_TAG (integer) (IN) comm is the communicator (handle) (IN) status is the status object (Status) (INOUT). Note that in FORTRAN a single status object is an array of integers. IERROR is the FORTRAN return code. It is always the last argument. Description This subroutine is a blocking send and receive operation. Send and receive use the same communicator but can use different tags. The send and the receive buffers must be disjoint and can have different lengths and datatypes. Passing MPI_STATUS_IGNORE for the status argument causes PE MPI to skip filling in the status fields. By passing this value for status, you can avoid having to allocate a status object in programs that do not need to examine the status fields. Errors Invalid count(s) count < 0 Invalid datatype(s) Type not committed Invalid destination dest < 0 or dest > = groupsize Invalid source source < 0 or source > = groupsize Invalid communicator Invalid tag(s) tag < 0 Invalid status ignore value MPI not initialized MPI already finalized Related information MPI_RECV MPI_SEND