76. True Extent of Datatypes


Up: Derived Datatypes Next: Commit and Free Previous: Extent and Bounds of Datatypes

Suppose we implement gather (see also Section Gather on page Gather ) as a spanning tree implemented on top of point-to-point routines. Since the receive buffer is only valid on the root process, one will need to allocate some temporary space for receiving data on intermediate nodes. However, the datatype extent cannot be used as an estimate of the amount of space that needs to be allocated, if the user has modified the extent using the MPI_UB and MPI_LB values. A function is provided which returns the true extent of the datatype.

MPI_TYPE_GET_TRUE_EXTENT(datatype, true_lb, true_extent)
IN datatypedatatype to get information on (handle)
OUT true_lbtrue lower bound of datatype (integer)
OUT true_extenttrue size of datatype (integer)

int MPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint *true_lb, MPI_Aint *true_extent)

MPI_TYPE_GET_TRUE_EXTENT(DATATYPE, TRUE_LB, TRUE_EXTENT, IERROR)
INTEGER DATATYPE, IERROR
INTEGER(KIND = MPI_ADDRESS_KIND) TRUE_LB, TRUE_EXTENT

{ void MPI::Datatype::Get_true_extent(MPI::Aint& true_lb, MPI::Aint& true_extent) const (binding deprecated, see Section Deprecated since MPI-2.2 ) }

true_lb returns the offset of the lowest unit of store which is addressed by the datatype, i.e., the lower bound of the corresponding typemap, ignoring MPI_LB markers. true_extent returns the true size of the datatype, i.e., the extent of the corresponding typemap, ignoring MPI_LB and MPI_UB markers, and performing no rounding for alignment. If the typemap associated with datatype is

Typemap = { (type0, disp0), ... , (typen-1, dispn-1)}

Then

and

true_extent (Typemap) = true_ub(Typemap) - true_lb(typemap).

(Readers should compare this with the definitions in Section Lower-Bound and Upper-Bound Markers on page Lower-Bound and Upper-Bound Markers and Section Extent and Bounds of Datatypes on page Extent and Bounds of Datatypes , which describe the function MPI_TYPE_GET_EXTENT.) The true_extent is the minimum number of bytes of memory necessary to hold a datatype, uncompressed.



Up: Derived Datatypes Next: Commit and Free Previous: Extent and Bounds of Datatypes


Return to MPI-2.2 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-2.2 of September 4, 2009
HTML Generated on September 10, 2009