2019-03-17 22:03:27 +08:00
|
|
|
# This is part of the netCDF package. Copyright 2005-2019 University
|
2018-08-25 02:48:42 +08:00
|
|
|
# Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
|
|
|
|
# conditions of use.
|
|
|
|
#
|
|
|
|
# This directory holds tests for netCDF-4. It is skipped if netCDF-4
|
|
|
|
# is not enabled.
|
2015-05-13 03:00:22 +08:00
|
|
|
#
|
2017-12-07 06:07:54 +08:00
|
|
|
# Ed Hartnett, Ward Fisher
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2011-03-15 18:19:08 +08:00
|
|
|
# Put together AM_CPPFLAGS and AM_LDFLAGS.
|
|
|
|
include $(top_srcdir)/lib_flags.am
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2018-01-17 02:00:09 +08:00
|
|
|
# Un comment to use a more verbose test driver
|
2019-04-20 10:32:26 +08:00
|
|
|
#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
|
2019-11-04 03:03:13 +08:00
|
|
|
#sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
|
2019-04-20 10:32:26 +08:00
|
|
|
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
|
2019-11-04 03:03:13 +08:00
|
|
|
#TESTS_ENVIRONMENT = export SETX=1;
|
2018-01-17 02:00:09 +08:00
|
|
|
|
2019-01-02 20:31:15 +08:00
|
|
|
TEST_EXTENSIONS = .sh
|
2018-08-23 20:32:04 +08:00
|
|
|
|
2011-03-15 18:19:08 +08:00
|
|
|
# Link to our assembled library.
|
2018-08-07 00:57:19 +08:00
|
|
|
LDADD = ${top_builddir}/liblib/libnetcdf.la
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2017-11-25 01:50:07 +08:00
|
|
|
# These are netCDF-4 C test programs which are built and run.
|
2019-01-02 20:31:15 +08:00
|
|
|
NC4_TESTS = tst_dims tst_dims2 tst_dims3 tst_files tst_files4 \
|
2017-10-26 18:49:57 +08:00
|
|
|
tst_vars tst_varms tst_unlim_vars tst_converts tst_converts2 tst_grps \
|
|
|
|
tst_grps2 tst_compounds tst_compounds2 tst_compounds3 tst_opaques \
|
|
|
|
tst_strings tst_strings2 tst_interops tst_interops4 tst_interops5 \
|
2019-11-14 03:51:34 +08:00
|
|
|
tst_interops6 tst_interops_dims tst_enums tst_coords tst_coords2 \
|
|
|
|
tst_coords3 tst_vars3 tst_vars4 tst_chunks tst_chunks2 tst_utf8 \
|
|
|
|
tst_fills tst_fills2 tst_fillbug tst_xplatform tst_xplatform2 \
|
|
|
|
tst_endian_fill tst_atts t_type cdm_sea_soundings tst_camrun tst_vl \
|
|
|
|
tst_atts1 tst_atts2 tst_vars2 tst_files5 tst_files6 tst_sync \
|
|
|
|
tst_h_scalar tst_rename tst_rename2 tst_rename3 tst_h5_endians \
|
|
|
|
tst_atts_string_rewrite tst_hdf5_file_compat tst_fill_attr_vanish \
|
|
|
|
tst_rehash tst_filterparser tst_bug324 tst_types tst_atts3 \
|
|
|
|
tst_put_vars tst_elatefill tst_udf tst_put_vars_two_unlim_dim \
|
2021-08-24 14:45:38 +08:00
|
|
|
tst_bug1442 tst_quantize
|
2010-06-22 21:25:14 +08:00
|
|
|
|
2022-01-30 06:27:52 +08:00
|
|
|
if HAS_PAR_FILTERS
|
|
|
|
NC4_TESTS += tst_alignment
|
|
|
|
endif
|
|
|
|
|
2019-03-12 23:23:49 +08:00
|
|
|
# Temporary I hoped, but hoped in vain.
|
2017-06-01 05:01:02 +08:00
|
|
|
if !ISCYGWIN
|
2017-04-04 11:39:44 +08:00
|
|
|
NC4_TESTS += tst_h_strbug tst_h_refs
|
|
|
|
endif
|
|
|
|
|
2017-11-25 01:50:07 +08:00
|
|
|
# Build test programs plus programs used in test scripts.
|
Fix various problem around VLEN's
re: https://github.com/Unidata/netcdf-c/issues/541
re: https://github.com/Unidata/netcdf-c/issues/1208
re: https://github.com/Unidata/netcdf-c/issues/2078
re: https://github.com/Unidata/netcdf-c/issues/2041
re: https://github.com/Unidata/netcdf-c/issues/2143
For a long time, there have been known problems with the
management of complex types containing VLENs. This also
involves the string type because it is stored as a VLEN of
chars.
This PR (mostly) fixes this problem. But note that it adds new
functions to netcdf.h (see below) and this may require bumping
the .so number. These new functions can be removed, if desired,
in favor of functions in netcdf_aux.h, but netcdf.h seems the
better place for them because they are intended as alternatives
to the nc_free_vlen and nc_free_string functions already in
netcdf.h.
The term complex type refers to any type that directly or
transitively references a VLEN type. So an array of VLENS, a
compound with a VLEN field, and so on.
In order to properly handle instances of these complex types, it
is necessary to have function that can recursively walk
instances of such types to perform various actions on them. The
term "deep" is also used to mean recursive.
At the moment, the two operations needed by the netcdf library are:
* free'ing an instance of the complex type
* copying an instance of the complex type.
The current library does only shallow free and shallow copy of
complex types. This means that only the top level is properly
free'd or copied, but deep internal blocks in the instance are
not touched.
Note that the term "vector" will be used to mean a contiguous (in
memory) sequence of instances of some type. Given an array with,
say, dimensions 2 X 3 X 4, this will be stored in memory as a
vector of length 2*3*4=24 instances.
The use cases are primarily these.
## nc_get_vars
Suppose one is reading a vector of instances using nc_get_vars
(or nc_get_vara or nc_get_var, etc.). These functions will
return the vector in the top-level memory provided. All
interior blocks (form nested VLEN or strings) will have been
dynamically allocated.
After using this vector of instances, it is necessary to free
(aka reclaim) the dynamically allocated memory, otherwise a
memory leak occurs. So, the recursive reclaim function is used
to walk the returned instance vector and do a deep reclaim of
the data.
Currently functions are defined in netcdf.h that are supposed to
handle this: nc_free_vlen(), nc_free_vlens(), and
nc_free_string(). Unfortunately, these functions only do a
shallow free, so deeply nested instances are not properly
handled by them.
Note that internally, the provided data is immediately written so
there is no need to copy it. But the caller may need to reclaim the
data it passed into the function.
## nc_put_att
Suppose one is writing a vector of instances as the data of an attribute
using, say, nc_put_att.
Internally, the incoming attribute data must be copied and stored
so that changes/reclamation of the input data will not affect
the attribute.
Again, the code inside the netcdf library does only shallow copying
rather than deep copy. As a result, one sees effects such as described
in Github Issue https://github.com/Unidata/netcdf-c/issues/2143.
Also, after defining the attribute, it may be necessary for the user
to free the data that was provided as input to nc_put_att().
## nc_get_att
Suppose one is reading a vector of instances as the data of an attribute
using, say, nc_get_att.
Internally, the existing attribute data must be copied and returned
to the caller, and the caller is responsible for reclaiming
the returned data.
Again, the code inside the netcdf library does only shallow copying
rather than deep copy. So this can lead to memory leaks and errors
because the deep data is shared between the library and the user.
# Solution
The solution is to build properly recursive reclaim and copy
functions and use those as needed.
These recursive functions are defined in libdispatch/dinstance.c
and their signatures are defined in include/netcdf.h.
For back compatibility, corresponding "ncaux_XXX" functions
are defined in include/netcdf_aux.h.
````
int nc_reclaim_data(int ncid, nc_type xtypeid, void* memory, size_t count);
int nc_reclaim_data_all(int ncid, nc_type xtypeid, void* memory, size_t count);
int nc_copy_data(int ncid, nc_type xtypeid, const void* memory, size_t count, void* copy);
int nc_copy_data_all(int ncid, nc_type xtypeid, const void* memory, size_t count, void** copyp);
````
There are two variants. The first two, nc_reclaim_data() and
nc_copy_data(), assume the top-level vector is managed by the
caller. For reclaim, this is so the user can use, for example, a
statically allocated vector. For copy, it assumes the user
provides the space into which the copy is stored.
The second two, nc_reclaim_data_all() and
nc_copy_data_all(), allows the functions to manage the
top-level. So for nc_reclaim_data_all, the top level is
assumed to be dynamically allocated and will be free'd by
nc_reclaim_data_all(). The nc_copy_data_all() function
will allocate the top level and return a pointer to it to the
user. The user can later pass that pointer to
nc_reclaim_data_all() to reclaim the instance(s).
# Internal Changes
The netcdf-c library internals are changed to use the proper
reclaim and copy functions. It turns out that the places where
these functions are needed is quite pervasive in the netcdf-c
library code. Using these functions also allows some
simplification of the code since the stdata and vldata fields of
NC_ATT_INFO are no longer needed. Currently this is commented
out using the SEPDATA \#define macro. When any bugs are largely
fixed, all this code will be removed.
# Known Bugs
1. There is still one known failure that has not been solved.
All the failures revolve around some variant of this .cdl file.
The proximate cause of failure is the use of a VLEN FillValue.
````
netcdf x {
types:
float(*) row_of_floats ;
dimensions:
m = 5 ;
variables:
row_of_floats ragged_array(m) ;
row_of_floats ragged_array:_FillValue = {-999} ;
data:
ragged_array = {10, 11, 12, 13, 14}, {20, 21, 22, 23}, {30, 31, 32},
{40, 41}, _ ;
}
````
When a solution is found, I will either add it to this PR or post a new PR.
# Related Changes
* Mark nc_free_vlen(s) as deprecated in favor of ncaux_reclaim_data.
* Remove the --enable-unfixed-memory-leaks option.
* Remove the NC_VLENS_NOTEST code that suppresses some vlen tests.
* Document this change in docs/internal.md
* Disable the tst_vlen_data test in ncdump/tst_nccopy4.sh.
* Mark types as fixed size or not (transitively) to optimize the reclaim
and copy functions.
# Misc. Changes
* Make Doxygen process libdispatch/daux.c
* Make sure the NC_ATT_INFO_T.container field is set.
2022-01-09 09:30:00 +08:00
|
|
|
check_PROGRAMS = $(NC4_TESTS) tst_empty_vlen_unlim tst_charvlenbug tst_vlenstr
|
2019-01-02 21:21:11 +08:00
|
|
|
TESTS = $(NC4_TESTS) run_empty_vlen_test.sh
|
2010-06-15 23:24:28 +08:00
|
|
|
|
2011-03-15 18:19:08 +08:00
|
|
|
# Add these if large file tests are turned on.
|
|
|
|
if LARGE_FILE_TESTS
|
|
|
|
check_PROGRAMS += tst_large tst_large2
|
2017-11-25 01:50:07 +08:00
|
|
|
TESTS += tst_large tst_large2
|
2011-03-15 18:19:08 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
# If the v2 API was built, add its test program.
|
2010-06-22 21:25:14 +08:00
|
|
|
if BUILD_V2
|
2015-05-13 03:00:22 +08:00
|
|
|
check_PROGRAMS += tst_v2
|
2010-06-22 21:25:14 +08:00
|
|
|
TESTS += tst_v2
|
|
|
|
endif # BUILD_V2
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2019-03-19 01:09:44 +08:00
|
|
|
# The rest of the tests require ncgen/ncdump.
|
|
|
|
if BUILD_UTILITIES
|
|
|
|
check_PROGRAMS += renamegroup
|
|
|
|
TESTS += run_grp_rename.sh tst_misc.sh
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2020-09-13 04:49:59 +08:00
|
|
|
check_PROGRAMS += tst_fillonly
|
|
|
|
TESTS += test_fillonly.sh
|
|
|
|
|
2017-09-05 08:37:13 +08:00
|
|
|
# Szip Tests (requires ncdump)
|
Enhance/Fix filter support
re: Discussion https://github.com/Unidata/netcdf-c/discussions/2214
The primary change is to support so-called "standard filters".
A standard filter is one that is defined by the following
netcdf-c API:
````
int nc_def_var_XXX(int ncid, int varid, size_t nparams, unsigned* params);
int nc_inq_var_XXXX(int ncid, int varid, int* usefilterp, unsigned* params);
````
So for example, zstandard would be a standard filter by defining
the functions *nc_def_var_zstandard* and *nc_inq_var_zstandard*.
In order to define these functions, we need a new dispatch function:
````
int nc_inq_filter_avail(int ncid, unsigned filterid);
````
This function, combined with the existing filter API can be used
to implement arbitrary standard filters using a simple code pattern.
Note that I would have preferred that this function return a list
of all available filters, but HDF5 does not support that functionality.
So this PR implements the dispatch function and implements
the following standard functions:
+ bzip2
+ zstandard
+ blosc
Specific test cases are also provided for HDF5 and NCZarr.
Over time, other specific standard filters will be defined.
## Primary Changes
* Add nc_inq_filter_avail() to netcdf-c API.
* Add standard filter implementations to test use of *nc_inq_filter_avail*.
* Bump the dispatch table version number and add to all the relevant
dispatch tables (libsrc, libsrcp, etc).
* Create a program to invoke nc_inq_filter_avail so that it is accessible
to shell scripts.
* Cleanup szip support to properly support szip
when HDF5 is disabled. This involves detecting
libsz separately from testing if HDF5 supports szip.
* Integrate shuffle and fletcher32 into the existing
filter API. This means that, for example, nc_def_var_fletcher32
is now a wrapper around nc_def_var_filter.
* Extend the Codec defaulting to allow multiple default shared libraries.
## Misc. Changes
* Modify configure.ac/CMakeLists.txt to look for the relevant
libraries implementing standard filters.
* Modify libnetcdf.settings to list available standard filters
(including deflate and szip).
* Add CMake test modules to locate libbz2 and libzstd.
* Cleanup the HDF5 memory manager function use in the plugins.
* remove unused file include//ncfilter.h
* remove tests for the HDF5 memory operations e.g. H5allocate_memory.
* Add flag to ncdump to force use of _Filter instead of _Deflate
or _Shuffle or _Fletcher32. Used for testing.
2022-03-15 02:39:37 +08:00
|
|
|
if HAVE_H5Z_SZIP
|
2017-08-29 08:11:24 +08:00
|
|
|
check_PROGRAMS += test_szip h5testszip
|
2017-08-29 04:56:01 +08:00
|
|
|
TESTS += tst_szip.sh
|
2017-08-28 10:38:37 +08:00
|
|
|
endif
|
|
|
|
|
Enhance/Fix filter support
re: Discussion https://github.com/Unidata/netcdf-c/discussions/2214
The primary change is to support so-called "standard filters".
A standard filter is one that is defined by the following
netcdf-c API:
````
int nc_def_var_XXX(int ncid, int varid, size_t nparams, unsigned* params);
int nc_inq_var_XXXX(int ncid, int varid, int* usefilterp, unsigned* params);
````
So for example, zstandard would be a standard filter by defining
the functions *nc_def_var_zstandard* and *nc_inq_var_zstandard*.
In order to define these functions, we need a new dispatch function:
````
int nc_inq_filter_avail(int ncid, unsigned filterid);
````
This function, combined with the existing filter API can be used
to implement arbitrary standard filters using a simple code pattern.
Note that I would have preferred that this function return a list
of all available filters, but HDF5 does not support that functionality.
So this PR implements the dispatch function and implements
the following standard functions:
+ bzip2
+ zstandard
+ blosc
Specific test cases are also provided for HDF5 and NCZarr.
Over time, other specific standard filters will be defined.
## Primary Changes
* Add nc_inq_filter_avail() to netcdf-c API.
* Add standard filter implementations to test use of *nc_inq_filter_avail*.
* Bump the dispatch table version number and add to all the relevant
dispatch tables (libsrc, libsrcp, etc).
* Create a program to invoke nc_inq_filter_avail so that it is accessible
to shell scripts.
* Cleanup szip support to properly support szip
when HDF5 is disabled. This involves detecting
libsz separately from testing if HDF5 supports szip.
* Integrate shuffle and fletcher32 into the existing
filter API. This means that, for example, nc_def_var_fletcher32
is now a wrapper around nc_def_var_filter.
* Extend the Codec defaulting to allow multiple default shared libraries.
## Misc. Changes
* Modify configure.ac/CMakeLists.txt to look for the relevant
libraries implementing standard filters.
* Modify libnetcdf.settings to list available standard filters
(including deflate and szip).
* Add CMake test modules to locate libbz2 and libzstd.
* Cleanup the HDF5 memory manager function use in the plugins.
* remove unused file include//ncfilter.h
* remove tests for the HDF5 memory operations e.g. H5allocate_memory.
* Add flag to ncdump to force use of _Filter instead of _Deflate
or _Shuffle or _Fletcher32. Used for testing.
2022-03-15 02:39:37 +08:00
|
|
|
# Filter Tests (requires ncdump and ncgen and HDF5)
|
|
|
|
if USE_HDF5
|
2018-01-17 02:00:09 +08:00
|
|
|
if ENABLE_FILTER_TESTING
|
2019-01-02 20:31:15 +08:00
|
|
|
extradir =
|
2022-02-20 07:47:31 +08:00
|
|
|
check_PROGRAMS += test_filter test_filter_misc test_filter_order test_filter_repeat test_filter_vlen
|
Enhance/Fix filter support
re: Discussion https://github.com/Unidata/netcdf-c/discussions/2214
The primary change is to support so-called "standard filters".
A standard filter is one that is defined by the following
netcdf-c API:
````
int nc_def_var_XXX(int ncid, int varid, size_t nparams, unsigned* params);
int nc_inq_var_XXXX(int ncid, int varid, int* usefilterp, unsigned* params);
````
So for example, zstandard would be a standard filter by defining
the functions *nc_def_var_zstandard* and *nc_inq_var_zstandard*.
In order to define these functions, we need a new dispatch function:
````
int nc_inq_filter_avail(int ncid, unsigned filterid);
````
This function, combined with the existing filter API can be used
to implement arbitrary standard filters using a simple code pattern.
Note that I would have preferred that this function return a list
of all available filters, but HDF5 does not support that functionality.
So this PR implements the dispatch function and implements
the following standard functions:
+ bzip2
+ zstandard
+ blosc
Specific test cases are also provided for HDF5 and NCZarr.
Over time, other specific standard filters will be defined.
## Primary Changes
* Add nc_inq_filter_avail() to netcdf-c API.
* Add standard filter implementations to test use of *nc_inq_filter_avail*.
* Bump the dispatch table version number and add to all the relevant
dispatch tables (libsrc, libsrcp, etc).
* Create a program to invoke nc_inq_filter_avail so that it is accessible
to shell scripts.
* Cleanup szip support to properly support szip
when HDF5 is disabled. This involves detecting
libsz separately from testing if HDF5 supports szip.
* Integrate shuffle and fletcher32 into the existing
filter API. This means that, for example, nc_def_var_fletcher32
is now a wrapper around nc_def_var_filter.
* Extend the Codec defaulting to allow multiple default shared libraries.
## Misc. Changes
* Modify configure.ac/CMakeLists.txt to look for the relevant
libraries implementing standard filters.
* Modify libnetcdf.settings to list available standard filters
(including deflate and szip).
* Add CMake test modules to locate libbz2 and libzstd.
* Cleanup the HDF5 memory manager function use in the plugins.
* remove unused file include//ncfilter.h
* remove tests for the HDF5 memory operations e.g. H5allocate_memory.
* Add flag to ncdump to force use of _Filter instead of _Deflate
or _Shuffle or _Fletcher32. Used for testing.
2022-03-15 02:39:37 +08:00
|
|
|
check_PROGRAMS += tst_multifilter tst_filter_avail
|
2020-05-11 23:42:31 +08:00
|
|
|
TESTS += tst_filter.sh
|
2021-09-03 07:04:26 +08:00
|
|
|
TESTS += tst_specific_filters.sh
|
|
|
|
endif
|
Enhance/Fix filter support
re: Discussion https://github.com/Unidata/netcdf-c/discussions/2214
The primary change is to support so-called "standard filters".
A standard filter is one that is defined by the following
netcdf-c API:
````
int nc_def_var_XXX(int ncid, int varid, size_t nparams, unsigned* params);
int nc_inq_var_XXXX(int ncid, int varid, int* usefilterp, unsigned* params);
````
So for example, zstandard would be a standard filter by defining
the functions *nc_def_var_zstandard* and *nc_inq_var_zstandard*.
In order to define these functions, we need a new dispatch function:
````
int nc_inq_filter_avail(int ncid, unsigned filterid);
````
This function, combined with the existing filter API can be used
to implement arbitrary standard filters using a simple code pattern.
Note that I would have preferred that this function return a list
of all available filters, but HDF5 does not support that functionality.
So this PR implements the dispatch function and implements
the following standard functions:
+ bzip2
+ zstandard
+ blosc
Specific test cases are also provided for HDF5 and NCZarr.
Over time, other specific standard filters will be defined.
## Primary Changes
* Add nc_inq_filter_avail() to netcdf-c API.
* Add standard filter implementations to test use of *nc_inq_filter_avail*.
* Bump the dispatch table version number and add to all the relevant
dispatch tables (libsrc, libsrcp, etc).
* Create a program to invoke nc_inq_filter_avail so that it is accessible
to shell scripts.
* Cleanup szip support to properly support szip
when HDF5 is disabled. This involves detecting
libsz separately from testing if HDF5 supports szip.
* Integrate shuffle and fletcher32 into the existing
filter API. This means that, for example, nc_def_var_fletcher32
is now a wrapper around nc_def_var_filter.
* Extend the Codec defaulting to allow multiple default shared libraries.
## Misc. Changes
* Modify configure.ac/CMakeLists.txt to look for the relevant
libraries implementing standard filters.
* Modify libnetcdf.settings to list available standard filters
(including deflate and szip).
* Add CMake test modules to locate libbz2 and libzstd.
* Cleanup the HDF5 memory manager function use in the plugins.
* remove unused file include//ncfilter.h
* remove tests for the HDF5 memory operations e.g. H5allocate_memory.
* Add flag to ncdump to force use of _Filter instead of _Deflate
or _Shuffle or _Fletcher32. Used for testing.
2022-03-15 02:39:37 +08:00
|
|
|
endif # USE_HDF5
|
2019-03-19 01:09:44 +08:00
|
|
|
endif # BUILD_UTILITIES
|
2018-01-17 02:00:09 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
# This are extra tests that will only be run if netcdf-4 is configured
|
|
|
|
# with --enable-parallel-tests.
|
2015-08-16 06:26:35 +08:00
|
|
|
if TEST_PARALLEL4
|
2018-05-14 22:11:32 +08:00
|
|
|
check_PROGRAMS += tst_mpi_parallel tst_parallel tst_parallel3 \
|
2018-08-18 19:22:07 +08:00
|
|
|
tst_parallel4 tst_parallel5 tst_nc4perf tst_mode tst_simplerw_coll_r \
|
2022-04-12 20:56:23 +08:00
|
|
|
tst_mode tst_parallel_zlib tst_parallel_compress tst_quantize_par \
|
|
|
|
tst_parallel6
|
2010-06-03 21:24:43 +08:00
|
|
|
TESTS += run_par_test.sh
|
2020-02-06 08:40:31 +08:00
|
|
|
endif # TEST_PARALLEL4
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2019-03-19 00:15:18 +08:00
|
|
|
EXTRA_DIST = run_par_test.sh.in ref_tst_compounds.nc \
|
|
|
|
ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc \
|
|
|
|
ref_tst_interops4.nc CMakeLists.txt run_grp_rename.sh \
|
2018-08-25 02:48:42 +08:00
|
|
|
run_empty_vlen_test.sh ref_hdf5_compat1.nc ref_hdf5_compat2.nc \
|
|
|
|
ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_szip.sh ref_szip.h5 \
|
Enhance/Fix filter support
re: Discussion https://github.com/Unidata/netcdf-c/discussions/2214
The primary change is to support so-called "standard filters".
A standard filter is one that is defined by the following
netcdf-c API:
````
int nc_def_var_XXX(int ncid, int varid, size_t nparams, unsigned* params);
int nc_inq_var_XXXX(int ncid, int varid, int* usefilterp, unsigned* params);
````
So for example, zstandard would be a standard filter by defining
the functions *nc_def_var_zstandard* and *nc_inq_var_zstandard*.
In order to define these functions, we need a new dispatch function:
````
int nc_inq_filter_avail(int ncid, unsigned filterid);
````
This function, combined with the existing filter API can be used
to implement arbitrary standard filters using a simple code pattern.
Note that I would have preferred that this function return a list
of all available filters, but HDF5 does not support that functionality.
So this PR implements the dispatch function and implements
the following standard functions:
+ bzip2
+ zstandard
+ blosc
Specific test cases are also provided for HDF5 and NCZarr.
Over time, other specific standard filters will be defined.
## Primary Changes
* Add nc_inq_filter_avail() to netcdf-c API.
* Add standard filter implementations to test use of *nc_inq_filter_avail*.
* Bump the dispatch table version number and add to all the relevant
dispatch tables (libsrc, libsrcp, etc).
* Create a program to invoke nc_inq_filter_avail so that it is accessible
to shell scripts.
* Cleanup szip support to properly support szip
when HDF5 is disabled. This involves detecting
libsz separately from testing if HDF5 supports szip.
* Integrate shuffle and fletcher32 into the existing
filter API. This means that, for example, nc_def_var_fletcher32
is now a wrapper around nc_def_var_filter.
* Extend the Codec defaulting to allow multiple default shared libraries.
## Misc. Changes
* Modify configure.ac/CMakeLists.txt to look for the relevant
libraries implementing standard filters.
* Modify libnetcdf.settings to list available standard filters
(including deflate and szip).
* Add CMake test modules to locate libbz2 and libzstd.
* Cleanup the HDF5 memory manager function use in the plugins.
* remove unused file include//ncfilter.h
* remove tests for the HDF5 memory operations e.g. H5allocate_memory.
* Add flag to ncdump to force use of _Filter instead of _Deflate
or _Shuffle or _Fletcher32. Used for testing.
2022-03-15 02:39:37 +08:00
|
|
|
ref_szip.cdl tst_filter.sh bzip2.cdl noop.cdl ref_filtered.cdl \
|
2019-03-18 22:30:14 +08:00
|
|
|
ref_unfiltered.cdl ref_bzip2.c findplugin.in ref_unfilteredvv.cdl \
|
2020-05-11 23:42:31 +08:00
|
|
|
ref_filteredvv.cdl ref_multi.cdl \
|
|
|
|
ref_ncgenF.cdl ref_nccopyF.cdl \
|
2020-12-30 11:12:35 +08:00
|
|
|
ref_filter_repeat.txt ref_fillonly.cdl test_fillonly.sh \
|
2021-09-03 07:04:26 +08:00
|
|
|
ref_filter_order_create.txt ref_filter_order_read.txt \
|
Support installation of filters into user-specified location
re: https://github.com/Unidata/netcdf-c/issues/2294
Ed Hartnett suggested that the netcdf library installation process
be extended to install the standard filters into a user specified
location. The user can then set HDF5_PLUGIN_PATH to that location.
This PR provides that capability using:
````
configure option: --with-plugin-dir=<absolute directory path>
cmake option: -DPLUGIN_INSTALL_DIR=<absolute directory path>
````
Currently, the following plugins are always installed, if
available: bzip2, zstd, blosc.
If NCZarr is enabled, then additional plugins are installed:
fletcher32, shuffle, deflate, szip.
Additionally, the necessary codec support is installed
for each of the above filters that is installed.
## Changes:
1. Cleanup handling of built-in bzip2.
2. Add documentation to docs/filters.md
3. Re-factor the NCZarr codec libraries
4. Add a test, although it can only be exercised after
the library is installed, so it cannot be used during
normal testing.
5. Cleanup use of HDF5_PLUGIN_PATH in the filter test cases.
2022-04-30 04:31:55 +08:00
|
|
|
ref_any.cdl tst_specific_filters.sh \
|
2022-05-10 02:10:53 +08:00
|
|
|
tst_virtual_datasets.c noop1.cdl
|
2017-11-17 02:30:35 +08:00
|
|
|
|
Support installation of filters into user-specified location
re: https://github.com/Unidata/netcdf-c/issues/2294
Ed Hartnett suggested that the netcdf library installation process
be extended to install the standard filters into a user specified
location. The user can then set HDF5_PLUGIN_PATH to that location.
This PR provides that capability using:
````
configure option: --with-plugin-dir=<absolute directory path>
cmake option: -DPLUGIN_INSTALL_DIR=<absolute directory path>
````
Currently, the following plugins are always installed, if
available: bzip2, zstd, blosc.
If NCZarr is enabled, then additional plugins are installed:
fletcher32, shuffle, deflate, szip.
Additionally, the necessary codec support is installed
for each of the above filters that is installed.
## Changes:
1. Cleanup handling of built-in bzip2.
2. Add documentation to docs/filters.md
3. Re-factor the NCZarr codec libraries
4. Add a test, although it can only be exercised after
the library is installed, so it cannot be used during
normal testing.
5. Cleanup use of HDF5_PLUGIN_PATH in the filter test cases.
2022-04-30 04:31:55 +08:00
|
|
|
# The tst_filterinstall test can only be run after an install
|
|
|
|
# occurred with --with-plugin-dir enabled. So there is no point
|
|
|
|
#in running it via make check. It is kept here so it can be
|
|
|
|
# manually invoked if desired
|
|
|
|
EXTRA_DIST += tst_filterinstall.sh
|
|
|
|
|
2018-08-23 22:21:55 +08:00
|
|
|
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
|
2021-09-03 07:04:26 +08:00
|
|
|
tst_floats_1D.cdl floats_1D_3.nc floats_1D.cdl tst_*.nc tmp_*.txt \
|
2018-08-24 22:59:58 +08:00
|
|
|
tst_floats2_*.cdl tst_ints2_*.cdl tst_shorts2_*.cdl tst_elena_*.cdl \
|
|
|
|
tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.* usi_01.* thetau_01.* \
|
|
|
|
tst_*.h5 tst_grp_rename.cdl tst_grp_rename.dmp ref_grp_rename.cdl \
|
|
|
|
foo1.nc tst_*.h4 test.nc testszip.nc test.h5 szip_dump.cdl \
|
2019-03-22 01:33:27 +08:00
|
|
|
perftest.txt bigmeta.nc bigvars.nc *.gz MSGCPP_*.nc \
|
|
|
|
floats*.nc floats*.cdl shorts*.nc shorts*.cdl ints*.nc ints*.cdl \
|
2020-12-30 11:12:35 +08:00
|
|
|
testfilter_reg.nc filterrepeat.txt tmp_fillonly.nc \
|
2021-09-03 07:04:26 +08:00
|
|
|
testfilter_order.nc crfilterorder.txt rdfilterorder.txt 1 \
|
2022-05-10 02:10:53 +08:00
|
|
|
tmp_*.txt tmp_*.nc tmp*.dump tmp*.cdl tmp*.txt tmp*.tmp \
|
|
|
|
tmp_bzip2.c bzip2.nc noop.nc
|
2010-06-11 01:18:48 +08:00
|
|
|
|
2019-02-08 03:43:07 +08:00
|
|
|
DISTCLEANFILES = findplugin.sh run_par_test.sh
|
2018-01-17 02:00:09 +08:00
|
|
|
|
2018-03-29 03:54:05 +08:00
|
|
|
# If valgrind is present, add valgrind targets.
|
|
|
|
@VALGRIND_CHECK_RULES@
|