User-defined Datatypes



next up previous contents
Next: Collective Communications Up: An Introduction to the Previous: Point to Point

User-defined Datatypes

All MPI communication functions take a datatype argument. In the simplest case this will be a primitive type, such as an integer or floating-point number. An important and powerful generalization results by allowing user-defined types wherever the primitive types can occur. These are not ``types'' as far as the programming language is concerned. They are only ``types'' in that MPI is made aware of them through the use of type-constructor functions, and they describe the layout, in memory, of sets of primitive types. Through user-defined types, MPI supports the communication of complex data structures such as array sections and structures containing combinations of primitive datatypes. Figure 2 gives an example of using a user-defined type to send the upper-triangular part of a matrix.



Jack Dongarra
Tue Jan 17 21:48:11 EST 1995