adding szip test to tst_parallel_zlib2.c
This program tests netcdf-4 parallel I/O using zlib, shuffle, and
fletcher32 fliters while writing with parallel I/O. This works for
- HDF5-1.10.2 and later. In this case HDF5_SUPPORTS_PAR_FILTERS will
+ HDF5-1.10.3 and later. In this case HDF5_SUPPORTS_PAR_FILTERS will
be defined during configure.
+ If szip was built into HDF5, this test will also test parallel szip
+ writes. If szip is present, then HAVE_H5Z_SZIP will be defined in
+ config.h.
+
Ed Hartnett, 12/19/2019
*/
#define NUM_PROC 4
#define NUM_SLABS 10
#define NUM_SHUFFLE_SETTINGS 2
+#define NUM_COMPRESSION_FILTERS 1
int
main(int argc, char **argv)
@@ -34,7 +39,7 @@ main(int argc, char **argv)
int ncid, v1id, dimids[NDIMS];
size_t start[NDIMS], count[NDIMS];
- int i, res;
+ int f, i, res;
int *slab_data; /* one slab */
/* Initialize MPI. */
@@ -51,14 +56,16 @@ main(int argc, char **argv)
slab_data[i] = mpi_rank;
if (!mpi_rank)
- {
- printf("\n*** Testing parallel writes with zlib some more.\n");
- }
+ printf("\n*** Testing parallel writes with compression filters.\n");
{
int s;
+ for (f = 0; s < NUM_COMPRESSION_FILTERS; f++)
+ {
for (s = 0; s < NUM_SHUFFLE_SETTINGS; s++)
{
- printf("*** testing simple write with zlib shuffle %d...", s);
+ if (!mpi_rank)
+ printf("*** testing simple write with %s shuffle %d...",
+ (f ? "szip" : "zlib"), s);
/* nc_set_log_level(3); */
/* Create a parallel netcdf-4 file. */
@@ -72,9 +79,16 @@ main(int argc, char **argv)
/* Create one var. Turn on deflation. */
if ((res = nc_def_var(ncid, "v1", NC_INT, NDIMS, dimids, &v1id))) ERR;
- /* Setting deflate only will work for HDF5-1.10.2 and later
+ /* Setting any filter only will work for HDF5-1.10.3 and later
* versions. */
+ if (!f)
res = nc_def_var_deflate(ncid, 0, s, 1, 1);
+ else
+ {
+ res = nc_def_var_deflate(ncid, 0, s, 0, 0);
+ if (!res)
+ res = nc_def_var_szip(ncid, 0, 32, 32);
+ }
#ifdef HDF5_SUPPORTS_PAR_FILTERS
if (res) ERR;
#else
@@ -146,6 +160,7 @@ main(int argc, char **argv)
if (!mpi_rank)
SUMMARIZE_ERR;
} /* next shuffle filter test */
+ } /* next compression filter (zlib and szip) */
free(slab_data);
}
