Below is a table of all primitive MPI_Datatypes that may be used for calls:
|
MPI Datatypes |
|
|---|---|
|
MPI_INT |
signed int |
|
MPI_LONG |
signed long int |
|
MPI_SHORT |
signed short int |
|
MPI_CHAR |
signed char |
|
MPI_FLOAT |
float |
|
MPI_DOUBLE |
double |
|
MPI_UNSIGNED_CHAR |
unsigned char |
|
MPI_UNSIGNED |
unsigned int |
|
MPI_UNSIGNED_LONG |
unsigned long int |
|
MPI_UNSIGNED_SHORT |
unsigned short int |
|
MPI_PACKED |
|
|
MPI_BYTE |
|
MPI allows us to also create our own datatypes to use. The problem with just using the primitive datatypes is that they are contiguous, using MPI calls we can treat non-contiguous data like contiguous data. This type of data structure is called a derived datatype. The next few sections provide you with ways to use derived datatypes.
MPI_Datatype_contiguous( int count, MPI_Datatype old_type, MPI_Datatype *newtype );
| Parameter | Meaning of Parameter |
| count | replication count (nonnegative integer) |
| old_type | old datatype (handle) |
| newtype | new datatype (handle) |
MPI_Type_contiguous creates a contiguous datatype.
MPI_Type_vector( int count, int blocklength, int stride, MPI_Datatype old_type, MPI_Datatype *newtype );
| Parameter | Meaning of Parameter |
| count | number of blocks (nonnegative integer) |
| blocklength | number of elements in each block (nonnegative integer) |
| stride | number of elements between start of each block (integer) |
| old_type | old datatype (handle) |
| newtype | new datatype (handle) |
MPI_Type_vector creates a vector (strided) datatype.
MPI_Type_hvector( int count, int blocklength, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype *newtype );
| Parameter | Meaning of Parameter |
| count | number of blocks (nonnegative integer) |
| blocklength | number of elements in each block (nonnegative integer) |
| stride | number of bytes between start of each block (integer) |
| old_type | old datatype (handle) |
| newtype | new datatype (handle) |
MPI_Type_hvector creates a vector (strided) datatype with offset in bytes.
MPI_Type_indexed( int count, int blocklens[], int indices[], MPI_Datatype old_type, MPI_Datatype *newtype );
| Parameter | Meaning of Parameter |
| count | number of blocks – also number of entries in indices and blocklens |
| blocklens | number of elements in each block (array of nonnegative integer) |
| indices | displacement of each block in multiples of old_type (array of integers) |
| old_type | old datatype (handle) |
| newtype | new datatype (handle) |
MPI_Type_indexed creates an indexed datatype.
MPI_Type_hindexed( int count, int blocklens[], MPI_Aint indices[], MPI_Datatype old_type, MPI_Datatype *newtype );
| Parameter | Meaning of Parameter |
| count | number of blocks – also number of entries in indices and blocklens |
| blocklens | number of elements in each block (array of nonnegative integer) |
| indices | byte displacement of each block (array of Aint) |
| old_type | old datatype (handle) |
| newtype | new datatype (handle) |
MPI_Type_hindexed creates an indexed datatype with offsets in bytes.
MPI_Type_struct( int count, int blocklens[], MPI_Aint indices[], MPI_Datatype old_types[], MPI_Datatype *newtype );
| Parameter | Meaning of Parameter |
| count | number of blocks (integer) – also number of entries in arrays array_of_types, array_of_displacements and array_of_blocklengths |
| blocklens | number of elements in each block (array) |
| indices | byte displacement of each block (array) |
| old_types | type of elements in each block (array of handles to datatype objects) |
| newtype | new datatype (handle) |
MPI_Type_struct creates a struct datatype.
MPI_Type_extent( MPI_Datatype datatype, MPI_Aint *extent );
| Parameter | Meaning of Parameter |
| datatype | datatype (handle) |
| extent | datatype extent (integer) |
MPI_Type_extent returns the extent of a datatype.
MPI_Type_commit( MPI_Datatype *datatype );
| Parameter | Meaning of Parameter |
| datatype | datatype (handle) |
MPI_Type_commit commits the datatype.