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

Addresses issue: Update HDF5 format compatibility #951 #1931

Merged
merged 11 commits into from
Mar 30, 2021
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,6 @@ IF(USE_HDF5)

#Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_libver_bounds "" HAVE_H5PSET_LIBVER_BOUNDS)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5free_memory "" HAVE_H5FREE_MEMORY)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5allocate_memory "" HAVE_H5ALLOCATE_MEMORY)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5resize_memory "" HAVE_H5RESIZE_MEMORY)
Expand Down
3 changes: 0 additions & 3 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ are set when opening a binary file on Windows. */
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine HAVE_STRUCT_TIMESPEC 1

/* if true, netcdf4 file properties will be set using H5Pset_libver_bounds */
#cmakedefine HAVE_H5PSET_LIBVER_BOUNDS 1

/* Define to 1 if you have the `H5Z_SZIP' function. */
#cmakedefine HAVE_H5Z_SZIP 1

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ if test "x$enable_hdf5" = xyes; then

# 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 H5resize_memory H5allocate_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops])
AC_CHECK_FUNCS([H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5resize_memory H5allocate_memory H5Pset_all_coll_metadata_ops])

# 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
Expand Down
14 changes: 9 additions & 5 deletions libhdf5/hdf5create.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,19 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
nc4_chunk_cache_preemption));
}

#ifdef HAVE_H5PSET_LIBVER_BOUNDS
#if H5_VERSION_GE(1,10,2)
if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0)
/* lib versions 1.10.2 and higher */
if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
#else
if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST,
H5F_LIBVER_LATEST) < 0)
#if H5_VERSION_GE(1,10,0)
/* lib versions 1.10.0, 1.10.1 */
if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
#else
/* all HDF5 1.8 lib versions */
if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
#endif
BAIL(NC_EHDFERR);
#endif
BAIL(NC_EHDFERR);

/* Create the property list. */
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
Expand Down
2 changes: 1 addition & 1 deletion ncdump/tst_netcdf4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cleanncprops() {
rm -f $dst
cat $src \
| sed -e '/:_Endianness/d' \
| sed -e 's/_SuperblockVersion = 1/_SuperblockVersion = 0/' \
| sed -e 's/_SuperblockVersion = [12]/_SuperblockVersion = 0/' \
| sed -e 's/\(netcdflibversion\|netcdf\)=.*|/\1=NNNN|/' \
| sed -e 's/\(hdf5libversion\|hdf5\)=.*"/\1=HHHH"/' \
| grep -v '_NCProperties' \
Expand Down
2 changes: 1 addition & 1 deletion ncdump/tst_netcdf4_4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cleanncprops() {
rm -f $dst
cat $src \
| sed -e '/:_Endianness/d' \
| sed -e 's/_SuperblockVersion = 1/_SuperblockVersion = 0/' \
| sed -e 's/_SuperblockVersion = [12]/_SuperblockVersion = 0/' \
| sed -e 's/\(netcdflibversion\|netcdf\)=.*|/\1=NNNN|/' \
| sed -e 's/\(hdf5libversion\|hdf5\)=.*"/\1=HHHH"/' \
| grep -v '_NCProperties' \
Expand Down