Consider access to a single file using file handles from distinct collective opens. In order to guarantee sequential consistency, MPI_FILE_SYNC must be used (both opening and closing a file implicitly perform an MPI_FILE_SYNC).
Sequential consistency is guaranteed among accesses to a single file if
for any write sequence to the file,
there is no sequence
to the file which
is concurrent with
.
To guarantee sequential consistency when there are write sequences,
MPI_FILE_SYNC must be used
together with a mechanism that guarantees nonconcurrency of the sequences.
See the examples in Section 9.6.10,
page , for
further clarification of some of these consistency semantics.
MPI_FILE_SET_ATOMICITY(fh, flag)
int MPI_File_set_atomicity(MPI_File fh, int flag)
MPI_FILE_SET_ATOMICITY(FH, FLAG, IERROR)INTEGER FH, IERROR
LOGICAL FLAG
int MPI::File::Set_atomicity(bool flag)
void
Let be the set of file handles created by one collective open.
The consistency semantics for data access operations using
is set by collectively calling MPI_FILE_SET_ATOMICITY on
.
MPI_FILE_SET_ATOMICITY is collective;
all processes in the group must pass identical values for
fh and flag.
If flag is true, atomic mode is set;
if flag is false, nonatomic mode is set.
Changing the consistency semantics for an open file only affects new data accesses. All completed data accesses are guaranteed to abide by the consistency semantics in effect during their execution. Nonblocking data accesses and split collective operations that have not completed (e.g., via MPI_WAIT) are only guaranteed to abide by nonatomic mode consistency semantics.
MPI_FILE_GET_ATOMICITY(fh, flag)
int MPI_File_get_atomicity(MPI_File fh, int *flag)
MPI_FILE_GET_ATOMICITY(FH, FLAG, IERROR)INTEGER FH, IERROR
LOGICAL FLAG
int MPI::File::Get_atomicity() const
bool
MPI_FILE_GET_ATOMICITY returns the current consistency semantics for data access operations on the set of file handles created by one collective open. If flag is true, atomic mode is enabled; if flag is false, nonatomic mode is enabled.
int MPI_File_sync(MPI_File fh)
MPI_FILE_SYNC(FH, IERROR)INTEGER FH, IERROR
int MPI::File::Sync()
void
Calling MPI_FILE_SYNC with fh causes all previous writes to fh by the calling process to be transferred to the storage device. If other processes have made updates to the storage device, then all such updates become visible to subsequent reads of fh by the calling process. MPI_FILE_SYNC may be necessary to ensure sequential consistency in certain cases (see above).
MPI_FILE_SYNC is a collective operation.
The user is responsible for ensuring that all nonblocking requests and split collective operations on fh have been completed before calling MPI_FILE_SYNC--otherwise, the call to MPI_FILE_SYNC is erroneous.
MPI-Standard for MARMOT