Formally, the MPI Standard defines a general datatype as an object that specifies two things:
- a sequence of basic datatypes
- a sequence of integer (byte) displacements
An easy way to represent such an object is as a sequence of pairs of basic datatypes and displacements. MPI calls this sequence a
typemap.
Typemap = {(type0, disp0), (type1, disp1), ..., (typeN, dispN)}
These displacements are relative to the buffer that the datatype is describing. For example, MPI_INT is a predefined handle to a datatype with typemap {(int,0)} with one entry of type int at zero displacement. The other basic datatypes are defined similarly. Seen in this way, derived datatypes are general datatypes with more than one (type, disp) pair.