44. Message Data

PreviousUpNext
Up: Blocking Send and Receive Operations Next: Message Envelope Previous: Blocking Send

The send buffer specified by the MPI_SEND operation consists of count successive entries of the type indicated by datatype, starting with the entry at address buf. Note that we specify the message length in terms of number of elements, not number of bytes. The former is machine independent and closer to the application level.

The data part of the message consists of a sequence of count values, each of the type indicated by datatype. count may be zero, in which case the data part of the message is empty. The basic datatypes that can be specified for message data values correspond to the basic datatypes of the host language. Possible values of this argument for Fortran and the corresponding Fortran types are listed in Table 1 .

MPI datatype Fortran datatype
MPI_INTEGER INTEGER
MPI_REAL REAL
MPI_DOUBLE_PRECISION DOUBLE PRECISION
MPI_COMPLEX COMPLEX
MPI_LOGICAL LOGICAL
MPI_CHARACTER CHARACTER(1)
MPI_BYTE
MPI_PACKED

Table 1: Predefined  MPI datatypes corresponding to Fortran datatypes

Possible values for this argument for C and the corresponding C types are listed in Table 2 .

MPI datatype C datatype
MPI_CHAR char

(treated as printable character)

MPI_SHORT signed short int
MPI_INT signed int
MPI_LONG signed long int
MPI_LONG_LONG_INT

signed long long int

MPI_LONG_LONG (as a synonym)

signed long long int

MPI_SIGNED_CHAR signed char

(treated as integral value)

MPI_UNSIGNED_CHAR unsigned char

(treated as integral value)

MPI_UNSIGNED_SHORT unsigned short int
MPI_UNSIGNED unsigned int
MPI_UNSIGNED_LONG unsigned long int
MPI_UNSIGNED_LONG_LONG

unsigned long long int

MPI_FLOAT float
MPI_DOUBLE double
MPI_LONG_DOUBLE long double
MPI_WCHAR

wchar_t

(defined in <stddef.h>)

(treated as printable character)

MPI_C_BOOL _Bool
MPI_INT8_T int8_t
MPI_INT16_T int16_t
MPI_INT32_T int32_t
MPI_INT64_T int64_t
MPI_UINT8_T uint8_t
MPI_UINT16_T uint16_t
MPI_UINT32_T uint32_t
MPI_UINT64_T uint64_t
MPI_C_COMPLEX float _Complex
MPI_C_FLOAT_COMPLEX (as a synonym) float _Complex
MPI_C_DOUBLE_COMPLEX double _Complex
MPI_C_LONG_DOUBLE_COMPLEX long double _Complex
MPI_BYTE
MPI_PACKED

Table 2: Predefined  MPI datatypes corresponding to C datatypes

MPI datatype C datatype Fortran datatype
MPI_AINT MPI_Aint INTEGER (KIND=MPI_ADDRESS_KIND)
MPI_OFFSET MPI_Offset INTEGER (KIND=MPI_OFFSET_KIND)
MPI_COUNT MPI_Count INTEGER (KIND=MPI_COUNT_KIND)

Table 3: Predefined  MPI datatypes corresponding to both C and Fortran datatypes

The datatypes MPI_BYTE and MPI_PACKED do not correspond to a Fortran or C datatype. A value of type MPI_BYTE consists of a byte (8 binary digits). A byte is uninterpreted and is different from a character. Different machines may have different representations for characters, or may use more than one byte to represent characters. On the other hand, a byte has the same binary value on all machines. The use of the type MPI_PACKED is explained in Section Pack and Unpack .

MPI requires support of these datatypes, which match the basic datatypes of Fortran and ISO C. Additional MPI datatypes should be provided if the host language has additional data types: MPI_DOUBLE_COMPLEX for double precision complex in Fortran declared to be of type DOUBLE COMPLEX; MPI_REAL2, MPI_REAL4, and MPI_REAL8 for Fortran reals, declared to be of type REAL*2, REAL*4 and REAL*8, respectively; MPI_INTEGER1, MPI_INTEGER2, and MPI_INTEGER4 for Fortran integers, declared to be of type INTEGER*1, INTEGER*2, and INTEGER*4, respectively; etc.


Rationale.

One goal of the design is to allow for MPI to be implemented as a library, with no need for additional preprocessing or compilation. Thus, one cannot assume that a communication call has information on the datatype of variables in the communication buffer; this information must be supplied by an explicit argument. The need for such datatype information will become clear in Section Data Conversion . ( End of rationale.)
The datatypes MPI_AINT, MPI_OFFSET, and MPI_COUNT correspond to the MPI-defined C types MPI_Aint, MPI_Offset, and MPI_Count and their Fortran equivalents INTEGER (KIND= MPI_ADDRESS_KIND), INTEGER (KIND= MPI_OFFSET_KIND), and INTEGER (KIND= MPI_COUNT_KIND). This is described in Table 3 . All predefined datatype handles are available in all language bindings. See Sections MPI Opaque Objects and Interlanguage Communication on page MPI Opaque Objects and Interlanguage Communication for information on interlanguage communication with these types.

If there is an accompanying C++ compiler then the datatypes in Table Message Data are also supported in C and Fortran.

MPI datatype C++ datatype
MPI_CXX_BOOL bool
MPI_CXX_FLOAT_COMPLEX std::complex<float>
MPI_CXX_DOUBLE_COMPLEX std::complex<double>
MPI_CXX_LONG_DOUBLE_COMPLEX std::complex<long double>

Predefined MPI datatypes corresponding to C++ datatypes


PreviousUpNext
Up: Blocking Send and Receive Operations Next: Message Envelope Previous: Blocking Send


Return to MPI-3.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-3.1 of June 4, 2015
HTML Generated on June 4, 2015