Skip to content

Commit f572ef6

Browse files
authored
Merge pull request #119 from Parallel-NetCDF/nc_share
deprecate NC_SHARE and configure option --disable-file-sync
2 parents 1df5014 + 586a905 commit f572ef6

File tree

16 files changed

+67
-175
lines changed

16 files changed

+67
-175
lines changed

INSTALL

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ Here lists a few important options:
147147
size when argument count is zero. [default: enabled]
148148
--enable-doxygen Enable generation of documentation. [default:
149149
disabled]
150-
--disable-file-sync Disable MPI file sync if you know your file system
151-
can provide data consistency. [default: enabled]
152150
--enable-large-file-test
153151
Enable testing for large (>4GB) file/variable I/O.
154152
Note "make check" can run very slow. [default:

configure.ac

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ AH_TEMPLATE([NF_INT8_IS_C_], [C type for Fortran INT8])
130130
AH_TEMPLATE([NF_INT8_T], [Type for Fortran INT8])
131131
AH_TEMPLATE([NF_REAL_IS_C_], [C type for Fortran REAL])
132132
AH_TEMPLATE([NO_IEEE_FLOAT], [Does system have IEEE FLOAT])
133-
AH_TEMPLATE([DISABLE_FILE_SYNC], [Define if to disable MPI_File_sync])
134133
dnl AH_TEMPLATE([ENABLE_IN_PLACE_SWAP], [Define if to enable in-place byte swap])
135134
dnl AH_TEMPLATE([DISABLE_IN_PLACE_SWAP],[Define if to disable in-place byte swap])
136135
AH_TEMPLATE([ENABLE_SUBFILING], [Define if to enable subfiling feature])
@@ -2221,16 +2220,6 @@ AC_SUBST(LATEX)
22212220
AC_SUBST(DVIPDF)
22222221
AM_CONDITIONAL([HAS_LATEX], [test "x$has_latex" = xyes])
22232222

2224-
AC_ARG_ENABLE([file-sync],
2225-
[AS_HELP_STRING([--disable-file-sync],
2226-
[Disable MPI file sync if you know your file system can
2227-
provide data consistency. @<:@default: enabled@:>@])],
2228-
[file_sync=${enableval}], [file_sync=yes]
2229-
)
2230-
if test "x${file_sync}" = xno ; then
2231-
AC_DEFINE(DISABLE_FILE_SYNC)
2232-
fi
2233-
22342223
AC_ARG_ENABLE([large-single-req],
22352224
[AS_HELP_STRING([--enable-large-single-req],
22362225
[Enable large (> 2 GiB) single request in individual MPI-IO

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

src/dispatchers/file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,8 +1800,7 @@ ncmpi_set_default_format(int format, int *old_formatp)
18001800

18011801
/*----< ncmpi_inq_default_format() >-----------------------------------------*/
18021802
/* returns a value suitable for a create flag. Will return one or more of the
1803-
* following values OR-ed together:
1804-
* NC_64BIT_OFFSET, NC_CLOBBER, NC_LOCK, NC_SHARE */
1803+
* following values OR-ed together: NC_64BIT_OFFSET, NC_CLOBBER */
18051804
int
18061805
ncmpi_inq_default_format(int *formatp)
18071806
{

src/drivers/ncmpio/ncmpio_NC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ struct NC {
416416
#define NC_ndirty(ncp) fIsSet((ncp)->flags, NC_NDIRTY)
417417
#define set_NC_hdirty(ncp) fSet((ncp)->flags, NC_HDIRTY)
418418
#define NC_hdirty(ncp) fIsSet((ncp)->flags, NC_HDIRTY)
419-
#define NC_doFsync(ncp) fIsSet((ncp)->iomode, NC_SHARE)
419+
420420
#define NC_doHsync(ncp) fIsSet((ncp)->flags, NC_HSYNC)
421421
#define NC_doNsync(ncp) fIsSet((ncp)->flags, NC_NSYNC)
422422

src/drivers/ncmpio/ncmpio_close.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,6 @@ ncmpio_close(void *ncdp)
157157
}
158158
#endif
159159

160-
/* If the user wants a stronger data consistency by setting NC_SHARE */
161-
if (NC_doFsync(ncp)) {
162-
err = ncmpio_file_sync(ncp); /* calling MPI_File_sync() */
163-
if (status == NC_NOERR) status = err;
164-
}
165-
166160
/* calling MPI_File_close() */
167161
err = ncmpio_close_files(ncp, 0);
168162
if (status == NC_NOERR) status = err;

src/drivers/ncmpio/ncmpio_enddef.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,10 +1164,6 @@ ncmpio__enddef(void *ncdp,
11641164
fClr(ncp->ncp_sf->flags, NC_MODE_CREATE | NC_MODE_DEF);
11651165
#endif
11661166

1167-
/* If the user sets NC_SHARE, we enforce a stronger data consistency */
1168-
if (NC_doFsync(ncp))
1169-
ncmpio_file_sync(ncp); /* calling MPI_File_sync() */
1170-
11711167
return status;
11721168
}
11731169

0 commit comments

Comments
 (0)