Skip to content

Commit de4c487

Browse files
authored
Merge pull request #1657 from NOAA-GSD/ejh_fix_master
Fix largefile issue, szip parallel test, and some documentation updates
2 parents 8a799c7 + 09623c4 commit de4c487

File tree

6 files changed

+63
-67
lines changed

6 files changed

+63
-67
lines changed

RELEASE_NOTES.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release
77

88
## 4.7.4 - TBD
99

10+
* [Bug Fix] Attempts to set chunking on scalar vars will now return NC_EINVAL. Scalar vars cannot be chunked. Previously the library ignored these attempts and scalar vars were always stored as contiguous. See [https://github.com/Unidata/netcdf-c/issues/1644].
1011
* [Enhancement] Support has been added for multiple filters per variable. See [https://github.com/Unidata/netcdf-c/issues/1584].
1112
* [Enhancement] Now nc_inq_var_szip retuns 0 for parameter values if szip is not in use for var. See [https://github.com/Unidata/netcdf-c/issues/1618].
1213
* [Enhancement] Now allow parallel I/O with filters, for HDF5-1.10.3 and later. See [https://github.com/Unidata/netcdf-c/issues/1473].

h5_test/tst_h_files.c

-7
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ main()
246246
char file_name[STR_LEN + 1];
247247
char dimscale_wo_var[STR_LEN];
248248
void *bufr;
249-
hsize_t num_obj;
250249
void *fillp = NULL;
251250

252251
sprintf(file_name, "%s/%s", TEMP_LARGE, FILE_NAME);
@@ -361,12 +360,6 @@ main()
361360
if (H5Gclose(grpid) < 0) ERR;
362361
if (H5Fclose(fileid) < 0) ERR;
363362

364-
/* Reopen the file and check it. */
365-
if ((fileid = H5Fopen(file_name, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR;
366-
if (H5Gget_num_objs(fileid, &num_obj) < 0) ERR;
367-
if (num_obj) ERR;
368-
if (H5Fclose(fileid) < 0) ERR;
369-
370363
/* Delete the huge data file we created. */
371364
(void) remove(file_name);
372365
}

libdispatch/dparallel.c

+45-38
Original file line numberDiff line numberDiff line change
@@ -289,50 +289,58 @@ nc_open_par_fortran(const char *path, int omode, int comm,
289289
#endif
290290
}
291291

292-
/**\ingroup datasets
292+
/**
293+
@ingroup datasets
293294
294-
This function will change the parallel access of a variable from independent to
295-
collective and vice versa. Note when file is opened/created to use PnetCDF
296-
library to perform parallel I/O underneath, argument varid is ignored and the
297-
mode changed by this function applies to all variables. This is because PnetCDF
298-
does not support access mode change for individual variables. In this case,
299-
users may use NC_GLOBAL in varid argument for better program readability. This
300-
function is collective, i.e. must be called by all MPI processes defined in the
301-
MPI communicator used in nc_create_par() or nc_open_par(). In addition, values
302-
of arguments of this function must be the same among all MPI processes.
295+
This function will change the parallel access of a variable from
296+
independent to collective and vice versa.
303297
304-
To obtain a good I/O performance, users are recommended to use collective mode.
305-
In addition, switching between collective and independent I/O mode can be
306-
expensive.
298+
This function is collective, i.e. must be called by all MPI
299+
processes defined in the MPI communicator used in nc_create_par()
300+
or nc_open_par(). In addition, values of arguments of this function
301+
must be the same among all MPI processes.
307302
308-
In netcdf-c-4.7.4 or later, using hdf5-1.10.2 or later, the zlib and
309-
fletcher32 filters may be used when writing data with parallel
310-
I/O. The use of these filters require collective access. Turning on
311-
the zlib (deflate) or fletcher32 filter for a variable will
312-
automatically set its access to collective. Attempts to set access to
313-
independent will return ::NC_EINVAL.
303+
To obtain a good I/O performance, users are recommended to use
304+
collective mode. In addition, switching between collective and
305+
independent I/O mode can be expensive.
314306
315-
\param ncid NetCDF or group ID, from a previous call to nc_open_par(),
316-
nc_create_par(), nc_def_grp(), or associated inquiry functions such as
317-
nc_inq_ncid().
307+
In netcdf-c-4.7.4 or later, using hdf5-1.10.2 or later, the zlib,
308+
szip, fletcher32, and other filters may be used when writing data
309+
with parallel I/O. The use of these filters require collective
310+
access. Turning on the zlib (deflate) or fletcher32 filter for a
311+
variable will automatically set its access to collective if the
312+
file has been opened for parallel I/O. Attempts to set access to
313+
independent will return ::NC_EINVAL.
318314
319-
\param varid Variable ID
315+
@note When the library is build with --enable-pnetcdf, and when
316+
file is opened/created to use PnetCDF library to perform parallel
317+
I/O underneath, argument varid is ignored and the mode changed by
318+
this function applies to all variables. This is because PnetCDF
319+
does not support access mode change for individual variables. In
320+
this case, users may use NC_GLOBAL in varid argument for better
321+
program readability.
320322
321-
\param par_access NC_COLLECTIVE or NC_INDEPENDENT.
323+
@param ncid NetCDF or group ID, from a previous call to
324+
nc_open_par(), nc_create_par(), nc_def_grp(), or associated inquiry
325+
functions such as nc_inq_ncid().
322326
323-
\returns ::NC_NOERR No error.
324-
\returns ::NC_EBADID Invalid ncid passed.
325-
\returns ::NC_ENOTVAR Invalid varid passed.
326-
\returns ::NC_ENOPAR File was not opened with nc_open_par/nc_create_var.
327-
\returns ::NC_EINVAL Invalid par_access specified, or attempt to set
328-
filtered variable to independent access.
327+
@param varid Variable ID
329328
330-
<h1>Example</h1>
329+
@param par_access NC_COLLECTIVE or NC_INDEPENDENT.
331330
332-
Here is an example from examples/C/parallel_vara.c which changes the
333-
parallel access of a variable and then writes to it.
331+
@return ::NC_NOERR No error.
332+
@return ::NC_EBADID Invalid ncid passed.
333+
@return ::NC_ENOTVAR Invalid varid passed.
334+
@return ::NC_ENOPAR File was not opened with nc_open_par/nc_create_var.
335+
@return ::NC_EINVAL Invalid par_access specified, or attempt to set
336+
filtered variable to independent access.
334337
335-
\code
338+
<h1>Example</h1>
339+
340+
Here is an example from examples/C/parallel_vara.c which changes
341+
the parallel access of a variable and then writes to it.
342+
343+
@code
336344
#define NY 10
337345
#define NX 4
338346
@@ -366,10 +374,9 @@ parallel access of a variable and then writes to it.
366374
367375
err = nc_put_vara_int(ncid, varid, start, count, &buf[0][0]); ERR
368376
369-
\endcode
370-
\author Ed Hartnett, Dennis Heimbigner
371-
\ingroup datasets
372-
*/
377+
@endcode
378+
@author Ed Hartnett, Dennis Heimbigner
379+
*/
373380
int
374381
nc_var_par_access(int ncid, int varid, int par_access)
375382
{

libdispatch/dvar.c

+15-20
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,8 @@ nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
470470
}
471471

472472
/**
473-
Define chunking parameters for a variable
474-
475-
The function nc_def_var_chunking sets the storage and, optionally,
476-
the chunking parameters for a variable in a netCDF-4 file.
473+
Define storage and, if chunked storage is used, chunking parameters
474+
for a variable
477475
478476
The storage may be set to NC_CONTIGUOUS, NC_COMPACT, or NC_CHUNKED.
479477
@@ -490,7 +488,7 @@ nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
490488
Chunked storage means the data are stored as chunks, of
491489
user-configurable size. Chunked storage is required for variable
492490
with one or more unlimted dimensions, or variable which use
493-
compression.
491+
compression, or any other filter.
494492
495493
The total size of a chunk must be less than 4 GiB. That is, the
496494
product of all chunksizes and the size of the data (or the size of
@@ -500,16 +498,14 @@ nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
500498
before nc_enddef is called. Once the chunking parameters are set for a
501499
variable, they cannot be changed.
502500
503-
Note scalar variables may have a storage of NC_CONTIGUOUS or
504-
NC_COMPACT. Attempts to set chunking on a scalare variable will be
505-
ignored by the library (but no error code is returned). Only
506-
non-scalar variables can have chunking.
501+
@note Scalar variables may have a storage of NC_CONTIGUOUS or
502+
NC_COMPACT. Attempts to set chunking on a scalare variable will
503+
cause ::NC_EINVEL to be returned. Only non-scalar variables can
504+
have chunking.
507505
508506
@param ncid NetCDF ID, from a previous call to nc_open() or
509507
nc_create().
510-
511508
@param varid Variable ID.
512-
513509
@param storage If ::NC_CONTIGUOUS or ::NC_COMPACT, then contiguous
514510
or compact storage is used for this variable. Variables with one or
515511
more unlimited dimensions cannot use contiguous or compact
@@ -518,20 +514,19 @@ nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
518514
storage is used for this variable. Chunk sizes may be specified
519515
with the chunksizes parameter or default sizes will be used if that
520516
parameter is NULL.
521-
522517
@param chunksizesp A pointer to an array list of chunk sizes. The
523518
array must have one chunksize for each dimension of the variable. If
524519
::NC_CONTIGUOUS storage is set, then the chunksizes parameter is
525-
ignored.
520+
ignored. Ignored if NULL.
526521
527522
@return ::NC_NOERR No error.
528523
@return ::NC_EBADID Bad ID.
529524
@return ::NC_ENOTNC4 Not a netCDF-4 file.
530-
@return ::NC_ELATEDEF This variable has already been the subject of a
531-
nc_enddef call. In netCDF-4 files nc_enddef will be called
525+
@return ::NC_ELATEDEF This variable has already been the subject of
526+
a nc_enddef call. In netCDF-4 files nc_enddef will be called
532527
automatically for any data read or write. Once nc_enddef has been
533-
called after the nc_def_var call for a variable, it is impossible to
534-
set the chunking for that variable.
528+
called after the nc_def_var call for a variable, it is impossible
529+
to set the chunking for that variable.
535530
@return ::NC_ENOTINDEFINE Not in define mode. This is returned for
536531
netCDF classic or 64-bit offset files, or for netCDF-4 files, when
537532
they wwere created with ::NC_CLASSIC_MODEL flag by nc_create().
@@ -542,7 +537,8 @@ nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
542537
@return ::NC_EVARSIZE Compact storage attempted for variable bigger
543538
than 64 KB.
544539
@return ::NC_EINVAL Attempt to set contiguous or compact storage
545-
for var with one or more unlimited dimensions.
540+
for var with one or more unlimited dimensions, or chunking for a
541+
scalar var.
546542
547543
@section nc_def_var_chunking_example Example
548544
@@ -585,8 +581,7 @@ nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
585581
@author Ed Hartnett, Dennis Heimbigner
586582
*/
587583
int
588-
nc_def_var_chunking(int ncid, int varid, int storage,
589-
const size_t *chunksizesp)
584+
nc_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp)
590585
{
591586
NC* ncp;
592587
int stat = NC_check_id(ncid, &ncp);

nc_test4/tst_parallel5.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ main(int argc, char **argv)
336336
&ncid)) ERR;
337337
if (nc_def_dim(ncid, SZIP_DIM_NAME, SZIP_DIM_LEN, &dimid)) ERR;
338338
if (nc_def_var(ncid, SZIP_VAR_NAME, NC_FLOAT, NDIMS1, &dimid, &varid)) ERR;
339-
if (nc_def_var_szip(ncid, varid, NC_SZIP_NN, SZIP_PIXELS_PER_BLOCK)) ERR;
339+
if (nc_def_var_szip(ncid, varid, H5_SZIP_NN_OPTION_MASK,
340+
SZIP_PIXELS_PER_BLOCK)) ERR;
340341
if (nc_enddef(ncid)) ERR;
341342
start[0] = mpi_rank * elements_per_pe;
342343
count[0] = elements_per_pe;

unit_test/tst_nclist.c

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ main(int argc, char **argv)
112112
{
113113
NC *ncp;
114114
int mode = 0;
115-
NCmodel model;
116115
int max_num_nc = 65535;
117116
int i;
118117
int ret;

0 commit comments

Comments
 (0)