Skip to content

Commit 90f6f78

Browse files
committed
Doc update: deprecate NC_SHARE and --disable-file-sync
1 parent 0368c82 commit 90f6f78

File tree

4 files changed

+62
-37
lines changed

4 files changed

+62
-37
lines changed

doc/README.consistency.md

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,53 @@
11
## Note on parallel I/O data consistency
22

3-
PnetCDF follows the same parallel I/O data consistency as MPI-IO standard.
4-
Refer the URL below for more information.
3+
PnetCDF follows the same parallel I/O data consistency as MPI-IO standard,
4+
quoted below.
5+
6+
```
7+
Consistency semantics define the outcome of multiple accesses to a single file.
8+
All file accesses in MPI are relative to a specific file handle created from a
9+
collective open. MPI provides three levels of consistency:
10+
* sequential consistency among all accesses using a single file handle,
11+
* sequential consistency among all accesses using file handles created from a
12+
single collective open with atomic mode enabled, and
13+
* user-imposed consistency among accesses other than the above.
14+
Sequential consistency means the behavior of a set of operations will be as if
15+
the operations were performed in some serial order consistent with program
16+
order; each access appears atomic, although the exact ordering of accesses is
17+
unspecified. User-imposed consistency may be obtained using program order and
18+
calls to MPI_FILE_SYNC.
19+
```
20+
21+
Users are referred to the MPI standard Chapter 14.6 Consistency and Semantics
22+
for more information.
523
http://www.mpi-forum.org/docs/mpi-2.2/mpi22-report/node296.htm#Node296
624

725
Readers are also referred to the following paper.
826
Rajeev Thakur, William Gropp, and Ewing Lusk, On Implementing MPI-IO Portably
927
and with High Performance, in the Proceedings of the 6th Workshop on I/O in
1028
Parallel and Distributed Systems, pp. 23-32, May 1999.
1129

12-
If users would like PnetCDF to enforce a stronger consistency, they should add
13-
NC_SHARE flag when open/create the file. By doing so, PnetCDF adds
14-
MPI_File_sync() after each MPI I/O calls.
15-
* For PnetCDF collective APIs, an MPI_Barrier() will also be called right
16-
after MPI_File_sync().
17-
* For independent APIs, there is no need for calling MPI_Barrier().
18-
19-
Users are warned that the I/O performance when using NC_SHARE flag could become
20-
significantly slower than not using it.
21-
22-
If NC_SHARE is not set, then users are responsible for their desired data
23-
consistency. To enforce a stronger consistency, users can explicitly call
24-
ncmpi_sync(). In ncmpi_sync(), MPI_File_sync() and MPI_Barrier() are called.
30+
* NC_SHARE has been deprecated in PnetCDF release of 1.13.0.
31+
+ NC_SHARE is a legacy flag inherited from NetCDF-3, whose purpose is to
32+
provide some degree of data consistency for multiple processes concurrently
33+
accessing a shared file. To achieve a stronger consistency, user
34+
applications are required to also synchronize the processes, such as
35+
calling MPI_Barrier, together with nc_sync.
36+
+ Because PnetCDF follows the MPI file consistency, which only addresses the
37+
case when all file accesses are relative to a specific file handle created
38+
from a collective open, NC_SHARE becomes invalid. Note that NetCDF-3
39+
supports only sequential I/O and thus has no collective file open per se.
40+
41+
If users would like a stronger consistency, they may consider using the code
42+
fragment below after each collective write API call (e.g.
43+
`ncmpi_put_vara_int_all`, `ncmpi_wait_all` `ncmpi_enddef`, `ncmpi_redef`,
44+
`ncmpio_begin_indep_data`, `ncmpio_end_indep_data`).
45+
```
46+
ncmpi_sync(ncid);
47+
MPI_Barrier(comm);
48+
ncmpi_sync(ncid);
49+
```
50+
Users are warned that the I/O performance could become significantly slower.
2551

2652
### Note on header consistency in memory and file
2753
In data mode, changes to file header can happen in the following scenarios.

man/pnetcdf.m4

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,9 @@ Creates a new netCDF dataset at ARG(path) collectively by a group of MPI
495495
processes specified by ARG(comm), returning a netCDF ID in ARG(ncid). The
496496
argument ARG(cmode) may <<include>> the bitwise-or of the following flags:
497497
MACRO(NOCLOBBER) to protect existing datasets (default is MACRO(CLOBBER),
498-
silently blows them away), MACRO(SHARE) for stronger metadata data consistency
499-
control, MACRO(64BIT_OFFSET) to create a file in the 64-bit offset format
500-
(CDF-2), as opposed to classic format, the default, or MACRO(64BIT_DATA) to
501-
create a file in the 64-bit data format (CDF-5).
498+
silently blows them away), MACRO(64BIT_OFFSET) to create a file in the
499+
64-bit offset format (CDF-2), as opposed to classic format, the default, or
500+
MACRO(64BIT_DATA) to create a file in the 64-bit data format (CDF-5).
502501
Use either MACRO(64BIT_OFFSET) or MACRO(64BIT_DATA).
503502
The 64-bit offset format allows the creation of very large files with far fewer
504503
restrictions than netCDF classic format, but can only be read by the netCDF
@@ -530,7 +529,7 @@ Opens an existing netCDF dataset at ARG(path) collectively by a group of MPI
530529
processes specified by ARG(comm), returning a netCDF ID in ARG(ncid). The type
531530
of access is described by the ARG(mode) parameter, which may <<include>> the
532531
bitwise-or of the following flags: MACRO(WRITE) for read-write access (default
533-
read-only), MACRO(SHARE) for stronger metadata data consistency control.
532+
read-only).
534533
.sp
535534
ifelse(DAP,TRUE,
536535
<<As of NetCDF version 4.1, and if DAP support was enabled
@@ -559,11 +558,7 @@ After a successful call, variable data can be read or written to the dataset.
559558
.HP
560559
FDECL(sync, (INCID()))
561560
.sp
562-
Unless the
563-
MACRO(SHARE)
564-
bit is set in
565-
FREF(open) or FREF(create),
566-
data written by PnetCDF APIs may be cached by local file system on each compute
561+
Data written by PnetCDF APIs may be cached by local file system on each compute
567562
node. This <<API>> flushes cached data by calling MPI_File_sync.
568563
.HP
569564
FDECL(abort, (INCID()))

man/pnetcdf_f90.m4

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ Creates a new netCDF dataset at \fIpath\fP collectively by a group of MPI
7474
processes specified by \fIcomm\fP, returning a netCDF ID in \fIncid\fP. The
7575
argument \fIcmode\fP may include the bitwise-or of the following flags:
7676
\fBnf90_noclobber\fR to protect existing datasets (default is \fBnf90_clobber\fR,
77-
silently blows them away), \fBnf90_share\fR for stronger metadata data consistency
78-
control, \fBnf90_64bit_offset\fR to create a file in the 64-bit offset format
79-
(CDF-2), as opposed to classic format, the default, or \fBnf90_64bit_data\fR to
80-
create a file in the 64-bit data format (CDF-5).
77+
silently blows them away), \fBnf90_64bit_offset\fR to create a file in the
78+
64-bit offset format (CDF-2), as opposed to classic format, the default, or
79+
\fBnf90_64bit_data\fR to create a file in the 64-bit data format (CDF-5).
8180
Use either \fBnf90_64bit_offset\fR or \fBnf90_64bit_data\fR.
8281
The 64-bit offset format allows the creation of very large files with far fewer
8382
restrictions than netCDF classic format, but can only be read by the netCDF
@@ -115,7 +114,7 @@ Opens an existing netCDF dataset at \fIpath\fP collectively by a group of MPI
115114
processes specified by \fIcomm\fP, returning a netCDF ID in \fIncid\fP. The type
116115
of access is described by the \fImode\fP parameter, which may include the
117116
bitwise-or of the following flags: \fBnf90_write\fR for read-write access (default
118-
read-only), \fBnf90_share\fR for stronger metadata data consistency control.
117+
read-only).
119118
.sp
120119

121120
The argument \fImode\fP must be consistent among all MPI processes that
@@ -158,11 +157,7 @@ integer, intent(in) :: ncid
158157
integer :: nf90mpi_sync
159158
.fi
160159
.sp
161-
Unless the
162-
\fBnf90_share\fR
163-
bit is set in
164-
\fBnf90mpi_open(\|)\fR or \fBnf90mpi_create(\|)\fR,
165-
data written by PnetCDF APIs may be cached by local file system on each compute
160+
Data written by PnetCDF APIs may be cached by local file system on each compute
166161
node. This API flushes cached data by calling MPI_File_sync.
167162
.RE
168163
.HP

sneak_peek.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ This is essentially a placeholder for the next release note ...
2222
+ none
2323
2424
* Configure options
25+
+ `--disable-file-sync` is now deprecated. This configure option alone does
26+
not provide a sufficient data consistency. Users are suggested to call
27+
`ncmpi_sync` and `MPI_Barrier` to achieve a desired consistency.
2528
+ `--enable-install-examples` to install example programs under folder
2629
`${prefix}/pnetcdf_examples` along with run script files. An example is
2730
`${prefix}/pnetcdf_examples/C/run_c_examples.sh`. The default of this
@@ -53,10 +56,16 @@ This is essentially a placeholder for the next release note ...
5356
+ none
5457
5558
* API syntax changes
56-
+ none
59+
+ File open flag NC_SHARE is now deprecated. It is still defined, but takes
60+
no effect.
5761
5862
* API semantics updates
59-
+ none
63+
+ NC_SHARE alone is not sufficient to provide data consistency for accessing
64+
a shared file in parallel and thus is now deprecated. Because PnetCDF
65+
follows the MPI file consistency, which only addresses the case when all
66+
file accesses are relative to a specific file handle created from a
67+
collective open, NC_SHARE becomes invalid. See doc/README.consistency.md
68+
for more information.
6069
6170
* New error code precedence
6271
+ none

0 commit comments

Comments
 (0)