Lower-bound and Upper-bound Markers



next up previous contents
Next: Absolute Addresses Up: User-Defined Datatypes and Previous: Address Function

Lower-bound and Upper-bound Markers

 

Sometimes it is necessary to override the definition of extent given in Section gif. markersderived datatype, markers Consider, for example, the code in Example gif in the previous section. Assume that a double occupies 8 bytes and must be double-word aligned. There will be 7 bytes of padding after the first field and one byte of padding after the last field of the structure Partstruct, and the structure will occupy 64 bytes. If, on the other hand, a double can be word aligned only, then there will be only 3 bytes of padding after the first field, and Partstruct will occupy 60 bytes. The MPI library will follow the alignment rules used on the target systems so that the extent of datatype Particletype equals the amount of storage occupied by Partstruct. The catch is that different alignment rules may be specified, on the same system, using different compiler options. An even more difficult problem is that some compilers allow the use of pragmas in order to specify different alignment rules for different structures within the same program. (Many architectures can correctly handle misaligned values, but with lower performance; different alignment rules trade speed of access for storage density.) The MPI library will assume the default alignment rules. However, the user should be able to overrule this assumption if structures are packed otherwise. alignment

To allow this capability, MPI has two additional ``pseudo-datatypes,'' MPI_LB and MPI_UB, MPI_LB MPI_UB that can be used, respectively, to mark the lower bound or the upper bound of a datatype. These pseudo-datatypes occupy no space ( extent(MPI_LB)=extent(MPI_UB)= 0 ). They do not affect the size or count of a datatype, and do not affect the the content of a message created with this datatype. However, they do change the extent of a datatype and, therefore, affect the outcome of a replication of this datatype by a datatype constructor.



next up previous contents
Next: Absolute Addresses Up: User-Defined Datatypes and Previous: Address Function



Jack Dongarra
Fri Sep 1 06:16:55 EDT 1995