fixed use of szip library

This commit is contained in:
Ed Hartnett 2011-04-29 18:19:12 +00:00
parent 116572f4f6
commit 74c1e894b3
5 changed files with 100 additions and 31 deletions

View File

@ -883,7 +883,7 @@ if test "x$enable_netcdf_4" = xyes; then
--disable-netcdf-4, or see config.log for errors.])])
AC_CHECK_HEADERS([hdf5.h], [], [AC_MSG_ERROR([NetCDF-4 requires HDF5, but hdf5.h cannot be found.])])
AC_CHECK_FUNCS([H5Pget_fapl_mpiposix H5Pget_fapl_mpio H5Pset_deflate H5Z_can_apply_szip])
AC_CHECK_FUNCS([H5Pget_fapl_mpiposix H5Pget_fapl_mpio H5Pset_deflate H5Pset_szip])
# The user may have parallel HDF5 based on MPI POSIX.
if test "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then
@ -918,14 +918,14 @@ dnl fi
AC_MSG_RESULT([$enable_parallel])
# The user must have build HDF5 with the ZLIB library.
#AC_CHECK_LIB([hdf5], [H5Pset_deflate], [enable_zlib=yes], [])
if test "x$ac_cv_func_H5Pset_deflate" = xyes; then
AC_DEFINE([USE_ZLIB], [1], [if true, compile in zlib compression in netCDF-4 variables])
else
AC_MSG_ERROR([HDF5 must be built with zlib for netCDF-4])
fi
# The user must have build HDF5 with the ZLIB library.
# AC_CHECK_LIB([hdf5], [H5Z_can_apply_szip], [enable_szip=yes], [])
if test "x$ac_cv_func_H5Z_can_apply_szip" = xyes; then
# The user may have build HDF5 with the SZLIB library.
if test "x$ac_cv_func_H5Pset_szip" = xyes; then
AC_DEFINE([USE_SZIP], [1], [if true, compile in szip compression in netCDF-4 variables])
fi
@ -958,10 +958,6 @@ AM_CONDITIONAL(ENABLE_DAP_REMOTE_TESTS, [test "x$enable_dap_remote_tests" = xyes
AM_CONDITIONAL(ENABLE_DAP_LONG_TESTS, [test "x$enable_dap_long_tests" = xyes])
AM_CONDITIONAL(BUILD_CXX4, [test x$enable_cxx_4 = xyes])
AM_CONDITIONAL(EXTRA_EXAMPLE_TESTS, [test "x$enable_extra_example_tests" = xyes])
AM_CONDITIONAL(USE_HDF5_DIR, [test ! "x$HDF5DIR" = x])
AM_CONDITIONAL(USE_HDF4_DIR, [test ! "x$HDF4DIR" = x])
AM_CONDITIONAL(USE_ZLIB_DIR, [test ! "x$ZLIBDIR" = x])
AM_CONDITIONAL(USE_SZLIB_DIR, [test ! "x$SZLIBDIR" = x])
AM_CONDITIONAL(USE_SZIP, [test "x$enable_szip" = xyes])
AM_CONDITIONAL(USE_PNETCDF_DIR, [test ! "x$PNETCDFDIR" = x])
AM_CONDITIONAL(USE_LOGGING, [test "x$enable_logging" = xyes])

View File

@ -1,10 +1,8 @@
/* This is part of the netCDF package.
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
/* This is part of the netCDF package. Copyright 2005-2011,
University Corporation for Atmospheric Research/Unidata. See
COPYRIGHT file for conditions of use.
Test that HDF5 and NetCDF-4 can read and write the same file.
$Id: tst_interops2.c,v 1.9 2010/05/11 13:56:04 ed Exp $
Test that NetCDF-4 can read HDF4 files.
*/
#include <config.h>
#include <nc_tests.h>

View File

@ -1,11 +1,11 @@
/* This is part of the netCDF package.
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
/* This is part of the netCDF package. Copyright 2005-2011, University
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
Test that HDF5 and NetCDF-4 can read and write the same file.
$Id: tst_interops3.c,v 1.2 2009/07/15 15:16:05 ed Exp $
Test that NetCDF-4 can read a bunch of HDF4 files pulled in from
the FTP site.
*/
#include <config.h>
#include <nc_tests.h>
#include <mfhdf.h>

View File

@ -1,11 +1,9 @@
/* This is part of the netCDF package.
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
/* This is part of the netCDF package. Copyright 2005-2011, University
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
Test NetCDF-4 files with lots of attributes on big vs. little
endian platforms.
$Id: tst_interops4.c,v 1.4 2010/02/26 12:52:30 ed Exp $
*/
#include <config.h>
#include <nc_tests.h>

View File

@ -1,10 +1,8 @@
/* This is part of the netCDF package.
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
/* This is part of the netCDF package. Copyright 2005-2011, University
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
Test that HDF5 and NetCDF-4 can read and write the same file.
$Id: tst_interops5.c,v 1.2 2010/06/01 15:34:52 ed Exp $
*/
#include <config.h>
#include <nc_tests.h>
@ -177,6 +175,85 @@ main(int argc, char **argv)
}
}
SUMMARIZE_ERR;
#ifdef USE_SZIP
printf("*** testing HDF5 compatibility with szip...");
{
#define DEFLATE_LEVEL 9
#define MAX_NAME 100
#define NUM_CD_ELEM 10
/* HDF5 defines this... */
#define DEFLATE_NAME "deflate"
#define DIM1_LEN 3000
#define GRP_NAME "George_Washington"
#define BATTLE_RECORD "Battle_Record"
hid_t fileid, grpid, spaceid, datasetid;
int data_out[DIM1_LEN], data_in[DIM1_LEN];
hsize_t dims[1] = {DIM1_LEN};
H5Z_filter_t filter;
int num_filters;
hid_t propid;
unsigned int flags, cd_values[NUM_CD_ELEM], filter_config;
size_t cd_nelems = NUM_CD_ELEM;
size_t namelen = MAX_NAME;
char name[MAX_NAME + 1], name_in[MAX_NAME + 1];
int ncid, ndims_in, nvars_in, ngatts_in, unlimdimid_in, ngrps_in;
int dimid_in[1], natts_in;
nc_type xtype_in;
int i;
for (i = 0; i < DIM1_LEN; i++)
data_out[i] = i;
/* Open file and create group. */
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT)) < 0) ERR;
if ((grpid = H5Gcreate(fileid, GRP_NAME, 0)) < 0) ERR;
/* Write an array of bools, with szip compression. */
if ((propid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
if (H5Pset_layout(propid, H5D_CHUNKED)) ERR;
if (H5Pset_chunk(propid, 1, dims)) ERR;
if (H5Pset_szip(propid, H5_SZIP_EC_OPTION_MASK, 32)) ERR;
if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
if ((datasetid = H5Dcreate(grpid, BATTLE_RECORD, H5T_NATIVE_INT,
spaceid, propid)) < 0) ERR;
if (H5Dwrite(datasetid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data_out) < 0) ERR;
if (H5Dclose(datasetid) < 0 ||
H5Pclose(propid) < 0 ||
H5Sclose(spaceid) < 0 ||
H5Gclose(grpid) < 0 ||
H5Fclose(fileid) < 0)
ERR;
/* Open the file with netCDF and check it. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims_in, &nvars_in, &ngatts_in, &unlimdimid_in)) ERR;
if (ndims_in != 0 || nvars_in != 0 || ngatts_in != 0 || unlimdimid_in != -1) ERR;
if (nc_inq_grps(ncid, &ngrps_in, &grpid)) ERR;
if (ngrps_in != 1) ERR;
if (nc_inq(grpid, &ndims_in, &nvars_in, &ngatts_in, &unlimdimid_in)) ERR;
if (ndims_in != 1 || nvars_in != 1 || ngatts_in != 0 || unlimdimid_in != -1) ERR;
/* Check the variable. */
if (nc_inq_var(grpid, 0, name_in, &xtype_in, &ndims_in, dimid_in,
&natts_in)) ERR;
if (strcmp(name_in, BATTLE_RECORD) || xtype_in != NC_INT || ndims_in != 1 ||
dimid_in[0] != 0 || natts_in != 0) ERR;
/* Check the data. */
if (nc_get_var(grpid, 0, data_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
if (data_in[i] != data_out[i]) ERR;
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
#endif /* USE_SZIP */
FINAL_RESULTS;
}