The following examples illustrate the use of derived datatypes.
Example
Send and receive a section of a 3D array.
Example
Copy the (strictly) lower triangular part of a matrix.
Example
Transpose a matrix.
Example
Another approach to the transpose problem:
Example
Use of MPI datatypes to manipulate an array of structures.
Example
The same manipulations as in the previous example, but use absolute
addresses in datatypes.
Example
This example shows how datatypes can be used to handle unions.
Example
This
example shows how a datatype can be decoded. The routine
printdatatype prints out the elements of the datatype. Note the use
of MPI_Type_free for datatypes that are not predefined.