From c3ae3daf2df4d37e6f2920a7e19ec9b1e7409679 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 5 Aug 2024 07:03:18 -0600 Subject: [PATCH 1/2] Now use H5Literate2() instead of H5Literate() when its available --- configure.ac | 4 ++-- libhdf5/hdf5open.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2905135120..9888d0af65 100644 --- a/configure.ac +++ b/configure.ac @@ -1618,13 +1618,13 @@ 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 H5Pset_all_coll_metadata_ops H5Literate]) + AC_CHECK_FUNCS([H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5Pset_all_coll_metadata_ops H5Literate H5Literate2]) # 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. if test "x$ac_cv_func_H5Pget_fapl_mpio" = xyes -o "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then hdf5_parallel=yes diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index c30d4e7997..1c4313b5e7 100644 --- a/libhdf5/hdf5open.c +++ b/libhdf5/hdf5open.c @@ -2857,9 +2857,15 @@ rec_read_metadata(NC_GRP_INFO_T *grp) * passed as a parameter to the callback function * read_hdf5_obj(). (I have also tried H5Oiterate(), but it is much * slower iterating over the same file - Ed.) */ +#ifdef HAVE_H5LITERATE2 + if (H5Literate2(hdf5_grp->hdf_grpid, iter_index, H5_ITER_INC, &idx, + read_hdf5_obj, (void *)&udata) < 0) + BAIL(NC_EHDFERR); +#else if (H5Literate(hdf5_grp->hdf_grpid, iter_index, H5_ITER_INC, &idx, read_hdf5_obj, (void *)&udata) < 0) BAIL(NC_EHDFERR); +#endif /* Process the child groups found. (Deferred until now, so that the * types in the current group get processed and are available for From f833d5997174ee2ca3582c8b0001034944fac47b Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 5 Aug 2024 07:13:29 -0600 Subject: [PATCH 2/2] Now use H5Literate2() instead of H5Literate() when its available --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1ecf7ffbd..3a644ef583 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1315,6 +1315,7 @@ CHECK_FUNCTION_EXISTS(_filelengthi64 HAVE_FILE_LENGTH_I64) CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP) CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP) CHECK_FUNCTION_EXISTS(fileno HAVE_FILENO) +CHECK_FUNCTION_EXISTS(H5Literate2 HAVE_H5LITERATE2) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) CHECK_SYMBOL_EXISTS("struct timespec" "time.h" HAVE_STRUCT_TIMESPEC)