Skip to content

Commit

Permalink
now use HAVE_PAR_FILTERS in test_pioc.c
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Aug 7, 2020
1 parent 8a298dc commit f591b8c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "netcdf_meta.h"],
])], [have_par_filters=yes], [have_par_filters=no])
AC_MSG_CHECKING([whether netCDF provides parallel filter support])
AC_MSG_RESULT([${have_par_filters}])
if test "x$have_par_filters" = xyes ; then
AC_DEFINE([HAVE_PAR_FILTERS], [1], [if true, netcdf-c supports filters with parallel I/O])
fi

# Is this version 4.7.2, which does not work?
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "netcdf_meta.h"],
Expand Down
26 changes: 22 additions & 4 deletions tests/cunit/test_pioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1570,9 +1570,19 @@ int test_nc4(int iosysid, int num_flavors, int *flavor, int my_rank)
if ((ret = PIOc_def_var_chunking(ncid, 0, NC_CHUNKED, chunksize)))
ERR(ret);

/* Setting deflate works with parallel iotype starting with netcdf-c-4.7.4. */
if ((ret = PIOc_def_var_deflate(ncid, 0, 0, 1, 1)))
/* Setting deflate works with parallel iotype starting
* with netcdf-c-4.7.4. If present, HAVE_PAR_FILTERS will
* be defined. */
ret = PIOc_def_var_deflate(ncid, 0, 0, 1, 1);
#ifdef HAVE_PAR_FILTERS
if (ret)
ERR(ret);
#else
if (flavor[fmt] == PIO_IOTYPE_NETCDF4C && ret)
ERR(ret);
if (flavor[fmt] == PIO_IOTYPE_NETCDF4P && !ret)
ERR(ERR_WRONG);
#endif

/* Check that the inq_varname function works. */
if ((ret = PIOc_inq_varname(ncid, 0, NULL)))
Expand Down Expand Up @@ -1602,10 +1612,18 @@ int test_nc4(int iosysid, int num_flavors, int *flavor, int my_rank)
if (shuffle || !deflate || deflate_level != 1)
ERR(ERR_AWFUL);

/* For parallel netCDF-4, we turned on deflate above. */
/* For parallel netCDF-4, we turned on deflate above, if
* HAVE_PAR_FILTERS is defined. */
if (flavor[fmt] == PIO_IOTYPE_NETCDF4P)
if (shuffle || !deflate || deflate_level != 1)
{
#ifdef HAVE_PAR_FILTERS
if (shuffle || !deflate || deflate_level != 1)
ERR(ERR_AWFUL);
#else
if (shuffle || deflate)
ERR(ERR_AWFUL);
#endif /* HAVE_PAR_FILTERS */
}

/* Check setting the chunk cache for the variable. */
if ((ret = PIOc_set_var_chunk_cache(ncid, 0, VAR_CACHE_SIZE, VAR_CACHE_NELEMS,
Expand Down

0 comments on commit f591b8c

Please sign in to comment.