Blocking Send and Receive Syntax
There is one blocking SEND routine for each of the four communication modes.
Communication Mode | Blocking Send Routines |
---|---|
Synchronous | MPI_Ssend |
Buffered | MPI_Bsend |
Ready | MPI_Rsend |
Standard | MPI_Send |
Regardless of communication mode, the send commands share the same syntax. In this section we'll take a quick look at the signature for these commands and review what the parameters mean. For a more in depth look, please refer to the MPI messages topic.
C:
int MPI_Send(void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm)
int MPI_Recv(void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Status *status)
Fortran:
MPI_SEND(buf, count, datatype, dest, tag, comm, ierror)
MPI_RECV(buf, count, datatype, source, tag, comm, status, ierror)
Functional description of MPI_Send and Recv parameters.
- buf
- The beginning of the buffer containing the data to be sent. For Fortran, this is often the name of an array in your program. For C, it is an address.
- count
- The number of elements to be sent (not bytes).
- datatype
- The type of data, either a predefined MPI_Datatype or user-defined derivative type.
- dest or source
- The beginning of the buffer containing the data to be sent. For Fortran, this is often the name of an array in your program. For C, it is an address.
- tag
- The beginning of the buffer containing the data to be sent. For Fortran, this is often the name of an array in your program. For C, it is an address.
- comm
- The communicator id
- ierror
- The returned error code (Fortran only—in C, check the function's return value)
- status
- The array or structure of information that is returned. For example, if you specify a wildcard for source or tag, the status will tell you the actual rank or tag for the message received.