parallel zstd test

This commit is contained in:
Edward Hartnett 2024-08-30 05:20:00 -06:00
parent 411f791dca
commit e768bf2cbc
3 changed files with 67 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# -*- Autoconf -*-
o# -*- Autoconf -*-
## Process this file with autoconf to produce a configure script.
# This is part of Unidata's netCDF package. Copyright 2005-2018, see
@ -784,6 +784,10 @@ if test "x$enable_filter_zstd" = "xyes" ; then
else
have_zstd=no
fi
AC_MSG_CHECKING([whether we are going to build with zstd])
AC_SUBST([HAVE_ZSTD], [$have_zstd])
AC_MSG_RESULT([$have_zstd])
##
# End zstd checks
##

View File

@ -10,6 +10,18 @@ set -e
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
if test "x@HAVE_ZSTD@" = "xyes" ; then
# Load the findplugins function
. ${builddir}/findplugin.sh
echo "findplugin.sh loaded"
echo "${HDF5_PLUGIN_DIR}"
# Find zstd plugin.
findplugin h5zstd
export HDF5_PLUGIN_PATH="${HDF5_PLUGIN_DIR}"
echo "HDF5_PLUGIN_PATH=$HDF5_PLUGIN_PATH"
fi
echo
echo "Testing MPI parallel I/O with various other mode flags..."
@MPIEXEC@ -n 1 ./tst_mode

View File

@ -469,6 +469,56 @@ main(int argc, char **argv)
if (!mpi_rank)
SUMMARIZE_ERR;
#endif /* HDF5_SUPPORTS_PAR_FILTERS */
#endif /* HAVE_H5Z_SZIP */
#ifdef HAVE_H5Z_SZIP
#ifdef HDF5_SUPPORTS_PAR_FILTERS
#define SZIP_DIM_LEN 256
#define SZIP_DIM_NAME "Barrels"
#define SZIP_VAR_NAME "Best_Sligo_Rags"
#define SZIP_PIXELS_PER_BLOCK 32
if (!mpi_rank)
printf("*** testing zstd compression with parallel I/O...");
{
int ncid, dimid, varid;
float *data;
float *data_in;
int elements_per_pe = SZIP_DIM_LEN/mpi_size;
size_t start[NDIMS1], count[NDIMS1];
int i;
/* Create test data. */
if (!(data = malloc(elements_per_pe * sizeof(float)))) ERR;
for (i = 0; i < elements_per_pe; i++)
data[i] = mpi_rank + i * 0.1;
/* Crate a file with a scalar NC_BYTE value. */
if (nc_create_par(FILE, NC_NETCDF4, MPI_COMM_WORLD, MPI_INFO_NULL,
&ncid)) ERR;
if (nc_def_dim(ncid, SZIP_DIM_NAME, SZIP_DIM_LEN, &dimid)) ERR;
if (nc_def_var(ncid, SZIP_VAR_NAME, NC_FLOAT, NDIMS1, &dimid, &varid)) ERR;
/* if (nc_def_var_szip(ncid, varid, NC_SZIP_NN, SZIP_PIXELS_PER_BLOCK)) ERR; */
if (nc_enddef(ncid)) ERR;
start[0] = mpi_rank * elements_per_pe;
count[0] = elements_per_pe;
if (nc_put_vara_float(ncid, varid, start, count, data));
if (nc_close(ncid)) ERR;
/* Reopen the file and check. */
if (nc_open_par(FILE, 0, comm, info, &ncid)) ERR;
if (!(data_in = malloc(elements_per_pe * sizeof(float)))) ERR;
if (nc_get_vara_float(ncid, varid, start, count, data_in));
if (nc_close(ncid)) ERR;
for (i = 0; i < elements_per_pe; i++)
if (data_in[i] != data[i]) ERR;
/* Release resources. */
free(data_in);
free(data);
}
if (!mpi_rank)
SUMMARIZE_ERR;
#endif /* HDF5_SUPPORTS_PAR_FILTERS */
#endif /* HAVE_H5Z_SZIP */
/* Shut down MPI. */