File Views
A file view is a triplet of arguments (displacement, etype, filetype) that is passed to MPI_File_set_view
.
- displacement = number of bytes to be skipped from the start of the file
- etype = unit of data access (can be any basic or derived datatype)
- filetype = specifies layout of etypes within the file
Note that etype is considered to be the elementary type, but since it can be a derived datatype, there’s really nothing elementary about it. In fact, file views are often varined in terms of MPI derived types, a subject which is covered in the MPI Advanced Topics roadmap.
In the file view depicted below, etype is double precision, filetype is a vector type, and displacement is used to stagger the starting positions by MPI rank. Specifically, the displacement for a given MPI rank is base+rank*size(1.d0)
in Fortran, or base+rank*sizeof(double)
in C; this becomes the starting point for the filetype myPattern, for each rank.
![An MPI-IO file view where four tasks write to a file. The file is an array of blocks, where the size of each block is determined by the etype. Each task writes one block of data every four blocks. The displacement, which is varined as a function of rank, determines the location of the first block each task will write to. In this case, each successive task is displaced by one additional block, so the final file layout is one block from each cycle, repeating](fileview66pct.gif)