If the file data representation is other than ``native,'' care
must be taken in constructing etypes and filetypes. Any of the
datatype constructor functions may be used; however, for those
functions that accept displacements in bytes, the displacements
must be specified in terms of their values in the file for the
file data representation being used.
MPI-/ will interpret these byte displacements as is;
no scaling will be done.
The function
MPI_FILE_GET_TYPE_EXTENT can be used to calculate
the extents of datatypes in the file.
For etypes and filetypes that are portable datatypes
(see Section 2.4, page ),
MPI-/ will scale any displacements in the datatypes
to match the file data representation.
Datatypes passed as
arguments to read/write routines specify the data layout in
memory; therefore, they must always be constructed using
displacements corresponding to displacements in memory.
File data representations other than ``native'' may
be different from corresponding data representations in
memory. Therefore, for these file data representations,
it is important not to use hardwired byte offsets for
file positioning, including the initial displacement that
specifies the view.
When a portable datatype
(see Section 2.4, page )
is used in a data access operation,
any holes in the datatype are scaled to match the data representation.
However,
note that this technique only works when all the processes
that created the file view build their etypes from the same
predefined datatypes.
For example, if one
process
uses an etype built from MPI_INT
and another uses an etype built from MPI_FLOAT,
the resulting views
may
be nonportable because the relative
sizes of these types may differ from one data representation to another.(End of advice to users.)
MPI_FILE_GET_TYPE_EXTENT(fh, datatype, extent)
int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent)
MPI_FILE_GET_TYPE_EXTENT(FH, DATATYPE, EXTENT, IERROR)INTEGER FH, DATATYPE, IERROR
INTEGER(KIND=MPI_ADDRESS_KIND) EXTENT
int MPI::File::Get_type_extent(const MPI::Datatype& datatype) const
MPI::Aint
Returns the extent of datatype in the file fh.
This extent will be the same for all processes accessing
the file fh.
If the current view uses a user-defined data representation
(see Section 9.5.3, page ),
MPI-/ uses the dtype_file_extent_fn callback
to calculate the extent.
MPI-Standard for MARMOT