Hardware Reference
In-Depth Information
consist of multiple noncontiguous regions in the file. When this happens, the
noncontiguous regions are logically stitched together into a contiguous region,
which is read or written as if the view is a contiguous byte stream.
MPI datatypes, both basic and derived, are used to set file views. File views
are specified by a triplet: displacement, etype, and filetype. The displacement
is the number of bytes to be skipped from the beginning of the file. The etype
(elementary datatype) is the smallest unit for file access and positioning, which
can be an MPI basic or derived datatype. The file offset argument in all MPI-
IO functions is specified in terms of the number of etypes. The filetype is an
MPI basic or derived datatype that specifies the portions of the file that are
\visible" to a process. The letype must be either the same as the etype or a
derived datatype constructed out of the etype. A process's le view starts at
the displacement, followed by repeated copies of the filetype. When a call to
MPIFileopen returns, the default file view sets the displacement to 0 and
both etype and filetype to MPIBYTE . The example programs shown in Figures
13.2 and 13.4(a) use the default file view.
The program fragment shown in Figure 13.4(b) constructs the derived
datatype, ftype , through a call to MPITypecreatesubarray to describe
the file view for each of the four processes in the 2D array example. The argu-
ments gsizes and subsizes are the sizes of global array and local subarray,
respectively. The starting array offsets relative to the global array are set in
the argument starts . Once the newly created filetype, ftype , is committed,
it can be used in MPIFilesetview to change a process's le view. This
example uses disp for the file displacement, MPIINT for etype, \native" for
data representation, and info for MPI-IO hints (Section 13.4).
Figure 13.5 illustrates the file views of the four processes in this example.
The file portions visible to individual processes are marked as shaded areas.
Note that the filetype extents specified by ftype across four processes all
P 0 's ftype data type extent
P 0 's fileview
P
P 1
P
P 1
P
P 1
P 2
P 3
P 2
P 3
P
P 1
P
P 1
P
P 1
P 2
P 3
disp
0
P 1 's ftype data type extent
P 1 's fileview
P 1
P
P 1
P
P 1
P 2
P 3
P 2
P 3
P
P 1
P
P 1
P
P 1
P 2
P 3
disp
P 2 's ftype data type extent
P 2 's fileview
P 2
P 3
P 2
P 3
P
P 1
P
P 1
P
P 1
P 2
P 3
disp
P 3 's ftype data type extent
P 3 's fileview
P 3
P 2
P 3
P
P 1
P
P 1
P
P 1
P 2
P 3
disp
FIGURE13.5:Individualprocess'sleviewsforthe2Darrayexamplein
Figure13.3.Theshadedareaindicatestheleportionsvisibletoaprocess.A
leviewisconstructedbyrepeatedlyapplyingtheletype'sextent,starting
fromthedisplacementargument, disp .
Search WWH ::




Custom Search