Basic Datatypes
The types of data already defined for you in MPI are called basic datatypes, and are listed below.
Warning: Differences between the C and the Fortran implementations
The names are slightly different between the C and the Fortran implementations.
MPI Basic Datatypes for C
MPI Datatype | C Datatype |
---|---|
MPI_CHAR | signed char |
MPI_SHORT | signed short int |
MPI_INT | signed int |
MPI_LONG | signed long int |
MPI_UNSIGNED_CHAR | unsigned char |
MPI_UNSIGNED_SHORT | unsigned short int |
MPI_UNSIGNED | unsigned int |
MPI_UNSIGNED_LONG | unsigned long int |
MPI_FLOAT | float |
MPI_DOUBLE | double |
MPI_LONG_DOUBLE | long double |
MPI_BYTE | |
MPI_PACKED |
MPI Basic Datatypes for Fortran
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 |
Derived Datatypes
Additional datatypes, called derived datatypes can also be defined. You can define a datatype for noncontiguous data or for a sequence of mixed basic datatypes. This can make programming easier and often make the code run faster. Derived datatypes are beyond the scope of this introduction, and are covered in MPI Advanced Topics.
Some of the templates that are available for derived datatypes are:
- Contiguous
- Vector
- Hvector
- Indexed
- Hindexed
- Struct
- Packed
- Subarray