Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust tests and utils for split of libsrc4 and libhdf5 #1234

Merged
merged 14 commits into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ endif

# Is the user building netCDF-4?
if USE_NETCDF4
H5_TEST_DIR = h5_test
LIBSRC4_DIR = libsrc4
endif

# Is the user building with HDF5?
if USE_HDF5
H5_TEST_DIR = h5_test
LIBHDF5 = libhdf5
NC_TEST4 = nc_test4
endif
Expand Down
64 changes: 33 additions & 31 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ AC_ARG_ENABLE([netcdf-4], [AS_HELP_STRING([--disable-netcdf-4],
[do not build with netcdf-4 (else HDF5 and zlib required)])])
test "x$enable_netcdf_4" = xno || enable_netcdf_4=yes

enable_hdf5=$enable_netcdf_4
AC_MSG_CHECKING([whether we should build with HDF5])
AC_MSG_RESULT([$enable_hdf5])

# Synonym
AC_ARG_ENABLE([netcdf4], [AS_HELP_STRING([--disable-netcdf4],
[(just a synonym for --disable-netcdf-4)])])
Expand All @@ -206,6 +202,17 @@ enable_netcdf_4=no
fi
AC_MSG_RESULT([$enable_netcdf_4])

# Does the user want to use HDF5?
AC_MSG_CHECKING([whether we should build with HDF5])
#enable_hdf5=$enable_netcdf_4
AC_ARG_ENABLE([hdf5], [AS_HELP_STRING([--disable-hdf5],
[do not build with HDF5])])
test "x$enable_hdf5" = xno || enable_hdf5=yes
if test "x$enable_netcdf_4" = xno ; then
enable_hdf5=no
fi
AC_MSG_RESULT([$enable_hdf5])

# Does the user require dynamic loading?
# This is only for those hdf5 installs that support it.
AC_MSG_CHECKING([do we require hdf5 dynamic-loading support])
Expand Down Expand Up @@ -852,7 +859,8 @@ AC_CHECK_FUNCS([strlcat snprintf \
getrlimit gettimeofday fsync MPI_Comm_f2c MPI_Info_f2c])

# disable dap4 if netcdf-4 is disabled
if test "x$enable_netcdf_4" = "xno" ; then
#if test "x$enable_netcdf_4" = "xno" ; then
if test "x$enable_hdf5" = "xno" ; then
AC_MSG_WARN([netcdf-4 not enabled; disabling DAP4])
enable_dap4=no
fi
Expand Down Expand Up @@ -1006,9 +1014,13 @@ AC_CHECK_LIB([m], [floor], [],
[AC_MSG_ERROR([Can't find or link to the math library.])])

if test "x$enable_netcdf_4" = xyes; then
AC_DEFINE([USE_NETCDF4], [1], [if true, build netCDF-4])
fi

hdf5_parallel=no
if test "x$enable_hdf5" = xyes; then

AC_DEFINE([USE_HDF5], [1], [if true, use HDF5])
AC_DEFINE([USE_NETCDF4], [1], [if true, build netCDF-4])
AC_DEFINE([H5_USE_16_API], [1], [use HDF5 1.6 API])

# Check for the main hdf5 and hdf5_hl library.
Expand All @@ -1020,28 +1032,17 @@ if test "x$enable_netcdf_4" = xyes; then

AC_CHECK_HEADERS([hdf5.h], [], [AC_MSG_ERROR([Compiling a test with HDF5 failed. Either hdf5.h cannot be found, or config.log should be checked for other reason.])])
AC_CHECK_FUNCS([H5Z_SZIP])
hdf5_parallel=no

# H5Pset_fapl_mpiposix and H5Pget_fapl_mpiposix have been removed since HDF5 1.8.12.
# Use H5Pset_fapl_mpio and H5Pget_fapl_mpio, instead.
AC_CHECK_FUNCS([H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops])
# The user may have parallel HDF5 based on MPI POSIX.
# if test "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then
# AC_DEFINE([USE_PARALLEL_POSIX], [1], [if true, compile in parallel netCDF-4 based on MPI/POSIX])
# fi

# The user may have parallel HDF5 based on MPI mumble mumble.
# if test "x$ac_cv_func_H5Pget_fapl_mpio" = xyes; then
# AC_DEFINE([USE_PARALLEL_MPIO], [1], [if true, compile in parallel netCDF-4 based on MPI/IO])
# fi

# Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0)
if test "x$ac_cv_func_H5Pset_all_coll_metadata_ops" = xyes; then
AC_DEFINE([HDF5_HAS_COLL_METADATA_OPS], [1], [if true, use collective metadata ops in parallel netCDF-4])
fi

# If parallel is available in hdf5, enable it in the C code. Also add some stuff to netcdf.h.
hdf5_parallel=no
if test "x$ac_cv_func_H5Pget_fapl_mpio" = xyes -o "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then
hdf5_parallel=yes
fi
Expand Down Expand Up @@ -1072,21 +1073,22 @@ if test "x$enable_netcdf_4" = xyes; then
AC_DEFINE([HDF5_HAS_LIBVER_BOUNDS], [1], [if true, netcdf4 file properties will be set using H5Pset_libver_bounds])
fi

# If the user wants hdf4 built in, check it out.
if test "x$enable_hdf4" = xyes; then
AC_CHECK_LIB([jpeg], [jpeg_CreateCompress], [],
[AC_MSG_ERROR([Jpeg library required for --enable-hdf4 builds.])])
AC_CHECK_HEADERS([mfhdf.h], [], [nc_mfhdf_h_missing=yes])
if test "x$nc_mfhdf_h_missing" = xyes; then
AC_MSG_ERROR([Cannot find mfhdf.h, yet --enable-hdf4 was used.])
fi
AC_CHECK_LIB([df], [Hclose], [], [AC_MSG_ERROR([Can't find or link to the hdf4 df library. See config.log for errors.])])
AC_CHECK_LIB([mfhdf], [NC_arrayfill], [AC_MSG_ERROR([HDF4 library must be built with --disable-netcdf.])], [])
AC_CHECK_LIB([mfhdf], [SDcreate], [], [AC_MSG_ERROR([Can't find or link to the hdf4 mfhdf library. See config.log for errors.])])
fi

AC_CHECK_LIB([jpeg], [jpeg_set_quality], [], [AC_MSG_ERROR([Can't find or link to the jpeg library (required by hdf4). See config.log for errors.])])
AC_DEFINE([USE_HDF4], [1], [if true, use HDF4 too])
# If the user wants hdf4 built in, check it out.
if test "x$enable_hdf4" = xyes; then
AC_CHECK_LIB([jpeg], [jpeg_CreateCompress], [],
[AC_MSG_ERROR([Jpeg library required for --enable-hdf4 builds.])])
AC_CHECK_HEADERS([mfhdf.h], [], [nc_mfhdf_h_missing=yes])
if test "x$nc_mfhdf_h_missing" = xyes; then
AC_MSG_ERROR([Cannot find mfhdf.h, yet --enable-hdf4 was used.])
fi
AC_CHECK_LIB([df], [Hclose], [], [AC_MSG_ERROR([Can't find or link to the hdf4 df library. See config.log for errors.])])
AC_CHECK_LIB([mfhdf], [NC_arrayfill], [AC_MSG_ERROR([HDF4 library must be built with --disable-netcdf.])], [])
AC_CHECK_LIB([mfhdf], [SDcreate], [], [AC_MSG_ERROR([Can't find or link to the hdf4 mfhdf library. See config.log for errors.])])

AC_CHECK_LIB([jpeg], [jpeg_set_quality], [], [AC_MSG_ERROR([Can't find or link to the jpeg library (required by hdf4). See config.log for errors.])])
AC_DEFINE([USE_HDF4], [1], [if true, use HDF4 too])
fi

# There are several cases for parallelism:
Expand All @@ -1096,7 +1098,7 @@ fi
# b. do want to use it for netcdf4

# Should we provide parallel io for netcdf-4?
if test "x$enable_netcdf_4" = xyes ; then
if test "x$enable_hdf5" = xyes ; then
AC_ARG_ENABLE([parallel4],
[AS_HELP_STRING([--disable-parallel4],
[disable parallel I/O for netcdf-4, even if it's enabled in libhdf5])],
Expand Down
8 changes: 4 additions & 4 deletions examples/C/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sfc_pres_temp_rd pres_temp_4D_wr pres_temp_4D_rd
TESTS = run_examples.sh

# To build netcdf-4, or not to build netcdf-4, that is the question...
if USE_NETCDF4
if USE_HDF5
# These are the extra netCDF-4 examples.
check_PROGRAMS += simple_nc4_wr simple_nc4_rd simple_xy_nc4_wr \
simple_xy_nc4_rd
Expand All @@ -31,7 +31,7 @@ check_PROGRAMS += filter_example
TESTS += run_filter.sh
endif

endif #USE_NETCDF4
endif #USE_HDF5

if USE_PNETCDF
# These are the extra netCDF-4 examples.
Expand All @@ -42,9 +42,9 @@ endif #USE_PNETCDF
AM_CPPFLAGS += -I$(top_builddir)/liblib
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la

if USE_NETCDF4
if USE_HDF5
TESTS += run_examples4.sh
endif #USE_NETCDF4
endif #USE_HDF5

# These files are created by the tests.
CLEANFILES = *.nc
Expand Down
4 changes: 4 additions & 0 deletions include/hdf5dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ extern "C" {
int *no_fill, void *fill_valuep, int *endiannessp,
unsigned int *idp, size_t *nparamsp, unsigned int *params);

EXTERNL int
NC4_HDF5_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems,
float preemption);

#if defined(__cplusplus)
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/hdf5internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int nc4_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp);

/* Find file, group, var, and att info, doing lazy reads if needed. */
int nc4_hdf5_find_grp_var_att(int ncid, int varid, const char *name, int attnum,
int use_name, NC_FILE_INFO_T **h5,
int use_name, char *norm_name, NC_FILE_INFO_T **h5,
NC_GRP_INFO_T **grp, NC_VAR_INFO_T **var,
NC_ATT_INFO_T **att);

Expand Down
3 changes: 0 additions & 3 deletions include/nc4dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ extern "C" {
EXTERNL int
NC4_def_var_filter(int, int, unsigned int, size_t, const unsigned int*);

EXTERNL int
NC4_set_var_chunk_cache(int, int, size_t, size_t, float);

EXTERNL int
NC4_get_var_chunk_cache(int, int, size_t *, size_t *, float *);

Expand Down
4 changes: 1 addition & 3 deletions include/nc_provenance.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/* Copyright 2005-2018 University Corporation for Atmospheric
Research/Unidata. */
/**
/**
* @file
* @internal Contains information for creating provenance
* info and/or displaying provenance info.
*
* @author Dennis Heimbigner, Ward Fisher

/**************************************************/
*/
/**

It has come to pass that we can't guarantee that this information is
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/dfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,7 @@ NC_open(const char *path0, int omode, int basepe, size_t *chunksizehintp,
dispatcher = NCP_dispatch_table;
break;
#endif
#if defined(USE_NETCDF4)
#if defined(USE_HDF5)
case NC_FORMATX_NC4:
dispatcher = HDF5_dispatch_table;
break;
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/nc.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ nc_set_default_format(int format, int *old_formatp)
if (format == NC_FORMAT_CDF5)
return NC_ENOTBUILT;
#endif
#ifdef USE_NETCDF4
#ifdef USE_HDF5
if (format != NC_FORMAT_CLASSIC && format != NC_FORMAT_64BIT_OFFSET &&
format != NC_FORMAT_NETCDF4 && format != NC_FORMAT_NETCDF4_CLASSIC &&
format != NC_FORMAT_CDF5)
Expand Down
Loading