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) 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