## 10.1.6. C++ Datatypes

Up: C++ Next: Communicators Previous: Semantics

Table 1 lists all of the C++ predefined MPI datatypes and their corresponding C and C++ datatypes, Table 2 lists all of the Fortran predefined MPI datatypes and their corresponding Fortran 77 datatypes. Table 3 lists the C++ names for all other MPI datatypes.

MPI::BYTE and MPI::PACKED conform to the same restrictions as MPI_BYTE and MPI_PACKED, listed in Sections 3.2.2 and 3.13 of MPI-1, respectively.

MPI datatype | C datatype | C++ datatype
MPI::CHAR | `char` | `char`
MPI::WCHAR | `wchar_t` | `wchar_t`
MPI::SHORT | `signed short` | `signed short`
MPI::INT | `signed int` | `signed int`
MPI::LONG | `signed long` | `signed long`
MPI::SIGNED_CHAR | `signed char` | `signed char`
MPI::UNSIGNED_CHAR | `unsigned char` | `unsigned char`
MPI::UNSIGNED_SHORT | `unsigned short` | `unsigned short`
MPI::UNSIGNED | `unsigned int` | `unsigned int`
MPI::UNSIGNED_LONG | `unsigned long` | `unsigned long int`
MPI::FLOAT | `float` | `float`
MPI::DOUBLE | `double` | `double`
MPI::LONG_DOUBLE | `long double` | `long double`
MPI::BOOL |  | `bool`
MPI::COMPLEX |  | `Complex<float>`
MPI::DOUBLE_COMPLEX |  | `Complex<double>`
MPI::LONG_DOUBLE_COMPLEX |  | `Complex<long double>`
MPI::BYTE |  |
MPI::PACKED |  |

Table 1: C++ names for the MPI C and C++ predefined datatypes, and their corresponding C/C++ datatypes.

MPI datatype | Fortran datatype
MPI::CHARACTER | `CHARACTER(1)`
MPI::INTEGER | `INTEGER`
MPI::REAL | `REAL`
MPI::DOUBLE_PRECISION | `DOUBLE PRECISION`
MPI::LOGICAL | `LOGICAL`
MPI::F_COMPLEX | `COMPLEX`
MPI::BYTE |
MPI::PACKED |

Table 2: C++ names for the MPI Fortran predefined datatypes, and their corresponding Fortran 77 datatypes.

MPI datatype | Description
MPI::FLOAT_INT | C/C++ reduction type
MPI::DOUBLE_INT | C/C++ reduction type
MPI::LONG_INT | C/C++ reduction type
MPI::TWOINT | C/C++ reduction type
MPI::SHORT_INT | C/C++ reduction type
MPI::LONG_DOUBLE_INT | C/C++ reduction type
MPI::LONG_LONG | Optional C/C++ type
MPI::UNSIGNED_LONG_LONG | Optional C/C++ type
MPI::TWOREAL | Fortran reduction type
MPI::TWODOUBLE_PRECISION | Fortran reduction type
MPI::TWOINTEGER | Fortran reduction type
MPI::F_DOUBLE_COMPLEX | Optional Fortran type
MPI::INTEGER1 | Explicit size type
MPI::INTEGER2 | Explicit size type
MPI::INTEGER4 | Explicit size type
MPI::INTEGER8 | Explicit size type
MPI::REAL4 | Explicit size type
MPI::REAL8 | Explicit size type
MPI::REAL16 | Explicit size type

Table 3: C++ names for other MPI datatypes. Implementations may also define other optional types (e.g., `MPI::INTEGER8`).

The following table defines groups of MPI predefined datatypes:
C integer: MPI::INT, MPI::LONG, MPI::SHORT,
MPI::UNSIGNED_SHORT, MPI::UNSIGNED,
MPI::UNSIGNED_LONG, MPI::SIGNED_CHAR,
MPI::UNSIGNED_CHAR
Fortran integer: MPI::INTEGER
Floating point: MPI::FLOAT, MPI::DOUBLE, MPI::REAL,
MPI::DOUBLE_PRECISION,
MPI::LONG_DOUBLE
Logical: MPI::LOGICAL, MPI::BOOL
Complex: MPI::F_COMPLEX, MPI::COMPLEX,
MPI::F_DOUBLE_COMPLEX,
MPI::DOUBLE_COMPLEX,
MPI::LONG_DOUBLE_COMPLEX
Byte: MPI::BYTE

Valid datatypes for each reduction operation is specified below in terms of the groups defined above.

Op Allowed Types
MPI::MAX, MPI::MIN C integer, Fortran integer, Floating point
MPI::SUM, MPI::PROD C integer, Fortran integer, Floating point, Complex
MPI::LAND, MPI::LOR, MPI::LXOR C integer, Logical
MPI::BAND, MPI::BOR, MPI::BXOR C integer, Fortran integer, Byte

MPI::MINLOC and MPI::MAXLOC perform just as their C and Fortran counterparts; see Section 4.9.3 in MPI-1.

Up: C++ Next: Communicators Previous: Semantics

Return to MPI-2 Standard Index
Return to MPI 1.1 Standard Index
Return to MPI Forum Home Page

MPI-2.0 of July 18, 1997
HTML Generated on September 10, 2001