File View Examples
Example 1:
We write contiguous data into a contiguous block defined by a file view. We give each process a different file view using MPI_File_set_view
so that together, the processes lay out a series of blocks in the file, one block per process.
Example 2:
We write contiguous data into two separate blocks defined by a file view. Each block is a contiguous type in memory, but the pair of blocks is a vector type in the file view. We again use displacements to lay out a series of blocks in the file, so that two blocks are written per process, in a repeating fashion.
- The data type in memory is just a contiguous set of NW ints.
- The file view is of type fileblk, displaced by rank*NW*sizeof(int).
- Two units of the data type are written into the file whose view has been set.