The size of a file may be increased by writing to the file after the current end of file. The size may also be changed by calling MPI size changing routines, such as MPI_FILE_SET_SIZE. A call to a size changing routine does not necessarily change the file size. For example, calling MPI_FILE_PREALLOCATE with a size less than the current size does not change the size.
Consider a set of bytes that has been written to a file since the most recent call to a size changing routine, or since MPI_FILE_OPEN if no such routine has been called. Let the high byte be the byte in that set with the largest displacement. The file size is the larger of
Advice to users.
Any sequence of operations containing the collective routines
MPI_FILE_SET_SIZE and MPI_FILE_PREALLOCATE
is a write sequence.
As such, sequential consistency in nonatomic mode is not
guaranteed unless the conditions in Section File Consistency
are satisfied.
( End of advice to users.)
File pointer update semantics (i.e., file pointers are
updated by the amount accessed) are only guaranteed if file size
changes are sequentially consistent.
Advice to users.
Consider the following example. Given two operations made by
separate processes to a file containing 100 bytes: an
MPI_FILE_READ of 10 bytes and an MPI_FILE_SET_SIZE to 0
bytes. If the user does not enforce sequential consistency
between these two operations,
the file pointer may be updated by the amount
requested (10 bytes) even if the amount accessed is zero bytes.
( End of advice to users.)