diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-09-11 14:08:04 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-09-11 14:08:04 (GMT) |
commit | 122bf84bb3623df66306da08275c4cb65e15475e (patch) | |
tree | 5436fac979c46632f66509ab876d9401c40a231d | |
parent | f3da95644105e1a70f7b5246128ff542585695e5 (diff) | |
parent | 1ac1dfb40fc603fdb5448a64eb46786f7c621185 (diff) | |
download | hdf5-122bf84bb3623df66306da08275c4cb65e15475e.zip hdf5-122bf84bb3623df66306da08275c4cb65e15475e.tar.gz hdf5-122bf84bb3623df66306da08275c4cb65e15475e.tar.bz2 |
[svn-r27760] Brought r27631-27755 over from the trunk.
tested on: jam
53 files changed, 3280 insertions, 2431 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cd3e1c9..96d5772 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -625,12 +625,12 @@ if (BUILD_TESTING) option (HDF_TEST_EXPRESS "Control testing framework (0-3)" "0") mark_as_advanced (HDF_TEST_EXPRESS) - include (${HDF5_SOURCE_DIR}/CTestConfig.cmake) - configure_file (${HDF_RESOURCES_DIR}/CTestCustom.cmake ${HDF5_BINARY_DIR}/CTestCustom.ctest @ONLY) - enable_testing () include (CTest) + include (${HDF5_SOURCE_DIR}/CTestConfig.cmake) + configure_file (${HDF_RESOURCES_DIR}/CTestCustom.cmake ${HDF5_BINARY_DIR}/CTestCustom.ctest @ONLY) + if (NOT HDF5_EXTERNALLY_CONFIGURED) if (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") add_subdirectory (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib) @@ -696,8 +696,18 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for endif (NOT ALLOW_UNSUPPORTED) endif (BUILD_SHARED_LIBS AND APPLE) option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON) + include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) + + message (STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}") + # Building with PGI requires CMake 3.3 or greater because previous versions + # of CMake add the wrong compiler flag for the PGI Fortran compiler. + if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "PGI" AND "${CMAKE_VERSION}" VERSION_LESS "3.3") + message (FATAL_ERROR " **** PGI FORTRAN REQUIRES CMAKE VERSION 3.3 OR GREATER **** ") + endif () + include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake) + if (HDF5_ENABLE_F2003) if (NOT FORTRAN_HAVE_ISO_C_BINDING) set (HDF5_ENABLE_F2003 OFF) @@ -112,8 +112,7 @@ ./config/Makefile.am.blank ./config/pgi-fflags ./config/pgi-flags -./config/powerpc-ibm-aix5.x -./config/solaris2.x +./config/solaris ./config/x86_64-pc-cygwin ./config/site-specific/BlankForm @@ -886,7 +885,6 @@ ./test/filter_fail.c ./test/flush1.c ./test/flush2.c -# ====distribute this for now. See HDFFV-8236==== ./test/gen_bad_ohdr.c ./test/gen_bad_compound.c ./test/gen_bogus.c @@ -910,7 +908,6 @@ ./test/gen_sizes_lheap.c ./test/gen_specmetaread.c ./test/gen_udlinks.c -# ====end distribute this for now. See HDFFV-8236==== ./test/getname.c ./test/gheap.c ./test/group_old.h5 @@ -1,4 +1,4 @@ -HDF5 version 1.9.230 currently under development +HDF5 version 1.9.231 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 70aadaa..8eeb1bb 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -689,7 +689,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 220 +LT_VERS_REVISION = 221 LT_VERS_AGE = 0 # This is our main target diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 73c41eb..b7754ce 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = "HDF5 C++ API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.9.230 currently under development" +PROJECT_NUMBER = "1.9.231 currently under development" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index b9f18a9..8bd6f45 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -126,7 +126,7 @@ endif (NOT WINDOWS) # Check if Direct I/O driver works #----------------------------------------------------------------------------- if (NOT WINDOWS) - option (HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" ON) + option (HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" OFF) if (HDF5_ENABLE_DIRECT_VFD) set (msg "Performing TEST_DIRECT_VFD_WORKS") set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DTEST_DIRECT_VFD_WORKS -D_GNU_SOURCE ${CMAKE_REQUIRED_FLAGS}") diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 37bcfbf..fd3a1d6 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -157,9 +157,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine H5_HAVE_GETTIMEOFDAY @H5_HAVE_GETTIMEOFDAY@ -/* Define to 1 if you have the `get_fpc_csr' function. */ -#cmakedefine H5_HAVE_GET_FPC_CSR @H5_HAVE_GET_FPC_CSR@ - /* Define if library will contain instrumentation to detect correct optimization operation */ #cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@ @@ -185,15 +182,9 @@ /* Define to 1 if you have the `mpe' library (-lmpe). */ #cmakedefine H5_HAVE_LIBMPE @H5_HAVE_LIBMPE@ -/* Define to 1 if you have the `nsl' library (-lnsl). */ -#cmakedefine H5_HAVE_LIBNSL @H5_HAVE_LIBNSL@ - /* Define to 1 if you have the `pthread' library (-lpthread). */ #cmakedefine H5_HAVE_LIBPTHREAD @H5_HAVE_LIBPTHREAD@ -/* Define to 1 if you have the `socket' library (-lsocket). */ -#cmakedefine H5_HAVE_LIBSOCKET @H5_HAVE_LIBSOCKET@ - /* Define to 1 if you have the `sz' library (-lsz). */ #cmakedefine H5_HAVE_LIBSZ @H5_HAVE_LIBSZ@ @@ -311,15 +302,9 @@ /* Define to 1 if you have the `system' function. */ #cmakedefine H5_HAVE_SYSTEM @H5_HAVE_SYSTEM@ -/* Define to 1 if you have the <sys/fpu.h> header file. */ -#cmakedefine H5_HAVE_SYS_FPU_H @H5_HAVE_SYS_FPU_H@ - /* Define to 1 if you have the <sys/ioctl.h> header file. */ #cmakedefine H5_HAVE_SYS_IOCTL_H @H5_HAVE_SYS_IOCTL_H@ -/* Define to 1 if you have the <sys/proc.h> header file. */ -#cmakedefine H5_HAVE_SYS_PROC_H @H5_HAVE_SYS_PROC_H@ - /* Define to 1 if you have the <sys/resource.h> header file. */ #cmakedefine H5_HAVE_SYS_RESOURCE_H @H5_HAVE_SYS_RESOURCE_H@ @@ -329,9 +314,6 @@ /* Define to 1 if you have the <sys/stat.h> header file. */ #cmakedefine H5_HAVE_SYS_STAT_H @H5_HAVE_SYS_STAT_H@ -/* Define to 1 if you have the <sys/sysinfo.h> header file. */ -#cmakedefine H5_HAVE_SYS_SYSINFO_H @H5_HAVE_SYS_SYSINFO_H@ - /* Define to 1 if you have the <sys/timeb.h> header file. */ #cmakedefine H5_HAVE_SYS_TIMEB_H @H5_HAVE_SYS_TIMEB_H@ diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index adeec55..3577e40 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -48,10 +48,6 @@ set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" "${${HDF5_ set (${HDF5_PACKAGE_NAME}_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@") set_and_check (${HDF5_PACKAGE_NAME}_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@") -if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN) - set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_FORTRAN "@PACKAGE_INCLUDE_INSTALL_DIR@") -endif () - if (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB) set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_CPP "@PACKAGE_INCLUDE_INSTALL_DIR@") endif () @@ -103,9 +99,17 @@ foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) if (${comp} STREQUAL "shared") list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp}) set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp}) + + if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN) + set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_FORTRAN "@PACKAGE_INCLUDE_INSTALL_DIR@/shared") + endif () elseif (${comp} STREQUAL "static") list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp}) set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp}) + + if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN) + set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_FORTRAN "@PACKAGE_INCLUDE_INSTALL_DIR@/static") + endif () endif () endforeach () foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) @@ -128,12 +132,12 @@ foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) set (hdf5_comp2 "hdf5_hl_f90cstub") set (hdf5_comp "hdf5_hl_fortran") endif () - list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}-${libtype}" HAVE_COMP) - if (${HAVE_COMP} LESS 0) + list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}-${libtype}" HAVE_COMP) + if (${HAVE_COMP} LESS 0) set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0) else () if (hdf5_comp2) - list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp2}-${libtype}" HAVE_COMP2) + list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp2}-${libtype}" HAVE_COMP2) if (${HAVE_COMP2} LESS 0) set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0) else () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index e058b10..6885187 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -117,13 +117,8 @@ if (NOT WINDOWS) CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname ${HDF_PREFIX}_HAVE_LIBWSOCK32) endif (NOT WINDOWS) +# UCB (BSD) compatibility library CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname ${HDF_PREFIX}_HAVE_LIBUCB) -CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect ${HDF_PREFIX}_HAVE_LIBSOCKET) -CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL) - -if (NOT NOT_NEED_LIBNSL) - CHECK_LIBRARY_EXISTS_CONCAT ("nsl" gethostbyname ${HDF_PREFIX}_HAVE_LIBNSL) -endif (NOT NOT_NEED_LIBNSL) # For other tests to use the same libraries set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS}) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index d3ac36b..b2c4997 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -20,7 +20,7 @@ endmacro (IDE_GENERATED_PROPERTIES) macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) # install (FILES ${HEADERS} # DESTINATION include/R3D/${NAME} - # COMPONENT Headers + # COMPONENT Headers # ) string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH} ) @@ -90,7 +90,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) set (LIB_DEBUG_NAME "${libname}_debug") endif (WIN32) endif (${libtype} MATCHES "SHARED") - + set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME} @@ -98,7 +98,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME} OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} ) - + #----- Use MSVC Naming conventions for Shared Libraries if (MINGW AND ${libtype} MATCHES "SHARED") set_target_properties (${libtarget} @@ -176,7 +176,7 @@ macro (TARGET_C_PROPERTIES wintarget libtype addcompileflags addlinkflags) PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}" - ) + ) endif (MSVC) endmacro (TARGET_C_PROPERTIES) @@ -187,7 +187,7 @@ macro (TARGET_MSVC_PROPERTIES wintarget libtype addcompileflags addlinkflags) PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}" - ) + ) endif (MSVC) endmacro (TARGET_MSVC_PROPERTIES) @@ -206,13 +206,13 @@ macro (TARGET_FORTRAN_WIN_PROPERTIES forttarget libtype addcompileflags addlinkf PROPERTIES COMPILE_FLAGS "/dll ${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" - ) + ) else (${libtype} MATCHES "SHARED") set_target_properties (${forttarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" - ) + ) endif (${libtype} MATCHES "SHARED") endif (MSVC) endmacro (TARGET_FORTRAN_WIN_PROPERTIES) @@ -235,6 +235,8 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM} 7") elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.2") set (BINARY_PLATFORM "${BINARY_PLATFORM} 8") + elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.3") + set (BINARY_PLATFORM "${BINARY_PLATFORM} 10") endif (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") set (BINARY_PLATFORM "${BINARY_PLATFORM} ${MSVC_C_ARCHITECTURE_ID}") if (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") @@ -245,6 +247,8 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2012") elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "18.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2013") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "19.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") else (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") endif (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") @@ -269,9 +273,9 @@ macro (HDF_README_PROPERTIES target_fortran) else (BUILD_SHARED_LIBS) set (LIB_TYPE "Static") endif (BUILD_SHARED_LIBS) - + configure_file ( - ${HDF_RESOURCES_DIR}/README.txt.cmake.in + ${HDF_RESOURCES_DIR}/README.txt.cmake.in ${CMAKE_BINARY_DIR}/README.txt @ONLY ) endmacro (HDF_README_PROPERTIES) diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index c1df8cf..275f2ea 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------- ENABLE_LANGUAGE (Fortran) - + #----------------------------------------------------------------------------- # Detect name mangling convention used between Fortran and C #----------------------------------------------------------------------------- @@ -12,7 +12,6 @@ FortranCInterface_HEADER ( ${CMAKE_BINARY_DIR}/FCMangle.h MACRO_NAMESPACE "H5_FC_" SYMBOL_NAMESPACE "H5_FC_" - SYMBOLS mysub mymod:my_sub ) file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)") @@ -161,7 +160,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding IMPLICIT NONE TYPE(C_PTR) :: ptr TYPE(C_FUNPTR) :: funptr - INTEGER(C_INT64_T) :: c_int64_type + INTEGER(C_INT64_T) :: c_int64_type CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr ptr = C_LOC(ichr(1:1)) END PROGRAM diff --git a/config/gnu-flags b/config/gnu-flags index 5f10519..e7f8f14 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -144,7 +144,7 @@ case "$cc_vendor-$cc_version" in # Closer to the gcc 5.2 release, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-5.1*) + gcc-5*) # Append warning flags # Don't use the '-Wtraditional' flag, we're way past having K&R C code # H5_CFLAGS="$H5_CFLAGS -Wtraditional" diff --git a/config/ibm-flags b/config/ibm-flags index a1dfa2a..462372d 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -57,7 +57,10 @@ if test "XL" = "$cc_vendor"; then enable_shared="${enable_shared:-no}" # Make sure this is applied to other API compile options such as C++. AM_CFLAGS="$AM_CFLAGS" - H5_CFLAGS="-qlanglvl=stdc99 $H5_CFLAGS" + # -qflag=w:w makes the lowest level of reported compile issues to be "warning" + # instead of "information". This suppresses a very large number of messages + # concerning the portability of __inline__. + H5_CFLAGS="-qlanglvl=stdc99 -qflag=w:w $H5_CFLAGS" DEBUG_CFLAGS="-g -qfullpath" DEBUG_CPPFLAGS= # -O causes test/dtypes to fail badly. Turn it off for now. diff --git a/config/lt_vers.am b/config/lt_vers.am index 0a07eb7..21395cf 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -19,7 +19,7 @@ # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 220 +LT_VERS_REVISION = 221 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/config/powerpc-ibm-aix5.x b/config/powerpc-ibm-aix5.x deleted file mode 100644 index 50a4e8c..0000000 --- a/config/powerpc-ibm-aix5.x +++ /dev/null @@ -1,21 +0,0 @@ -# -*- shell-script -*- -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. - -# Configuration file for building on the IBM POWER AIX platforms. -# This file is part of the HDF5 build script. It is processed shortly -# after configure starts and defines, among other things, flags for -# the various compile modes. - -# Use the generic ibm-aix. -. $srcdir/config/ibm-aix diff --git a/config/solaris2.x b/config/solaris index 310c373..310c373 100644 --- a/config/solaris2.x +++ b/config/solaris @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.230. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.231. # # Report bugs to <help@hdfgroup.org>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.230' -PACKAGE_STRING='HDF5 1.9.230' +PACKAGE_VERSION='1.9.231' +PACKAGE_STRING='HDF5 1.9.231' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1480,7 +1480,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.230 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.231 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1550,7 +1550,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.230:";; + short | recursive ) echo "Configuration of HDF5 1.9.231:";; esac cat <<\_ACEOF @@ -1581,9 +1581,8 @@ Optional Features: --disable-sharedlib-rpath Disable use of the '=Wl,-rpath' linker option --enable-production Determines how to run the compiler. - --enable-threadsafe Enable thread-safe capability. This will disable the - high-level library. You can override this behavior - by specifying --enable-hl and --enable-unsupported. + --enable-threadsafe Enable thread-safe capability. Not compatible with + the high-level library, Fortran, or C++ wrappers. [default=no] --enable-debug=all Turn on debugging in all packages. One may also specify a comma-separated list of package names @@ -1739,7 +1738,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.230 +HDF5 configure 1.9.231 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2654,7 +2653,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.230, which was +It was created by HDF5 $as_me 1.9.231, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3526,7 +3525,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.230' + VERSION='1.9.231' cat >>confdefs.h <<_ACEOF @@ -3712,11 +3711,16 @@ ac_config_commands="$ac_config_commands pubconf" ## configure is currently running by using the --host=foo flag. ## For machines on which HDF5 is often configured, it can be convenient ## to specify the name of the machine rather than its canonical type. -case $host_alias in - redstorm) - host_alias=x86_64-redstorm-linux-gnu - ;; -esac +## +## There are currently no hosts, but if there were they would be +## listed by hostname and the alias would point to a file in +## the config directory: +## +##case $host_alias in +## <some host>) +## host_alias=<config file in config directory> +## ;; +##esac # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || @@ -3956,14 +3960,8 @@ case $host_os in freebsd*) host_os_novers=freebsd ;; - osf4.*) - host_os_novers=osf4.x - ;; - osf5.*) - host_os_novers=osf5.x - ;; - solaris2.*) - host_os_novers=solaris2.x + solaris*) + host_os_novers=solaris ;; *) host_os_novers=$host_os @@ -23040,116 +23038,6 @@ _ACEOF fi -if test "`uname`" = "SunOS" -o "`uname -sr`" = "HP-UX B.11.00"; then - ## ...for Solaris - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 -$as_echo_n "checking for socket in -lsocket... " >&6; } -if ${ac_cv_lib_socket_socket+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char socket (); -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -return socket (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_socket_socket=yes -else - ac_cv_lib_socket_socket=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 -$as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSOCKET 1 -_ACEOF - - LIBS="-lsocket $LIBS" - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_int in -lnsl" >&5 -$as_echo_n "checking for xdr_int in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_xdr_int+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char xdr_int (); -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -return xdr_int (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nsl_xdr_int=yes -else - ac_cv_lib_nsl_xdr_int=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_xdr_int" >&5 -$as_echo "$ac_cv_lib_nsl_xdr_int" >&6; } -if test "x$ac_cv_lib_nsl_xdr_int" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBNSL 1 -_ACEOF - - LIBS="-lnsl $LIBS" - -fi - -fi - ## ---------------------------------------------------------------------- ## Check for system header files. ## @@ -23501,57 +23389,6 @@ done ;; esac -case "$host" in - alpha*-dec*-osf*) - ## The <sys/sysinfo.h> and <sys/proc.h> are needed on the DEC - ## Alpha to turn off UAC fixing. We do *not* attempt to - ## locate these files on other systems because there are too - ## many problems with including them. - for ac_header in sys/sysinfo.h sys/proc.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - ;; - mips*-sgi*) - ## The <sys/fpu.h> is needed on the SGI machines to turn off - ## denormalized floating-point values going to zero. We do *not* - ## attempt to locate these files on other systems because there - ## may be problems with including them. - for ac_header in sys/fpu.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/fpu.h" "ac_cv_header_sys_fpu_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_fpu_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_FPU_H 1 -_ACEOF - -fi - -done - - for ac_func in get_fpc_csr -do : - ac_fn_c_check_func "$LINENO" "get_fpc_csr" "ac_cv_func_get_fpc_csr" -if test "x$ac_cv_func_get_fpc_csr" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GET_FPC_CSR 1 -_ACEOF - -fi -done - - ;; -esac - ## ---------------------------------------------------------------------- ## Some platforms require that all symbols are resolved when a library ## is linked. We can use the -no-undefined flag to tell libtool that @@ -23789,26 +23626,11 @@ case "$host_cpu-$host_vendor-$host_os" in ## ## POSIX feature information can be found in the gcc manual at: ## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html -##SCOT H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS" + H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS" ## Need to add this so that O_DIRECT is visible for the direct ## VFD on Linux systems. H5_CPPFLAGS="-D_GNU_SOURCE $H5_CPPFLAGS" - - ## Also add BSD support on Linux systems, so <features.h> defines - ## __USE_BSD, which is required to get the prototype for strdup - ## defined correctly in <string.h> and snprintf & vsnprintf defined - ## correctly in <stdio.h> - ## Linking to the bsd-compat library is required as per the gcc manual: - ## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html - ## however, we do not do this since it breaks the big test on some - ## older platforms. - H5_CPPFLAGS="-D_BSD_SOURCE $H5_CPPFLAGS" - - ## _BSD_SOURCE is deprecated as of glibc 2.20, in favor of _DEFAULT_SOURCE. - ## To avoid warnings, we define _DEFAULT_SOURCE in addition to _BSD_SOURCE, - ## which should work for all versions of glibc. - H5_CPPFLAGS="-D_DEFAULT_SOURCE $H5_CPPFLAGS" ;; esac @@ -25977,6 +25799,17 @@ fi ## with the thread-safety option because the lock is not hoisted ## into the higher-level API calls. +## --enable-threadsafe is incompatible with --enable-hl unless +## --enable-unsupported has been specified on the configure line. +## +## Note that the high-level library is enabled by default so most +## users will have to add --disable-hl to the configure options. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${HDF5_HL}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then + as_fn_error $? "The thread-safe library is incompatible with the high-level library. --disable-hl can be used to prevent building the high-level library (recommended). Alternatively, --enable-unsupported will allow building the high-level library, though this configuration is not supported by The HDF Group." "$LINENO" 5 + fi +fi + ## The --enable-threadsafe flag is not compatible with --enable-cxx. ## If the user tried to specify both flags, throw an error, unless ## they also provided the --enable-unsupported flag. @@ -26365,7 +26198,7 @@ fi ## ---------------------------------------------------------------------- ## Check for MONOTONIC_TIMER support (used in clock_gettime). This has -## to be done after any POSIX/BSD defines to ensure that the test gets +## to be done after any POSIX defines to ensure that the test gets ## the correct POSIX level on linux. ac_fn_c_check_decl "$LINENO" "CLOCK_MONOTONIC" "ac_cv_have_decl_CLOCK_MONOTONIC" "#include <time.h> " @@ -29472,7 +29305,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -HDF5 config.lt 1.9.230 +HDF5 config.lt 1.9.231 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -31568,7 +31401,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.230, which was +This file was extended by HDF5 $as_me 1.9.231, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31634,7 +31467,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.230 +HDF5 config.status 1.9.231 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index c134ce4..908e3c5 100644 --- a/configure.ac +++ b/configure.ac @@ -26,10 +26,10 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.230], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.231], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) -AC_CONFIG_HEADER([src/H5config.h]) +AC_CONFIG_HEADERS([src/H5config.h]) AC_CONFIG_AUX_DIR([bin]) AC_CONFIG_MACRO_DIR([m4]) @@ -86,11 +86,16 @@ AC_CONFIG_COMMANDS([pubconf], [ ## configure is currently running by using the --host=foo flag. ## For machines on which HDF5 is often configured, it can be convenient ## to specify the name of the machine rather than its canonical type. -case $host_alias in - redstorm) - host_alias=x86_64-redstorm-linux-gnu - ;; -esac +## +## There are currently no hosts, but if there were they would be +## listed by hostname and the alias would point to a file in +## the config directory: +## +##case $host_alias in +## <some host>) +## host_alias=<config file in config directory> +## ;; +##esac AC_CANONICAL_HOST AC_SUBST([CPPFLAGS]) @@ -246,14 +251,8 @@ case $host_os in freebsd*) host_os_novers=freebsd ;; - osf4.*) - host_os_novers=osf4.x - ;; - osf5.*) - host_os_novers=osf5.x - ;; - solaris2.*) - host_os_novers=solaris2.x + solaris*) + host_os_novers=solaris ;; *) host_os_novers=$host_os @@ -967,12 +966,6 @@ esac AC_CHECK_LIB([m], [ceil]) AC_CHECK_LIB([dl], [dlopen]) -if test "`uname`" = "SunOS" -o "`uname -sr`" = "HP-UX B.11.00"; then - ## ...for Solaris - AC_CHECK_LIB([socket], [socket]) - AC_CHECK_LIB([nsl], [xdr_int]) -fi - ## ---------------------------------------------------------------------- ## Check for system header files. ## @@ -1009,24 +1002,6 @@ case "`uname`" in ;; esac -case "$host" in - alpha*-dec*-osf*) - ## The <sys/sysinfo.h> and <sys/proc.h> are needed on the DEC - ## Alpha to turn off UAC fixing. We do *not* attempt to - ## locate these files on other systems because there are too - ## many problems with including them. - AC_CHECK_HEADERS([sys/sysinfo.h sys/proc.h]) - ;; - mips*-sgi*) - ## The <sys/fpu.h> is needed on the SGI machines to turn off - ## denormalized floating-point values going to zero. We do *not* - ## attempt to locate these files on other systems because there - ## may be problems with including them. - AC_CHECK_HEADERS([sys/fpu.h]) - AC_CHECK_FUNCS([get_fpc_csr]) - ;; -esac - ## ---------------------------------------------------------------------- ## Some platforms require that all symbols are resolved when a library ## is linked. We can use the -no-undefined flag to tell libtool that @@ -1099,26 +1074,11 @@ case "$host_cpu-$host_vendor-$host_os" in ## ## POSIX feature information can be found in the gcc manual at: ## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html -##SCOT H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS" + H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS" ## Need to add this so that O_DIRECT is visible for the direct ## VFD on Linux systems. H5_CPPFLAGS="-D_GNU_SOURCE $H5_CPPFLAGS" - - ## Also add BSD support on Linux systems, so <features.h> defines - ## __USE_BSD, which is required to get the prototype for strdup - ## defined correctly in <string.h> and snprintf & vsnprintf defined - ## correctly in <stdio.h> - ## Linking to the bsd-compat library is required as per the gcc manual: - ## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html - ## however, we do not do this since it breaks the big test on some - ## older platforms. - H5_CPPFLAGS="-D_BSD_SOURCE $H5_CPPFLAGS" - - ## _BSD_SOURCE is deprecated as of glibc 2.20, in favor of _DEFAULT_SOURCE. - ## To avoid warnings, we define _DEFAULT_SOURCE in addition to _BSD_SOURCE, - ## which should work for all versions of glibc. - H5_CPPFLAGS="-D_DEFAULT_SOURCE $H5_CPPFLAGS" ;; esac @@ -1531,8 +1491,7 @@ AC_CACHE_SAVE AC_MSG_CHECKING([for thread safe support]) AC_ARG_ENABLE([threadsafe], [AS_HELP_STRING([--enable-threadsafe], - [Enable thread-safe capability. This will disable the high-level library. - You can override this behavior by specifying --enable-hl and --enable-unsupported. + [Enable thread-safe capability. Not compatible with the high-level library, Fortran, or C++ wrappers. [default=no]])], [THREADSAFE=$enableval]) @@ -1540,6 +1499,17 @@ AC_ARG_ENABLE([threadsafe], ## with the thread-safety option because the lock is not hoisted ## into the higher-level API calls. +## --enable-threadsafe is incompatible with --enable-hl unless +## --enable-unsupported has been specified on the configure line. +## +## Note that the high-level library is enabled by default so most +## users will have to add --disable-hl to the configure options. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${HDF5_HL}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then + AC_MSG_ERROR([The thread-safe library is incompatible with the high-level library. --disable-hl can be used to prevent building the high-level library (recommended). Alternatively, --enable-unsupported will allow building the high-level library, though this configuration is not supported by The HDF Group.]) + fi +fi + ## The --enable-threadsafe flag is not compatible with --enable-cxx. ## If the user tried to specify both flags, throw an error, unless ## they also provided the --enable-unsupported flag. @@ -1682,7 +1652,7 @@ fi ## ---------------------------------------------------------------------- ## Check for MONOTONIC_TIMER support (used in clock_gettime). This has -## to be done after any POSIX/BSD defines to ensure that the test gets +## to be done after any POSIX defines to ensure that the test gets ## the correct POSIX level on linux. AC_CHECK_DECL([CLOCK_MONOTONIC],[have_clock_monotonic="yes"],[have_clock_monotonic="no"],[[#include <time.h>]]) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index d97e625..dc884d5 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -66,19 +66,18 @@ set_target_properties (H5_buildiface PROPERTIES if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) if (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE}) else (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - endif (WIN32) -else (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - if (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE}) - else (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) endif (WIN32) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (WIN32) + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE}) +else (WIN32) + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) +endif (WIN32) -INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) +INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) #----------------------------------------------------------------------------- add_executable (H5match_types @@ -292,11 +291,42 @@ install ( FILES ${mod_files} DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR} + ${HDF5_INSTALL_INCLUDE_DIR}/static COMPONENT fortheaders ) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + set (modsh_files + ${MODSH_BUILD_DIR}/h5fortran_types.mod + ${MODSH_BUILD_DIR}/hdf5.mod + ${MODSH_BUILD_DIR}/h5global.mod + ${MODSH_BUILD_DIR}/h5a.mod + ${MODSH_BUILD_DIR}/h5d.mod + ${MODSH_BUILD_DIR}/h5e.mod + ${MODSH_BUILD_DIR}/h5f.mod + ${MODSH_BUILD_DIR}/h5g.mod + ${MODSH_BUILD_DIR}/h5i.mod + ${MODSH_BUILD_DIR}/h5l.mod + ${MODSH_BUILD_DIR}/h5lib.mod + ${MODSH_BUILD_DIR}/h5o.mod + ${MODSH_BUILD_DIR}/h5p.mod + ${MODSH_BUILD_DIR}/h5r.mod + ${MODSH_BUILD_DIR}/h5s.mod + ${MODSH_BUILD_DIR}/h5t.mod + ${MODSH_BUILD_DIR}/h5z.mod + ${MODSH_BUILD_DIR}/h5_gen.mod + ) + install ( + FILES + ${modsh_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/shared + COMPONENT + fortheaders + ) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 6acdbde..957a76d 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -726,7 +726,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 220 +LT_VERS_REVISION = 221 LT_VERS_AGE = 0 AM_FCLIBS = $(LIBHDF5) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 692cc4d..0cbd17f 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -7,6 +7,42 @@ PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) #----------------------------------------------------------------------------- +# Setup the Fortran auto-detection utilities +# H5_test_buildiface.F90 used to generate various KIND test interfaces +#----------------------------------------------------------------------------- + +add_executable (H5_test_buildiface + ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90 + ) + +if (WIN32 AND MSVC) + if (BUILD_SHARED_LIBS) + set_target_properties (H5_test_buildiface + PROPERTIES + COMPILE_FLAGS "/MT" + ) + endif (BUILD_SHARED_LIBS) + set_target_properties (H5_test_buildiface + PROPERTIES + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) +endif (WIN32 AND MSVC) +set_target_properties (H5_test_buildiface PROPERTIES + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} +) + +if (NOT SKIP_HDF5_FORTRAN_SHARED) + if (WIN32) + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE}) + else (WIN32) + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + endif (WIN32) +endif (NOT SKIP_HDF5_FORTRAN_SHARED) + +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) + +#----------------------------------------------------------------------------- # Add Test Lib #----------------------------------------------------------------------------- add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) @@ -39,10 +75,27 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -set_source_files_properties (tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90 PROPERTIES LANGUAGE Fortran) -add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90) +set (HDF5_F90_TF_SRCS + # generated files + ${HDF5_F90_BINARY_DIR}/tf_gen.F90 +) +set_source_files_properties ( + ${HDF5_F90_BINARY_DIR}/tf_gen.F90 + PROPERTIES GENERATED TRUE +) +set_source_files_properties (tf.F90 ${HDF5_F90_BINARY_DIR}/${HDF5_F90_TF_SRCS} PROPERTIES LANGUAGE Fortran) + +set (CMD $<TARGET_FILE:H5_test_buildiface>) +add_custom_target (H5testgen ALL + COMMAND ${CMD} +#v3.2 BYPRODUCT ${HDF5_F90_BINARY_DIR}/tf_gen.F90 + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} + DEPENDS H5_test_buildiface +) + +add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC tf.F90 ${HDF5_F90_TF_SRCS}) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90) + add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED tf.F90 ${HDF5_F90_TF_SRCS}) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC " " " ") @@ -93,40 +146,6 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #----------------------------------------------------------------------------- -# Setup the Fortran auto-detection utilities -# H5_test_buildiface.F90 used to generate various KIND test interfaces -#----------------------------------------------------------------------------- - -add_executable (H5_test_buildiface - ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90 - ) - -if (WIN32 AND MSVC) - if (BUILD_SHARED_LIBS) - set_target_properties (H5_test_buildiface - PROPERTIES - COMPILE_FLAGS "/MT" - ) - endif (BUILD_SHARED_LIBS) - set_target_properties (H5_test_buildiface - PROPERTIES - LINK_FLAGS "/SUBSYSTEM:CONSOLE" - ) -endif (WIN32 AND MSVC) -set_target_properties (H5_test_buildiface PROPERTIES - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} -) - -set (CMD $<TARGET_FILE:H5_test_buildiface>) -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/tf_gen.F90 - COMMAND ${CMD} - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} - DEPENDS H5_test_buildiface -) - -#----------------------------------------------------------------------------- # Add Tests #----------------------------------------------------------------------------- @@ -164,6 +183,8 @@ set_target_properties (testhdf5_fortran PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) +add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (testhdf5_fortran-shared fortranlib_test.F90 @@ -198,6 +219,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) + add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for testhdf5_fortran_1_8 @@ -225,6 +247,8 @@ set_target_properties (testhdf5_fortran_1_8 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) +add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (testhdf5_fortran_1_8-shared fortranlib_test_1_8.F90 @@ -250,6 +274,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) + add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for fortranlib_test_F03 @@ -279,6 +304,8 @@ set_target_properties (fortranlib_test_F03 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) +add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (fortranlib_test_F03-shared fortranlib_test_F03.F90 @@ -305,7 +332,8 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared -) + ) + add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for fflush1 @@ -326,6 +354,8 @@ set_target_properties (fflush1 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) +add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (fflush1-shared fflush1.F90) TARGET_NAMING (fflush1-shared SHARED) @@ -344,6 +374,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) + add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for fflush2 @@ -364,6 +395,8 @@ set_target_properties (fflush2 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) +add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (fflush2-shared fflush2.F90) TARGET_NAMING (fflush2-shared SHARED) @@ -382,6 +415,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) + add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) include (CMakeTests.cmake) diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index c12233c..60f9f53 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -43,11 +43,6 @@ check_PROGRAMS=$(TEST_PROG) libh5test_fortran_la_SOURCES = tf_gen.F90 tf.F90 t.c -# Source files are used for both the library and fortranlib_test. -# Automake will complain about this without the following workaround. -fortranlib_test_FCFLAGS=$(AM_FCFLAGS) -fortranlib_test_CFLAGS=$(AM_CFLAGS) - fortranlib_test_SOURCES = tH5F.F90 tH5D.F90 tH5R.F90 tH5S.F90 tH5T.F90 tH5VL.F90 tH5Z.F90 \ tH5Sselect.F90 tH5P.F90 tH5A.F90 tH5I.F90 tH5G.F90 tH5E.F90 tHDF5.F90 fortranlib_test.F90 diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index d51b42f..38aacf2 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -132,23 +132,15 @@ fflush2_OBJECTS = $(am_fflush2_OBJECTS) fflush2_LDADD = $(LDADD) fflush2_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) $(LIBH5F) \ $(LIBHDF5) -am_fortranlib_test_OBJECTS = fortranlib_test-tH5F.$(OBJEXT) \ - fortranlib_test-tH5D.$(OBJEXT) fortranlib_test-tH5R.$(OBJEXT) \ - fortranlib_test-tH5S.$(OBJEXT) fortranlib_test-tH5T.$(OBJEXT) \ - fortranlib_test-tH5VL.$(OBJEXT) fortranlib_test-tH5Z.$(OBJEXT) \ - fortranlib_test-tH5Sselect.$(OBJEXT) \ - fortranlib_test-tH5P.$(OBJEXT) fortranlib_test-tH5A.$(OBJEXT) \ - fortranlib_test-tH5I.$(OBJEXT) fortranlib_test-tH5G.$(OBJEXT) \ - fortranlib_test-tH5E.$(OBJEXT) fortranlib_test-tHDF5.$(OBJEXT) \ - fortranlib_test-fortranlib_test.$(OBJEXT) +am_fortranlib_test_OBJECTS = tH5F.$(OBJEXT) tH5D.$(OBJEXT) \ + tH5R.$(OBJEXT) tH5S.$(OBJEXT) tH5T.$(OBJEXT) tH5VL.$(OBJEXT) \ + tH5Z.$(OBJEXT) tH5Sselect.$(OBJEXT) tH5P.$(OBJEXT) \ + tH5A.$(OBJEXT) tH5I.$(OBJEXT) tH5G.$(OBJEXT) tH5E.$(OBJEXT) \ + tHDF5.$(OBJEXT) fortranlib_test.$(OBJEXT) fortranlib_test_OBJECTS = $(am_fortranlib_test_OBJECTS) fortranlib_test_LDADD = $(LDADD) fortranlib_test_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) \ $(LIBH5F) $(LIBHDF5) -fortranlib_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(FCLD) \ - $(fortranlib_test_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ am_fortranlib_test_1_8_OBJECTS = tH5O.$(OBJEXT) tH5A_1_8.$(OBJEXT) \ tH5G_1_8.$(OBJEXT) tH5MISC_1_8.$(OBJEXT) tHDF5_1_8.$(OBJEXT) \ fortranlib_test_1_8.$(OBJEXT) @@ -741,11 +733,6 @@ noinst_LTLIBRARIES = libh5test_fortran.la # Our main targets, the tests themselves TEST_PROG = fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 libh5test_fortran_la_SOURCES = tf_gen.F90 tf.F90 t.c - -# Source files are used for both the library and fortranlib_test. -# Automake will complain about this without the following workaround. -fortranlib_test_FCFLAGS = $(AM_FCFLAGS) -fortranlib_test_CFLAGS = $(AM_CFLAGS) fortranlib_test_SOURCES = tH5F.F90 tH5D.F90 tH5R.F90 tH5S.F90 tH5T.F90 tH5VL.F90 tH5Z.F90 \ tH5Sselect.F90 tH5P.F90 tH5A.F90 tH5I.F90 tH5G.F90 tH5E.F90 tHDF5.F90 fortranlib_test.F90 @@ -877,7 +864,7 @@ fflush2$(EXEEXT): $(fflush2_OBJECTS) $(fflush2_DEPENDENCIES) $(EXTRA_fflush2_DEP fortranlib_test$(EXEEXT): $(fortranlib_test_OBJECTS) $(fortranlib_test_DEPENDENCIES) $(EXTRA_fortranlib_test_DEPENDENCIES) @rm -f fortranlib_test$(EXEEXT) - $(AM_V_FCLD)$(fortranlib_test_LINK) $(fortranlib_test_OBJECTS) $(fortranlib_test_LDADD) $(LIBS) + $(AM_V_FCLD)$(FCLINK) $(fortranlib_test_OBJECTS) $(fortranlib_test_LDADD) $(LIBS) fortranlib_test_1_8$(EXEEXT): $(fortranlib_test_1_8_OBJECTS) $(fortranlib_test_1_8_DEPENDENCIES) $(EXTRA_fortranlib_test_1_8_DEPENDENCIES) @rm -f fortranlib_test_1_8$(EXEEXT) @@ -901,96 +888,6 @@ distclean-compile: .F90.lo: $(AM_V_PPFC)$(LTPPFCCOMPILE) -c -o $@ $< -fortranlib_test-tH5F.o: tH5F.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5F.o `test -f 'tH5F.F90' || echo '$(srcdir)/'`tH5F.F90 - -fortranlib_test-tH5F.obj: tH5F.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5F.obj `if test -f 'tH5F.F90'; then $(CYGPATH_W) 'tH5F.F90'; else $(CYGPATH_W) '$(srcdir)/tH5F.F90'; fi` - -fortranlib_test-tH5D.o: tH5D.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5D.o `test -f 'tH5D.F90' || echo '$(srcdir)/'`tH5D.F90 - -fortranlib_test-tH5D.obj: tH5D.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5D.obj `if test -f 'tH5D.F90'; then $(CYGPATH_W) 'tH5D.F90'; else $(CYGPATH_W) '$(srcdir)/tH5D.F90'; fi` - -fortranlib_test-tH5R.o: tH5R.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5R.o `test -f 'tH5R.F90' || echo '$(srcdir)/'`tH5R.F90 - -fortranlib_test-tH5R.obj: tH5R.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5R.obj `if test -f 'tH5R.F90'; then $(CYGPATH_W) 'tH5R.F90'; else $(CYGPATH_W) '$(srcdir)/tH5R.F90'; fi` - -fortranlib_test-tH5S.o: tH5S.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5S.o `test -f 'tH5S.F90' || echo '$(srcdir)/'`tH5S.F90 - -fortranlib_test-tH5S.obj: tH5S.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5S.obj `if test -f 'tH5S.F90'; then $(CYGPATH_W) 'tH5S.F90'; else $(CYGPATH_W) '$(srcdir)/tH5S.F90'; fi` - -fortranlib_test-tH5T.o: tH5T.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5T.o `test -f 'tH5T.F90' || echo '$(srcdir)/'`tH5T.F90 - -fortranlib_test-tH5T.obj: tH5T.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5T.obj `if test -f 'tH5T.F90'; then $(CYGPATH_W) 'tH5T.F90'; else $(CYGPATH_W) '$(srcdir)/tH5T.F90'; fi` - -fortranlib_test-tH5VL.o: tH5VL.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5VL.o `test -f 'tH5VL.F90' || echo '$(srcdir)/'`tH5VL.F90 - -fortranlib_test-tH5VL.obj: tH5VL.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5VL.obj `if test -f 'tH5VL.F90'; then $(CYGPATH_W) 'tH5VL.F90'; else $(CYGPATH_W) '$(srcdir)/tH5VL.F90'; fi` - -fortranlib_test-tH5Z.o: tH5Z.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5Z.o `test -f 'tH5Z.F90' || echo '$(srcdir)/'`tH5Z.F90 - -fortranlib_test-tH5Z.obj: tH5Z.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5Z.obj `if test -f 'tH5Z.F90'; then $(CYGPATH_W) 'tH5Z.F90'; else $(CYGPATH_W) '$(srcdir)/tH5Z.F90'; fi` - -fortranlib_test-tH5Sselect.o: tH5Sselect.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5Sselect.o `test -f 'tH5Sselect.F90' || echo '$(srcdir)/'`tH5Sselect.F90 - -fortranlib_test-tH5Sselect.obj: tH5Sselect.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5Sselect.obj `if test -f 'tH5Sselect.F90'; then $(CYGPATH_W) 'tH5Sselect.F90'; else $(CYGPATH_W) '$(srcdir)/tH5Sselect.F90'; fi` - -fortranlib_test-tH5P.o: tH5P.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5P.o `test -f 'tH5P.F90' || echo '$(srcdir)/'`tH5P.F90 - -fortranlib_test-tH5P.obj: tH5P.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5P.obj `if test -f 'tH5P.F90'; then $(CYGPATH_W) 'tH5P.F90'; else $(CYGPATH_W) '$(srcdir)/tH5P.F90'; fi` - -fortranlib_test-tH5A.o: tH5A.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5A.o `test -f 'tH5A.F90' || echo '$(srcdir)/'`tH5A.F90 - -fortranlib_test-tH5A.obj: tH5A.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5A.obj `if test -f 'tH5A.F90'; then $(CYGPATH_W) 'tH5A.F90'; else $(CYGPATH_W) '$(srcdir)/tH5A.F90'; fi` - -fortranlib_test-tH5I.o: tH5I.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5I.o `test -f 'tH5I.F90' || echo '$(srcdir)/'`tH5I.F90 - -fortranlib_test-tH5I.obj: tH5I.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5I.obj `if test -f 'tH5I.F90'; then $(CYGPATH_W) 'tH5I.F90'; else $(CYGPATH_W) '$(srcdir)/tH5I.F90'; fi` - -fortranlib_test-tH5G.o: tH5G.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5G.o `test -f 'tH5G.F90' || echo '$(srcdir)/'`tH5G.F90 - -fortranlib_test-tH5G.obj: tH5G.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5G.obj `if test -f 'tH5G.F90'; then $(CYGPATH_W) 'tH5G.F90'; else $(CYGPATH_W) '$(srcdir)/tH5G.F90'; fi` - -fortranlib_test-tH5E.o: tH5E.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5E.o `test -f 'tH5E.F90' || echo '$(srcdir)/'`tH5E.F90 - -fortranlib_test-tH5E.obj: tH5E.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tH5E.obj `if test -f 'tH5E.F90'; then $(CYGPATH_W) 'tH5E.F90'; else $(CYGPATH_W) '$(srcdir)/tH5E.F90'; fi` - -fortranlib_test-tHDF5.o: tHDF5.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tHDF5.o `test -f 'tHDF5.F90' || echo '$(srcdir)/'`tHDF5.F90 - -fortranlib_test-tHDF5.obj: tHDF5.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-tHDF5.obj `if test -f 'tHDF5.F90'; then $(CYGPATH_W) 'tHDF5.F90'; else $(CYGPATH_W) '$(srcdir)/tHDF5.F90'; fi` - -fortranlib_test-fortranlib_test.o: fortranlib_test.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-fortranlib_test.o `test -f 'fortranlib_test.F90' || echo '$(srcdir)/'`fortranlib_test.F90 - -fortranlib_test-fortranlib_test.obj: fortranlib_test.F90 - $(AM_V_PPFC)$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fortranlib_test_FCFLAGS) $(FCFLAGS) -c -o fortranlib_test-fortranlib_test.obj `if test -f 'fortranlib_test.F90'; then $(CYGPATH_W) 'fortranlib_test.F90'; else $(CYGPATH_W) '$(srcdir)/fortranlib_test.F90'; fi` - .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90 index c3e995b..2f88c45 100644 --- a/fortran/test/fortranlib_test.F90 +++ b/fortran/test/fortranlib_test.F90 @@ -24,6 +24,8 @@ ! !***** +!#include <H5config_f.inc> + PROGRAM fortranlibtest USE HDF5 diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 905e821..84694ac 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -681,7 +681,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 220 +LT_VERS_REVISION = 221 LT_VERS_AGE = 0 # This is our main target diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 5df4e1d..ead21be 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -38,17 +38,16 @@ set_target_properties (H5HL_buildiface PROPERTIES if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) if (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE}) else (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - endif (WIN32) -else (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - if (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE}) - else (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) endif (WIN32) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (WIN32) + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE}) +else (WIN32) + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) +endif (WIN32) #----------------------------------------------------------------------------- # Setup include Directories @@ -198,11 +197,30 @@ install ( FILES ${mod_files} DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR} + ${HDF5_INSTALL_INCLUDE_DIR}/static COMPONENT fortheaders ) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + set (modsh_files + ${MODSH_BUILD_DIR}/h5ds.mod + ${MODSH_BUILD_DIR}/h5tb.mod + ${MODSH_BUILD_DIR}/h5tb_const.mod + ${MODSH_BUILD_DIR}/h5lt.mod + ${MODSH_BUILD_DIR}/h5lt_const.mod + ${MODSH_BUILD_DIR}/h5im.mod + ) + install ( + FILES + ${modsh_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/shared + COMPONENT + fortheaders + ) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- diff --git a/hl/fortran/src/H5HL_buildiface.F90 b/hl/fortran/src/H5HL_buildiface.F90 index 0e85e27..9dd879c 100644 --- a/hl/fortran/src/H5HL_buildiface.F90 +++ b/hl/fortran/src/H5HL_buildiface.F90 @@ -83,13 +83,13 @@ PROGRAM H5HL_buildiface /) ! pointer to the buffer CHARACTER(LEN=37), DIMENSION(1:8), PARAMETER :: f_ptr_line=(/ & - ' f_ptr = C_LOC(buf) ', & - ' f_ptr = C_LOC(buf(1)) ', & - ' f_ptr = C_LOC(buf(1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1,1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1,1,1,1)) ', & + ' f_ptr = C_LOC(buf )', & + ' f_ptr = C_LOC(buf(1) )', & + ' f_ptr = C_LOC(buf(1,1) )', & + ' f_ptr = C_LOC(buf(1,1,1) )', & + ' f_ptr = C_LOC(buf(1,1,1,1) )', & + ' f_ptr = C_LOC(buf(1,1,1,1,1) )', & + ' f_ptr = C_LOC(buf(1,1,1,1,1,1) )', & ' f_ptr = C_LOC(buf(1,1,1,1,1,1,1))' & /) @@ -154,6 +154,13 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') " MODULE PROCEDURE h5ltmake_dataset_real_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(A)') " MODULE PROCEDURE h5ltmake_dataset_integer_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO WRITE(11,'(A)') " END INTERFACE" ! h5ltread_dataset_f @@ -165,6 +172,35 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') " MODULE PROCEDURE h5ltread_dataset_real_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(A)') " MODULE PROCEDURE h5ltread_dataset_integer_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + WRITE(11,'(A)') " END INTERFACE" + +! h5ltread_dataset_int_f + WRITE(11,'(A)') " INTERFACE h5ltread_dataset_int_f" + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(A)') " MODULE PROCEDURE h5ltread_dataset_int_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + WRITE(11,'(A)') " END INTERFACE" + +! h5ltmake_dataset_int_f + WRITE(11,'(A)') " INTERFACE h5ltmake_dataset_int_f" + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(A)') " MODULE PROCEDURE h5ltmake_dataset_int_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO WRITE(11,'(A)') " END INTERFACE" ! h5ltmake_dataset_float_f @@ -346,7 +382,6 @@ PROGRAM H5HL_buildiface k = rkind(i) WRITE(chr2,'(I2)') k DO j = 1, 8 - ! DLL definitions for windows WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)' WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltmake_dataset_double_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) @@ -402,6 +437,134 @@ PROGRAM H5HL_buildiface ENDDO ENDDO +! h5ltmake_dataset_f + DO i = 1, num_ikinds + k = ikind(i) + WRITE(chr2,'(I2)') k + DO j = 1, 8 + +! DLL definitions for windows + WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)' + WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltmake_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) + WRITE(11,'(A)') '!DEC$endif' + +! Subroutine API + WRITE(11,'(A)') ' SUBROUTINE h5ltmake_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))& + &//'_rank'//chr_rank(j)//'(loc_id,dset_name,rank,dims,type_id,buf,errcode)' + WRITE(11,'(A)') ' IMPLICIT NONE' + WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id' + WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' + WRITE(11,'(A)') ' INTEGER, INTENT(IN) :: rank' + WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' + WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id' + WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' INTEGER :: errcode ' + WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' + WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' + + WRITE(11,'(A)') f_ptr_line(j) + WRITE(11,'(A)') ' namelen = LEN(dset_name)' + WRITE(11,'(A)') ' errcode = h5ltmake_dataset_c(loc_id, namelen, dset_name, rank, dims, type_id, f_ptr)' + WRITE(11,'(A)') ' END SUBROUTINE h5ltmake_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) + ENDDO + ENDDO + +! h5ltmake_dataset_int_f + DO i = 1, num_ikinds + k = ikind(i) + WRITE(chr2,'(I2)') k + DO j = 1, 8 + +! DLL definitions for windows + WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)' + WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltmake_dataset_int_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) + WRITE(11,'(A)') '!DEC$endif' + +! Subroutine API + WRITE(11,'(A)') ' SUBROUTINE h5ltmake_dataset_int_kind_'//TRIM(ADJUSTL(chr2))& + &//'_rank'//chr_rank(j)//'(loc_id,dset_name,rank,dims,buf,errcode)' + WRITE(11,'(A)') ' IMPLICIT NONE' + WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id' + WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' + WRITE(11,'(A)') ' INTEGER, INTENT(IN) :: rank' + WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' + WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' INTEGER :: errcode ' + WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' + WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' + WRITE(11,'(A)') ' INTEGER(hid_t) :: type_id' + + WRITE(11,'(A)') f_ptr_line(j) + WRITE(11,'(A)') ' namelen = LEN(dset_name)' + WRITE(11,'(A)') ' type_id = h5kind_to_type(KIND('//f_ptr_line(j)(19:36)//'), H5_INTEGER_KIND)' + WRITE(11,'(A)') ' errcode = h5ltmake_dataset_c(loc_id, namelen, dset_name, rank, dims, type_id, f_ptr)' + WRITE(11,'(A)') ' END SUBROUTINE h5ltmake_dataset_int_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) + ENDDO + ENDDO + +! h5ltread_dataset_f + DO i = 1, num_ikinds + k = ikind(i) + WRITE(chr2,'(I2)') k + DO j = 1, 8 + +! DLL definitions for windows + WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)' + WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltread_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) + WRITE(11,'(A)') '!DEC$endif' + +! Subroutine API + WRITE(11,'(A)') ' SUBROUTINE h5ltread_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))& + &//'_rank'//chr_rank(j)//'(loc_id,dset_name, type_id, buf,dims,errcode)' + WRITE(11,'(A)') ' IMPLICIT NONE' + WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id' + WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' + WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' + WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id' + WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' INTEGER :: errcode ' + WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' + WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' + + WRITE(11,'(A)') f_ptr_line(j) + WRITE(11,'(A)') ' namelen = LEN(dset_name)' + WRITE(11,'(A)') ' errcode = h5ltread_dataset_c(loc_id, namelen, dset_name, type_id, f_ptr)' + WRITE(11,'(A)') ' END SUBROUTINE h5ltread_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) + ENDDO + ENDDO + +! h5ltread_dataset_int_f + DO i = 1, num_ikinds + k = ikind(i) + WRITE(chr2,'(I2)') k + DO j = 1, 8 + +! DLL definitions for windows + WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)' + WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltread_dataset_int_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) + WRITE(11,'(A)') '!DEC$endif' + +! Subroutine API + WRITE(11,'(A)') ' SUBROUTINE h5ltread_dataset_int_kind_'//TRIM(ADJUSTL(chr2))& + &//'_rank'//chr_rank(j)//'(loc_id,dset_name, buf,dims,errcode)' + WRITE(11,'(A)') ' IMPLICIT NONE' + WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id' + WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' + WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' + WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' INTEGER :: errcode ' + WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' + WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' + WRITE(11,'(A)') ' INTEGER(hid_t) :: type_id' + + WRITE(11,'(A)') f_ptr_line(j) + WRITE(11,'(A)') ' namelen = LEN(dset_name)' + WRITE(11,'(A)') ' type_id = h5kind_to_type(KIND('//f_ptr_line(j)(19:36)//'), H5_INTEGER_KIND)' + WRITE(11,'(A)') ' errcode = h5ltread_dataset_c(loc_id, namelen, dset_name, type_id, f_ptr)' + WRITE(11,'(A)') ' END SUBROUTINE h5ltread_dataset_int_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j) + ENDDO + ENDDO + WRITE(11,'(A)') 'END MODULE H5LT' ! change this to be generic MSB CLOSE(11) diff --git a/hl/fortran/src/H5LTff.F90 b/hl/fortran/src/H5LTff.F90 index ffc7ab5..d36d92c 100644 --- a/hl/fortran/src/H5LTff.F90 +++ b/hl/fortran/src/H5LTff.F90 @@ -38,47 +38,13 @@ MODULE H5LT_CONST USE hdf5 INTERFACE h5ltmake_dataset_f - MODULE PROCEDURE h5ltmake_dataset_f_int1 - MODULE PROCEDURE h5ltmake_dataset_f_int2 - MODULE PROCEDURE h5ltmake_dataset_f_int3 - MODULE PROCEDURE h5ltmake_dataset_f_int4 - MODULE PROCEDURE h5ltmake_dataset_f_int5 - MODULE PROCEDURE h5ltmake_dataset_f_int6 - MODULE PROCEDURE h5ltmake_dataset_f_int7 MODULE PROCEDURE h5ltmake_dataset_f_ptr END INTERFACE INTERFACE h5ltread_dataset_f - MODULE PROCEDURE h5ltread_dataset_f_int1 - MODULE PROCEDURE h5ltread_dataset_f_int2 - MODULE PROCEDURE h5ltread_dataset_f_int3 - MODULE PROCEDURE h5ltread_dataset_f_int4 - MODULE PROCEDURE h5ltread_dataset_f_int5 - MODULE PROCEDURE h5ltread_dataset_f_int6 - MODULE PROCEDURE h5ltread_dataset_f_int7 MODULE PROCEDURE h5ltread_dataset_f_ptr END INTERFACE - INTERFACE h5ltmake_dataset_int_f - MODULE PROCEDURE h5ltmake_dataset_int_f_1 - MODULE PROCEDURE h5ltmake_dataset_int_f_2 - MODULE PROCEDURE h5ltmake_dataset_int_f_3 - MODULE PROCEDURE h5ltmake_dataset_int_f_4 - MODULE PROCEDURE h5ltmake_dataset_int_f_5 - MODULE PROCEDURE h5ltmake_dataset_int_f_6 - MODULE PROCEDURE h5ltmake_dataset_int_f_7 - END INTERFACE - - INTERFACE h5ltread_dataset_int_f - MODULE PROCEDURE h5ltread_dataset_int_f_1 - MODULE PROCEDURE h5ltread_dataset_int_f_2 - MODULE PROCEDURE h5ltread_dataset_int_f_3 - MODULE PROCEDURE h5ltread_dataset_int_f_4 - MODULE PROCEDURE h5ltread_dataset_int_f_5 - MODULE PROCEDURE h5ltread_dataset_int_f_6 - MODULE PROCEDURE h5ltread_dataset_int_f_7 - END INTERFACE - INTERFACE INTEGER FUNCTION h5ltmake_dataset_c(loc_id,namelen,dset_name,rank,dims,type_id,buf) & BIND(C,NAME='h5ltmake_dataset_c') diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index c1c0721..85e5d42 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -709,7 +709,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 220 +LT_VERS_REVISION = 221 LT_VERS_AGE = 0 # Our main target, the high-level fortran library diff --git a/hl/fortran/test/tstlite.F90 b/hl/fortran/test/tstlite.F90 index 0eb005b..0ba7815 100644 --- a/hl/fortran/test/tstlite.F90 +++ b/hl/fortran/test/tstlite.F90 @@ -19,7 +19,7 @@ #include <H5config_f.inc> PROGRAM lite_test - + CALL test_dataset1D() CALL test_dataset2D() CALL test_dataset3D() @@ -38,149 +38,148 @@ END PROGRAM lite_test !------------------------------------------------------------------------- SUBROUTINE test_dataset1D() + + USE, INTRINSIC :: ISO_C_BINDING + USE H5LT ! module of H5LT + USE HDF5 ! module of HDF5 library + + IMPLICIT NONE + + INTEGER, PARAMETER :: DIM1 = 4 ! Dimension of array + CHARACTER(len=9), PARAMETER :: filename = "dsetf1.h5"! File name + CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions + INTEGER :: rank = 1 ! Dataset rank + INTEGER, DIMENSION(DIM1) :: buf1 ! Data buffer + INTEGER, DIMENSION(DIM1) :: bufr1 ! Data buffer + REAL, DIMENSION(DIM1) :: buf2 ! Data buffer + REAL, DIMENSION(DIM1) :: bufr2 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr3 ! Data buffer + INTEGER :: errcode ! Error flag + INTEGER :: i ! general purpose integer + TYPE(C_PTR) :: f_ptr + integer(HID_T) :: mytype -USE, INTRINSIC :: ISO_C_BINDING -USE H5LT ! module of H5LT -USE HDF5 ! module of HDF5 library - -IMPLICIT NONE - -INTEGER, PARAMETER :: DIM1 = 4; ! Dimension of array -CHARACTER(len=9), PARAMETER :: filename = "dsetf1.h5"! File name -CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name -CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name -CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name -INTEGER(HID_T) :: file_id ! File identifier -INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions -INTEGER :: rank = 1 ! Dataset rank -INTEGER, DIMENSION(DIM1) :: buf1 ! Data buffer -INTEGER, DIMENSION(DIM1) :: bufr1 ! Data buffer -REAL, DIMENSION(DIM1) :: buf2 ! Data buffer -REAL, DIMENSION(DIM1) :: bufr2 ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr3 ! Data buffer -INTEGER :: errcode ! Error flag -INTEGER :: i ! general purpose integer -TYPE(C_PTR) :: f_ptr -integer(HID_T) :: mytype - -CALL test_begin(' Make/Read datasets (1D) ') - -! -! Initialize the data array. -! -DO i = 1, DIM1 - buf1(i) = i; - buf2(i) = i; - buf3(i) = i; -END DO + CALL test_begin(' Make/Read datasets (1D) ') -! -! Initialize FORTRAN predefined datatypes. -! -CALL h5open_f(errcode) + ! + ! Initialize the data array. + ! + DO i = 1, DIM1 + buf1(i) = i + buf2(i) = i + buf3(i) = i + END DO -! -! Create a new file using default properties. -! -CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode) + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5open_f(errcode) -!------------------------------------------------------------------------- -! H5T_NATIVE_INTEGER -!------------------------------------------------------------------------- + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode) -! -! write dataset. -! -CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf1, errcode) + !------------------------------------------------------------------------- + ! H5T_NATIVE_INTEGER + !------------------------------------------------------------------------- -! -! read dataset. -! -CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr1, dims, errcode) + ! + ! write dataset. + ! + CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf1, errcode) + ! + ! read dataset. + ! + CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr1, dims, errcode) -! -! compare read and write buffers. -! -DO i = 1, DIM1 - IF ( buf1(i) .NE. bufr1(i) ) THEN - PRINT *, 'read buffer differs from write buffer (I)' - PRINT *, bufr1(i), ' and ', buf1(i) - STOP - ENDIF -END DO + ! + ! compare read and write buffers. + ! + DO i = 1, DIM1 + IF ( buf1(i) .NE. bufr1(i) ) THEN + PRINT *, 'read buffer differs from write buffer (I)' + PRINT *, bufr1(i), ' and ', buf1(i) + STOP + ENDIF + END DO -!------------------------------------------------------------------------- -! H5T_NATIVE_REAL -!------------------------------------------------------------------------- + !------------------------------------------------------------------------- + ! H5T_NATIVE_REAL + !------------------------------------------------------------------------- -! -! write dataset. -! -CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_REAL, buf2, errcode) + ! + ! write dataset. + ! + CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_REAL, buf2, errcode) -! -! read dataset. -! -CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_REAL, bufr2, dims, errcode) + ! + ! read dataset. + ! + CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_REAL, bufr2, dims, errcode) -! -! compare read and write buffers. -! -DO i = 1, DIM1 - IF ( buf2(i) .NE. bufr2(i) ) THEN - PRINT *, 'read buffer differs from write buffer (R)' - PRINT *, bufr2(i), ' and ', buf2(i) - STOP - ENDIF -END DO + ! + ! compare read and write buffers. + ! + DO i = 1, DIM1 + IF ( buf2(i) .NE. bufr2(i) ) THEN + PRINT *, 'read buffer differs from write buffer (R)' + PRINT *, bufr2(i), ' and ', buf2(i) + STOP + ENDIF + END DO -!------------------------------------------------------------------------- -! H5T_NATIVE_DOUBLE -!------------------------------------------------------------------------- + !------------------------------------------------------------------------- + ! H5T_NATIVE_DOUBLE + !------------------------------------------------------------------------- -! -! write dataset. -! -f_ptr = C_LOC(buf3(1)) -mytype = h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND) -CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, & - mytype, f_ptr, errcode) -!CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_DOUBLE, buf3, errcode) -! h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND) -! -! read dataset. -! -f_ptr = C_LOC(bufr3(1)) -CALL h5ltread_dataset_f(file_id, dsetname3, & - h5kind_to_type(KIND(bufr3(1)), H5_REAL_KIND), f_ptr, errcode) -!CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_DOUBLE, bufr3, dims, errcode) + ! + ! write dataset. + ! + f_ptr = C_LOC(buf3(1)) + mytype = h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND) + CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, & + mytype, f_ptr, errcode) + !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_DOUBLE, buf3, errcode) + ! h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND) + ! + ! read dataset. + ! + f_ptr = C_LOC(bufr3(1)) + CALL h5ltread_dataset_f(file_id, dsetname3, & + h5kind_to_type(KIND(bufr3(1)), H5_REAL_KIND), f_ptr, errcode) + !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_DOUBLE, bufr3, dims, errcode) -! -! compare read and write buffers. -! -DO i = 1, DIM1 - IF ( buf3(i) .NE. bufr3(i) ) THEN - PRINT *, 'read buffer differs from write buffer (D)' - PRINT *, bufr3(i), ' and ', buf3(i) - STOP - ENDIF -END DO + ! + ! compare read and write buffers. + ! + DO i = 1, DIM1 + IF ( buf3(i) .NE. bufr3(i) ) THEN + PRINT *, 'read buffer differs from write buffer (D)' + PRINT *, bufr3(i), ' and ', buf3(i) + STOP + ENDIF + END DO -! -! Close the file. -! -CALL h5fclose_f(file_id, errcode) + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, errcode) -! -! Close FORTRAN predefined datatypes. -! -CALL h5close_f(errcode) + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_f(errcode) -CALL passed() -! -! end function. -! + CALL passed() + ! + ! end function. + ! END SUBROUTINE test_dataset1D !------------------------------------------------------------------------- @@ -189,194 +188,193 @@ END SUBROUTINE test_dataset1D SUBROUTINE test_dataset2D() -USE, INTRINSIC :: ISO_C_BINDING -USE H5LT ! module of H5LT -USE HDF5 ! module of HDF5 library - -IMPLICIT NONE - - -INTEGER(HSIZE_T), PARAMETER :: DIM1 = 4; ! columns -INTEGER(HSIZE_T), PARAMETER :: DIM2 = 6; ! rows -CHARACTER(len=9), PARAMETER :: filename = "dsetf2.h5"! File name -CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name -CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name -CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name -CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name -INTEGER(HID_T) :: file_id ! File identifier -INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions -INTEGER :: rank = 2 ! Dataset rank -INTEGER, DIMENSION(DIM1*DIM2) :: buf ! Data buffer -INTEGER, DIMENSION(DIM1*DIM2) :: bufr ! Data buffer -INTEGER, DIMENSION(DIM1,DIM2) :: buf2 ! Data buffer -INTEGER, DIMENSION(DIM1,DIM2) :: buf2r ! Data buffer -REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3 ! Data buffer -REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3r ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4 ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4r ! Data buffer -INTEGER :: errcode ! Error flag -INTEGER(HSIZE_T) :: i, j, n ! general purpose integers -TYPE(C_PTR) :: f_ptr - -CALL test_begin(' Make/Read datasets (2D) ') + USE, INTRINSIC :: ISO_C_BINDING + USE H5LT ! module of H5LT + USE HDF5 ! module of HDF5 library + IMPLICIT NONE -! -! Initialize the data arrays. -! -n=1 -DO i = 1, DIM1*DIM2 - buf(i) = INT(n) - n = n + 1 -END DO -DO i = 1, dims(1) - DO j = 1, dims(2) - buf2(i,j) = INT((i-1)*dims(2) + j) - buf3(i,j) = INT((i-1)*dims(2) + j) - buf4(i,j) = INT((i-1)*dims(2) + j) - END DO -END DO + INTEGER(HSIZE_T), PARAMETER :: DIM1 = 4 ! columns + INTEGER(HSIZE_T), PARAMETER :: DIM2 = 6 ! rows + CHARACTER(len=9), PARAMETER :: filename = "dsetf2.h5"! File name + CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions + INTEGER :: rank = 2 ! Dataset rank + INTEGER, DIMENSION(DIM1*DIM2) :: buf ! Data buffer + INTEGER, DIMENSION(DIM1*DIM2) :: bufr ! Data buffer + INTEGER, DIMENSION(DIM1,DIM2) :: buf2 ! Data buffer + INTEGER, DIMENSION(DIM1,DIM2) :: buf2r ! Data buffer + REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3 ! Data buffer + REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3r ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4r ! Data buffer + INTEGER :: errcode ! Error flag + INTEGER(HSIZE_T) :: i, j, n ! general purpose integers + TYPE(C_PTR) :: f_ptr + CALL test_begin(' Make/Read datasets (2D) ') -! -! Initialize FORTRAN predefined datatypes. -! -CALL h5open_f(errcode) -! -! Create a new file using default properties. -! -CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode) + ! + ! Initialize the data arrays. + ! + n=1 + DO i = 1, DIM1*DIM2 + buf(i) = INT(n) + n = n + 1 + END DO -!------------------------------------------------------------------------- -! H5T_NATIVE_INT 1D buffer -!------------------------------------------------------------------------- + DO i = 1, dims(1) + DO j = 1, dims(2) + buf2(i,j) = INT((i-1)*dims(2) + j) + buf3(i,j) = INT((i-1)*dims(2) + j) + buf4(i,j) = INT((i-1)*dims(2) + j) + END DO + END DO -! -! write dataset. -! -CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf, errcode) + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5open_f(errcode) -! -! read dataset. -! -CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr, dims, errcode) + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode) -! -! compare read and write buffers. -! -DO i = 1, DIM1*DIM2 - IF ( buf(i) .NE. bufr(i) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, bufr(i), ' and ', buf(i) - STOP - ENDIF -END DO + !------------------------------------------------------------------------- + ! H5T_NATIVE_INT 1D buffer + !------------------------------------------------------------------------- -!------------------------------------------------------------------------- -! H5T_NATIVE_INT 2D buffer -!------------------------------------------------------------------------- + ! + ! write dataset. + ! + CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf, errcode) -! -! write dataset. -! -CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_INTEGER, buf2, errcode) + ! + ! read dataset. + ! + CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr, dims, errcode) -! -! read dataset. -! -CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, buf2r, dims, errcode) + ! + ! compare read and write buffers. + ! + DO i = 1, DIM1*DIM2 + IF ( buf(i) .NE. bufr(i) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, bufr(i), ' and ', buf(i) + STOP + ENDIF + END DO -! -! compare read and write buffers. -! -DO i = 1, dims(1) - DO j = 1, dims(2) - IF ( buf2(i,j) .NE. buf2r(i,j) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, buf2r(i,j), ' and ', buf2(i,j) - STOP - ENDIF - END DO -END DO + !------------------------------------------------------------------------- + ! H5T_NATIVE_INT 2D buffer + !------------------------------------------------------------------------- -!------------------------------------------------------------------------- -! H5T_NATIVE_REAL -!------------------------------------------------------------------------- + ! + ! write dataset. + ! + CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_INTEGER, buf2, errcode) -! -! write dataset. -! -f_ptr = C_LOC(buf3(1,1)) -CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode) -!CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode) + ! + ! read dataset. + ! + CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, buf2r, dims, errcode) -! -! read dataset. -! -f_ptr = C_LOC(buf3r(1,1)) -CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) -!CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode) + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + IF ( buf2(i,j) .NE. buf2r(i,j) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, buf2r(i,j), ' and ', buf2(i,j) + STOP + ENDIF + END DO + END DO -! -! compare read and write buffers. -! -DO i = 1, dims(1) - DO j = 1, dims(2) - IF ( buf3(i,j) .NE. buf3r(i,j) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, buf3r(i,j), ' and ', buf3(i,j) - STOP - ENDIF - END DO -END DO + !------------------------------------------------------------------------- + ! H5T_NATIVE_REAL + !------------------------------------------------------------------------- -!------------------------------------------------------------------------- -! H5T_NATIVE_DOUBLE -!------------------------------------------------------------------------- + ! + ! write dataset. + ! + f_ptr = C_LOC(buf3(1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode) + !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode) -! -! write dataset. -! -f_ptr = C_LOC(buf4(1,1)) -CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode) -!CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, buf4, errcode) + ! + ! read dataset. + ! + f_ptr = C_LOC(buf3r(1,1)) + CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) + !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode) -! -! read dataset. -f_ptr = C_LOC(buf4r(1,1)) -CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + IF ( buf3(i,j) .NE. buf3r(i,j) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, buf3r(i,j), ' and ', buf3(i,j) + STOP + ENDIF + END DO + END DO -!CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, buf4r, dims, errcode) + !------------------------------------------------------------------------- + ! H5T_NATIVE_DOUBLE + !------------------------------------------------------------------------- -! -! compare read and write buffers. -! -DO i = 1, dims(1) - DO j = 1, dims(2) - IF ( buf4(i,j) .NE. buf4r(i,j) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, buf4r(i,j), ' and ', buf4(i,j) - STOP - ENDIF - END DO -END DO + ! + ! write dataset. + ! + f_ptr = C_LOC(buf4(1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode) + !CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, buf4, errcode) -! -! Close the file. -! -CALL h5fclose_f(file_id, errcode) + ! + ! read dataset. + f_ptr = C_LOC(buf4r(1,1)) + CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) -! -! Close FORTRAN predefined datatypes. -! -CALL h5close_f(errcode) + !CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, buf4r, dims, errcode) -CALL passed() -! -! end function. -! + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + IF ( buf4(i,j) .NE. buf4r(i,j) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, buf4r(i,j), ' and ', buf4(i,j) + STOP + ENDIF + END DO + END DO + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, errcode) + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_f(errcode) + + CALL passed() + ! + ! end function. + ! END SUBROUTINE test_dataset2D @@ -386,215 +384,313 @@ END SUBROUTINE test_dataset2D SUBROUTINE test_dataset3D() -USE, INTRINSIC :: ISO_C_BINDING -USE H5LT ! module of H5LT -USE HDF5 ! module of HDF5 library - -IMPLICIT NONE - -INTEGER, PARAMETER :: DIM1 = 6 ! columns -INTEGER, PARAMETER :: DIM2 = 4 ! rows -INTEGER, PARAMETER :: DIM3 = 2 ! layers -CHARACTER(len=9), PARAMETER :: filename = "dsetf3.h5" ! File name -CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name -CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name -CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name -CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name -INTEGER(HID_T) :: file_id ! File identifier -INTEGER(HSIZE_T), DIMENSION(3) :: dims = (/DIM1,DIM2,DIM3/) ! Dataset dimensions -INTEGER(HSIZE_T), DIMENSION(3) :: dimsr ! Dataset dimensions -INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: buf ! Data buffer -INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: bufr ! Data buffer -INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2 ! Data buffer -INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2r ! Data buffer -REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3 ! Data buffer -REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3r ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4 ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4r ! Data buffer -INTEGER :: rank = 3 ! Dataset rank -INTEGER :: errcode ! Error flag -INTEGER(HSIZE_T) :: i, j, k, n ! general purpose integers -INTEGER :: type_class -INTEGER(SIZE_T) :: type_size -TYPE(C_PTR) :: f_ptr -CALL test_begin(' Make/Read datasets (3D) ') + USE, INTRINSIC :: ISO_C_BINDING + USE H5LT ! module of H5LT + USE HDF5 ! module of HDF5 library + IMPLICIT NONE -! -! Initialize the data array. -! -n=1 -DO i = 1, DIM1*DIM2*DIM3 - buf(i) = INT(n) - n = n + 1 -END DO - -n = 1 -DO i = 1, dims(1) - DO j = 1, dims(2) - DO k = 1, dims(3) - buf2(i,j,k) = INT(n) - buf3(i,j,k) = INT(n) - buf4(i,j,k) = INT(n) - n = n + 1 - END DO - END DO -END DO + INTEGER, PARAMETER :: DIM1 = 6 ! columns + INTEGER, PARAMETER :: DIM2 = 4 ! rows + INTEGER, PARAMETER :: DIM3 = 2 ! layers + CHARACTER(len=9), PARAMETER :: filename = "dsetf3.h5" ! File name + CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HSIZE_T), DIMENSION(3) :: dims = (/DIM1,DIM2,DIM3/) ! Dataset dimensions + INTEGER(HSIZE_T), DIMENSION(3) :: dimsr ! Dataset dimensions + INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: buf ! Data buffer + INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: bufr ! Data buffer + INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2 ! Data buffer + INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2r ! Data buffer + REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3 ! Data buffer + REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3r ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4r ! Data buffer + INTEGER :: rank = 3 ! Dataset rank + INTEGER :: errcode ! Error flag + INTEGER(HSIZE_T) :: i, j, k, n ! general purpose integers + INTEGER :: type_class + INTEGER(SIZE_T) :: type_size + TYPE(C_PTR) :: f_ptr +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 + INTEGER, PARAMETER :: int_kind_32 = SELECTED_INT_KIND(36) !should map to INTEGER*16 on most modern processors + INTEGER(int_kind_32), DIMENSION(DIM1,DIM2,DIM3), TARGET :: dset_data_i32, data_out_i32 + INTEGER(HID_T) :: dset_id32 ! Dataset identifier + CHARACTER(LEN=7), PARAMETER :: dsetname16a = "dset16a" ! Dataset name + CHARACTER(LEN=7), PARAMETER :: dsetname16b = "dset16b" ! Dataset name + CHARACTER(LEN=7), PARAMETER :: dsetname16c = "dset16c" ! Dataset name + INTEGER(HID_T) :: type_id +#endif -! -! Initialize FORTRAN predefined datatypes. -! -CALL h5open_f(errcode) + CALL test_begin(' Make/Read datasets (3D) ') -! -! Create a new file using default properties. -! -CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode) -!------------------------------------------------------------------------- -! H5T_NATIVE_INT 1D buffer -!------------------------------------------------------------------------- + ! + ! Initialize the data array. + ! + n=1 + DO i = 1, DIM1*DIM2*DIM3 + buf(i) = INT(n) + n = n + 1 + END DO -! -! write dataset. -! -CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf, errcode) + n = 1 + DO i = 1, dims(1) + DO j = 1, dims(2) + DO k = 1, dims(3) + buf2(i,j,k) = INT(n) + buf3(i,j,k) = INT(n) + buf4(i,j,k) = INT(n) +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 + dset_data_i32(i,j,k) = HUGE(1_int_kind_32)-INT(n,int_kind_32) +#endif + n = n + 1 + END DO + END DO + END DO -! -! read dataset. -! -CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr, dims, errcode) + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5open_f(errcode) -! -! compare read and write buffers. -! -DO i = 1, DIM1*DIM2*DIM3 - IF ( buf(i) .NE. bufr(i) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, bufr(i), ' and ', buf(i) - STOP - ENDIF -END DO + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode) -!------------------------------------------------------------------------- -! H5T_NATIVE_INT 3D buffer -!------------------------------------------------------------------------- + !------------------------------------------------------------------------- + ! H5T_NATIVE_INT 1D buffer + !------------------------------------------------------------------------- -! -! write dataset. -! -CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_INTEGER, buf2, errcode) + ! + ! write dataset. + ! + CALL h5ltmake_dataset_f(file_id, dsetname1, rank, dims, H5T_NATIVE_INTEGER, buf, errcode) -! -! read dataset. -! -CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, buf2r, dims, errcode) + ! + ! read dataset. + ! + CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr, dims, errcode) -! -! compare read and write buffers. -! -DO i = 1, dims(1) - DO j = 1, dims(2) - DO k = 1, dims(3) - IF ( buf2(i,j,k) .NE. buf2r(i,j,k) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, buf2r(i,j,k), ' and ', buf2(i,j,k) - STOP - ENDIF - END DO - END DO -END DO + ! + ! compare read and write buffers. + ! + DO i = 1, DIM1*DIM2*DIM3 + IF ( buf(i) .NE. bufr(i) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, bufr(i), ' and ', buf(i) + STOP + ENDIF + END DO -!------------------------------------------------------------------------- -! H5T_NATIVE_REAL -!------------------------------------------------------------------------- + !------------------------------------------------------------------------- + ! H5T_NATIVE_INT 3D buffer + !------------------------------------------------------------------------- -! -! write dataset. -! -f_ptr = C_LOC(buf3(1,1,1)) -CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode) -!CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode) + ! + ! write dataset. + ! + CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims, H5T_NATIVE_INTEGER, buf2, errcode) -! -! read dataset. -! -f_ptr = C_LOC(buf3r(1,1,1)) -CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) -!CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode) + ! + ! read dataset. + ! + CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, buf2r, dims, errcode) -! -! compare read and write buffers. -! -DO i = 1, dims(1) - DO j = 1, dims(2) - DO k = 1, dims(3) - IF ( buf3(i,j,k) .NE. buf3r(i,j,k) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, buf3r(i,j,k), ' and ', buf3(i,j,k) - STOP - ENDIF - END DO - END DO -END DO + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + DO k = 1, dims(3) + IF ( buf2(i,j,k) .NE. buf2r(i,j,k) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, buf2r(i,j,k), ' and ', buf2(i,j,k) + STOP + ENDIF + END DO + END DO + END DO -!------------------------------------------------------------------------- -! H5T_NATIVE_DOUBLE -!------------------------------------------------------------------------- + !------------------------------------------------------------------------- + ! H5T_NATIVE_REAL + !------------------------------------------------------------------------- -! -! write dataset. -! -f_ptr = C_LOC(buf4(1,1,1)) -CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode) + ! + ! write dataset. + ! + f_ptr = C_LOC(buf3(1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode) + !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode) -! -! read dataset. -! -f_ptr = C_LOC(buf4r(1,1,1)) -CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) + ! + ! read dataset. + ! + f_ptr = C_LOC(buf3r(1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) + !CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode) -! -! compare read and write buffers. -! -DO i = 1, dims(1) - DO j = 1, dims(2) - DO k = 1, dims(3) - IF ( buf4(i,j,k) .NE. buf4r(i,j,k) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, buf4r(i,j,k), ' and ', buf4(i,j,k) - STOP - ENDIF - END DO - END DO -END DO + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + DO k = 1, dims(3) + IF ( buf3(i,j,k) .NE. buf3r(i,j,k) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, buf3r(i,j,k), ' and ', buf3(i,j,k) + STOP + ENDIF + END DO + END DO + END DO -CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode ) + !------------------------------------------------------------------------- + ! H5T_NATIVE_DOUBLE + !------------------------------------------------------------------------- -! -! compare dimensions -! -DO i = 1, rank - IF ( dimsr(i) .NE. dims(i) ) THEN - PRINT *, 'dimensions differ ' - STOP - ENDIF -END DO + ! + ! write dataset. + ! + f_ptr = C_LOC(buf4(1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode) -! -! Close the file. -! -CALL h5fclose_f(file_id, errcode) + ! + ! read dataset. + ! + f_ptr = C_LOC(buf4r(1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) -! -! Close FORTRAN predefined datatypes. -! -CALL h5close_f(errcode) + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + DO k = 1, dims(3) + IF ( buf4(i,j,k) .NE. buf4r(i,j,k) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, buf4r(i,j,k), ' and ', buf4(i,j,k) + STOP + ENDIF + END DO + END DO + END DO -CALL passed() -! -! end function. -! + CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode ) + + ! + ! compare dimensions + ! + DO i = 1, rank + IF ( dimsr(i) .NE. dims(i) ) THEN + PRINT *, 'dimensions differ ' + STOP + ENDIF + END DO + + !------------------------------------------------------------------------- + ! CHECKING NON-NATIVE INTEGER TYPES + !------------------------------------------------------------------------- + +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 + ! (A) CHECKING INTEGER*16 + ! + ! (i.a) write dataset using F2003 interface + ! + type_id = H5kind_to_type(KIND(dset_data_i32(1,1,1)), H5_INTEGER_KIND) + f_ptr = C_LOC(dset_data_i32(1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname16a, rank, dims, type_id, f_ptr, errcode) + ! + ! (i.b) read dataset using F2003 interface + ! + f_ptr = C_LOC(data_out_i32(1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname16a, type_id, f_ptr, errcode) + + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + DO k = 1, dims(3) + IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k) + STOP + ENDIF + END DO + END DO + ENDDO + + ! + ! (ii.a) write dataset using F90 interface + ! + type_id = H5kind_to_type(KIND(dset_data_i32(1,1,1)), H5_INTEGER_KIND) + CALL h5ltmake_dataset_f(file_id, dsetname16b, rank, dims, type_id, dset_data_i32, errcode) + ! + ! (ii.b) read dataset using F90 interface + ! + CALL h5ltread_dataset_f(file_id, dsetname16b, type_id, data_out_i32, dims, errcode) + + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + DO k = 1, dims(3) + IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k) + STOP + ENDIF + END DO + END DO + ENDDO + + ! + ! (iii.a) write dataset using F90 H5LTmake_dataset_int_f interface + ! + CALL h5ltmake_dataset_int_f(file_id, dsetname16c, rank, dims, dset_data_i32, errcode) + + ! + ! (iii.b) read dataset using F90 H5LTmake_dataset_int_f interface + ! + CALL h5ltread_dataset_int_f(file_id, dsetname16c, data_out_i32, dims, errcode) + + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + DO k = 1, dims(3) + IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k) + STOP + ENDIF + END DO + END DO + ENDDO + +#endif + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, errcode) + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_f(errcode) + + CALL passed() + ! + ! end function. + ! END SUBROUTINE test_dataset3D !------------------------------------------------------------------------- @@ -623,6 +719,7 @@ SUBROUTINE test_datasetND(rank) CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname5 = "dset5" ! Dataset name INTEGER(HID_T) :: file_id ! File identifier INTEGER(HSIZE_T), DIMENSION(7) :: dims INTEGER(HSIZE_T), DIMENSION(7) :: dimsr ! Dataset dimensions @@ -650,29 +747,41 @@ SUBROUTINE test_datasetND(rank) DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: dbufr_6 ! Data buffer DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: dbuf_7 ! Data buffer DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: dbufr_7 ! Data buffer - INTEGER :: errcode ! Error flag - INTEGER(HSIZE_T) :: i, j, k, l, m, n, o, nn ! general purpose integers + CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: cbuf_4 ! Data buffer + CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: cbufr_4 ! Data buffer + CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: cbuf_5 ! Data buffer + CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: cbufr_5 ! Data buffer + CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: cbuf_6 ! Data buffer + CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: cbufr_6 ! Data buffer + CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: cbuf_7 ! Data buffer + CHARACTER(LEN=5), ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: cbufr_7 ! Data buffer + INTEGER :: errcode ! Error flag + INTEGER(HSIZE_T) :: i, j, k, l, m, n, o, nn ! general purpose integers INTEGER :: type_class INTEGER(SIZE_T) :: type_size CHARACTER(LEN=1) :: ichr1 + CHARACTER(LEN=3) :: ichr3 TYPE(C_PTR) :: f_ptr + INTEGER(HID_T) :: type_id WRITE(ichr1,'(I1.1)') rank CALL test_begin(' Make/Read datasets ('//ichr1//'D) ') -! -! Initialize the data array. -! + ! + ! Initialize the data array. + ! IF(rank.EQ.4)THEN - + ALLOCATE(ibuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4)) ALLOCATE(ibufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4)) ALLOCATE(rbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4)) ALLOCATE(rbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4)) ALLOCATE(dbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4)) ALLOCATE(dbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4)) + ALLOCATE(cbuf_4 (1:DIM1,1:DIM2,1:DIM3,1:DIM4)) + ALLOCATE(cbufr_4(1:DIM1,1:DIM2,1:DIM3,1:DIM4)) dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,0,0,0/) - + nn = 1 DO i = 1, DIM1 DO j = 1, DIM2 @@ -681,12 +790,14 @@ SUBROUTINE test_datasetND(rank) ibuf_4(i,j,k,l) = INT(nn) rbuf_4(i,j,k,l) = INT(nn) dbuf_4(i,j,k,l) = INT(nn) + WRITE(cbuf_4(i,j,k,l),'(I5.5)') nn nn = nn + 1 END DO END DO END DO + ENDDO - + ELSE IF(rank.EQ.5)THEN ALLOCATE(ibuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5)) @@ -695,9 +806,11 @@ SUBROUTINE test_datasetND(rank) ALLOCATE(rbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5)) ALLOCATE(dbuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5)) ALLOCATE(dbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5)) + ALLOCATE(cbuf_5 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5)) + ALLOCATE(cbufr_5(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5)) dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,0,0/) - + nn = 1 DO i = 1, DIM1 DO j = 1, DIM2 @@ -707,6 +820,7 @@ SUBROUTINE test_datasetND(rank) ibuf_5(i,j,k,l,m) = INT(nn) rbuf_5(i,j,k,l,m) = INT(nn) dbuf_5(i,j,k,l,m) = INT(nn) + WRITE(cbuf_5(i,j,k,l,m),'(I5.5)') nn nn = nn + 1 END DO END DO @@ -722,9 +836,11 @@ SUBROUTINE test_datasetND(rank) ALLOCATE(rbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6)) ALLOCATE(dbuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6)) ALLOCATE(dbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6)) + ALLOCATE(cbuf_6 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6)) + ALLOCATE(cbufr_6(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6)) dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,DIM6,0/) - + nn = 1 DO i = 1, DIM1 DO j = 1, DIM2 @@ -735,6 +851,7 @@ SUBROUTINE test_datasetND(rank) ibuf_6(i,j,k,l,m,n) = INT(nn) rbuf_6(i,j,k,l,m,n) = INT(nn) dbuf_6(i,j,k,l,m,n) = INT(nn) + WRITE(cbuf_6(i,j,k,l,m,n),'(I5.5)') nn nn = nn + 1 END DO END DO @@ -742,18 +859,20 @@ SUBROUTINE test_datasetND(rank) ENDDO ENDDO ENDDO - + ELSE IF(rank.EQ.7)THEN - + ALLOCATE(ibuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7)) ALLOCATE(ibufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7)) ALLOCATE(rbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7)) ALLOCATE(rbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7)) ALLOCATE(dbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7)) ALLOCATE(dbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7)) + ALLOCATE(cbuf_7 (1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7)) + ALLOCATE(cbufr_7(1:DIM1,1:DIM2,1:DIM3,1:DIM4,1:DIM5,1:DIM6,1:DIM7)) dims(1:7) = (/DIM1,DIM2,DIM3,DIM4,DIM5,DIM6,DIM7/) - + nn = 1 DO i = 1, DIM1 DO j = 1, DIM2 @@ -765,6 +884,7 @@ SUBROUTINE test_datasetND(rank) ibuf_7(i,j,k,l,m,n,o) = INT(nn) rbuf_7(i,j,k,l,m,n,o) = INT(nn) dbuf_7(i,j,k,l,m,n,o) = INT(nn) + WRITE(cbuf_7(i,j,k,l,m,n,o),'(I5.5)') nn nn = nn + 1 END DO END DO @@ -803,7 +923,7 @@ SUBROUTINE test_datasetND(rank) ELSE IF(rank.EQ.7)THEN CALL h5ltmake_dataset_f(file_id, dsetname2, rank, dims(1:rank), H5T_NATIVE_INTEGER, ibuf_7, errcode) ENDIF - + ! ! read dataset. @@ -874,7 +994,7 @@ SUBROUTINE test_datasetND(rank) IF(rank.EQ.4)THEN f_ptr = C_LOC(rbuf_4(1,1,1,1)) CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode) - ! CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_4, errcode) + ! CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_4, errcode) ELSE IF(rank.EQ.5)THEN f_ptr = C_LOC(rbuf_5(1,1,1,1,1)) CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode) @@ -887,7 +1007,7 @@ SUBROUTINE test_datasetND(rank) CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode) !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_7, errcode) ENDIF - + ! ! read dataset. @@ -972,7 +1092,6 @@ SUBROUTINE test_datasetND(rank) f_ptr = C_LOC(dbuf_7(1,1,1,1,1,1,1)) CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode) ENDIF - ! ! read dataset. @@ -1037,8 +1156,97 @@ SUBROUTINE test_datasetND(rank) ENDDO ENDDO + !------------------------------------------------------------------------- + ! H5T_NATIVE_CHARACTER ND buffer + !------------------------------------------------------------------------- + + CALL H5Tcopy_f(H5T_FORTRAN_S1, type_id, errcode) + CALL H5Tset_size_f(type_id, 5_SIZE_T, errcode) + ! + ! write dataset. + ! + IF(rank.EQ.4)THEN + f_ptr = C_LOC(cbuf_4(1,1,1,1)(1:1)) + CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode) + ELSE IF(rank.EQ.5)THEN + f_ptr = C_LOC(cbuf_5(1,1,1,1,1)(1:1)) + CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode) + ELSE IF(rank.EQ.6)THEN + f_ptr = C_LOC(cbuf_6(1,1,1,1,1,1)(1:1)) + CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode) + ELSE IF(rank.EQ.7)THEN + f_ptr = C_LOC(cbuf_7(1,1,1,1,1,1,1)(1:1)) + CALL h5ltmake_dataset_f(file_id, dsetname5, rank, dims(1:rank), type_id, f_ptr, errcode) + ENDIF + + ! + ! read dataset. + ! + IF(rank.EQ.4)THEN + f_ptr = C_LOC(cbufr_4(1,1,1,1)(1:1)) + CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode) + ELSE IF(rank.EQ.5)THEN + f_ptr = C_LOC(cbufr_5(1,1,1,1,1)(1:1)) + CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode) + ELSE IF(rank.EQ.6)THEN + f_ptr = C_LOC(cbufr_6(1,1,1,1,1,1)(1:1)) + CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode) + ELSE IF(rank.EQ.7)THEN + f_ptr = C_LOC(cbufr_7(1,1,1,1,1,1,1)(1:1)) + CALL h5ltread_dataset_f(file_id, dsetname5, type_id, f_ptr, errcode) + ENDIF + + + ! + ! compare read and write buffers. + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + DO k = 1, dims(3) + DO l = 1, dims(4) + IF(rank.EQ.4)THEN + IF ( cbuf_4(i,j,k,l) .NE. cbufr_4(i,j,k,l) ) THEN + PRINT *, 'read buffer differs from write buffer (character)' + PRINT *, cbuf_4(i,j,k,l), ' and ', cbufr_4(i,j,k,l) + STOP + ENDIF + ENDIF + DO m = 1, dims(5) + IF(rank.EQ.5)THEN + IF ( cbuf_5(i,j,k,l,m) .NE. cbufr_5(i,j,k,l,m) ) THEN + PRINT *, 'read buffer differs from write buffer (character)' + PRINT *, cbuf_5(i,j,k,l,m), ' and ', cbufr_5(i,j,k,l,m) + STOP + ENDIF + ENDIF + DO n = 1, dims(6) + IF(rank.EQ.6)THEN + IF ( cbuf_6(i,j,k,l,m,n) .NE. cbufr_6(i,j,k,l,m,n) ) THEN + PRINT *, 'read buffer differs from write buffer (character)' + PRINT *, cbuf_6(i,j,k,l,m,n), ' and ', cbufr_6(i,j,k,l,m,n) + STOP + ENDIF + ENDIF + DO o = 1, dims(7) + IF(rank.EQ.7)THEN + IF ( cbuf_7(i,j,k,l,m,n,o) .NE. cbufr_7(i,j,k,l,m,n,o) ) THEN + PRINT *, 'read buffer differs from write buffer (character)' + PRINT *, cbuf_7(i,j,k,l,m,n,o), ' and ', cbufr_7(i,j,k,l,m,n,o) + STOP + ENDIF + ENDIF + ENDDO + ENDDO + ENDDO + ENDDO + ENDDO + ENDDO + ENDDO + CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode ) + CALL h5tclose_f(type_id,errcode) + ! ! compare dimensions ! @@ -1062,13 +1270,13 @@ SUBROUTINE test_datasetND(rank) ! DEALLOCATE RESOURCES IF(rank.EQ.4)THEN - DEALLOCATE(ibuf_4, ibufr_4, rbuf_4, rbufr_4, dbuf_4, dbufr_4) + DEALLOCATE(ibuf_4, ibufr_4, rbuf_4, rbufr_4, dbuf_4, dbufr_4, cbuf_4, cbufr_4) ELSE IF(rank.EQ.5)THEN - DEALLOCATE(ibuf_5, ibufr_5, rbuf_5, rbufr_5, dbuf_5, dbufr_5) + DEALLOCATE(ibuf_5, ibufr_5, rbuf_5, rbufr_5, dbuf_5, dbufr_5, cbuf_5, cbufr_5) ELSE IF(rank.EQ.6)THEN - DEALLOCATE(ibuf_6, ibufr_6, rbuf_6, rbufr_6, dbuf_6, dbufr_6) + DEALLOCATE(ibuf_6, ibufr_6, rbuf_6, rbufr_6, dbuf_6, dbufr_6, cbuf_6, cbufr_6) ELSE IF(rank.EQ.7)THEN - DEALLOCATE(ibuf_7, ibufr_7, rbuf_7, rbufr_7, dbuf_7, dbufr_7) + DEALLOCATE(ibuf_7, ibufr_7, rbuf_7, rbufr_7, dbuf_7, dbufr_7, cbuf_7, cbufr_7) ENDIF CALL passed() @@ -1078,7 +1286,6 @@ SUBROUTINE test_datasetND(rank) END SUBROUTINE test_datasetND - !------------------------------------------------------------------------- ! test_datasets !------------------------------------------------------------------------- @@ -1094,7 +1301,7 @@ SUBROUTINE test_datasets() CHARACTER(len=9), PARAMETER :: filename = "dsetf4.h5"! File name INTEGER(HID_T) :: file_id ! File identifier INTEGER :: errcode ! Error flag - INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array + INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name @@ -1108,10 +1315,10 @@ SUBROUTINE test_datasets() CHARACTER(LEN=8) :: buf1r ! Data buffer INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer - REAL, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer - REAL, DIMENSION(DIM1) , TARGET :: bufr3 ! Data buffer - DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer - DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer + REAL, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer + REAL, DIMENSION(DIM1) , TARGET :: bufr3 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer INTEGER :: i, n ! general purpose integer INTEGER :: has ! general purpose integer INTEGER :: type_class @@ -1289,7 +1496,7 @@ SUBROUTINE test_datasets() IF(errcode.LT.0.OR..NOT.path_valid)THEN PRINT *, 'error in h5ltpath_valid_f' STOP - ENDIF + ENDIF ! Should fail, dataset does not exist CALL h5ltpath_valid_f(file_id, "/"//dsetname2//"junk", .TRUE., path_valid, errcode) @@ -1306,14 +1513,14 @@ SUBROUTINE test_datasets() ! Create a dangling soft link CALL h5lcreate_soft_f("/G2", file_id, "/G3", errcode) - + ! Should pass, does not check for dangled link CALL h5ltpath_valid_f(file_id, "/G3", .FALSE., path_valid, errcode) IF(.NOT.path_valid)THEN PRINT *, 'error in h5ltpath_valid_f' STOP ENDIF - + ! Should fail, dangled link CALL h5ltpath_valid_f(file_id, "/G2", .TRUE., path_valid, errcode) IF(path_valid)THEN @@ -1336,7 +1543,6 @@ SUBROUTINE test_datasets() STOP ENDIF - !------------------------------------------------------------------------- ! test h5ltfind_dataset_f function !------------------------------------------------------------------------- @@ -1352,7 +1558,6 @@ SUBROUTINE test_datasets() ! test h5ltget_dataset_info_f function !------------------------------------------------------------------------- - CALL h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode ) ! @@ -1402,7 +1607,7 @@ SUBROUTINE test_attributes() CHARACTER(len=9), PARAMETER :: filename = "dsetf5.h5"! File name CHARACTER(len=9), PARAMETER :: filename1 ="tattr.h5" ! C written attribute file INTEGER(HID_T) :: file_id ! File identifier -! INTEGER(HID_T) :: file_id1 + ! INTEGER(HID_T) :: file_id1 INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array CHARACTER(LEN=5), PARAMETER :: attrname1 = "attr1" ! Attribute name CHARACTER(LEN=5), PARAMETER :: attrname2 = "attr2" ! Attribute name @@ -1413,8 +1618,8 @@ SUBROUTINE test_attributes() CHARACTER(LEN=16), PARAMETER :: buf_c = "string attribute" CHARACTER(LEN=8) :: bufr1 ! Data buffer CHARACTER(LEN=10) :: bufr1_lg ! Data buffer -! CHARACTER(LEN=16) :: bufr_c ! Data buffer -! CHARACTER(LEN=18) :: bufr_c_lg ! Data buffer + ! CHARACTER(LEN=16) :: bufr_c ! Data buffer + ! CHARACTER(LEN=18) :: bufr_c_lg ! Data buffer INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer REAL, DIMENSION(DIM1), target :: buf3 ! Data buffer @@ -1547,41 +1752,41 @@ SUBROUTINE test_attributes() IF(SizeOf_buf_type.LT.16)THEN ! MSB can't handle 16 byte reals - CALL test_begin(' Set/Get attributes double ') + CALL test_begin(' Set/Get attributes double ') - ! - ! write attribute. - ! - f_ptr = C_LOC(buf4(1)) - CALL h5ltset_attribute_f(file_id,dsetname1,attrname4,f_ptr,"real", SizeOf_buf_type, size, errcode) + ! + ! write attribute. + ! + f_ptr = C_LOC(buf4(1)) + CALL h5ltset_attribute_f(file_id,dsetname1,attrname4,f_ptr,"real", SizeOf_buf_type, size, errcode) -! CALL h5ltset_attribute_double_f(file_id,dsetname1,attrname4,buf4, size, errcode) + ! CALL h5ltset_attribute_double_f(file_id,dsetname1,attrname4,buf4, size, errcode) - ! - ! read attribute. - ! + ! + ! read attribute. + ! #ifdef H5_FORTRAN_HAVE_STORAGE_SIZE - SizeOf_buf_type = STORAGE_SIZE(bufr4(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) + SizeOf_buf_type = STORAGE_SIZE(bufr4(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) #else - SizeOf_buf_type = SIZEOF(bufr4(1)) + SizeOf_buf_type = SIZEOF(bufr4(1)) #endif - f_ptr = C_LOC(bufr4(1)) - CALL h5ltget_attribute_f(file_id,dsetname1,attrname4,f_ptr,"REAL",SizeOf_buf_type,errcode) + f_ptr = C_LOC(bufr4(1)) + CALL h5ltget_attribute_f(file_id,dsetname1,attrname4,f_ptr,"REAL",SizeOf_buf_type,errcode) - ! - ! compare read and write buffers. - ! - DO i = 1, DIM1 - IF ( buf4(i) .NE. bufr4(i) ) THEN - PRINT *, 'read buffer differs from write buffer' - PRINT *, bufr4(i), ' and ', buf4(i) - STOP - ENDIF - END DO - - CALL passed() + ! + ! compare read and write buffers. + ! + DO i = 1, DIM1 + IF ( buf4(i) .NE. bufr4(i) ) THEN + PRINT *, 'read buffer differs from write buffer' + PRINT *, bufr4(i), ' and ', buf4(i) + STOP + ENDIF + END DO + + CALL passed() ENDIF diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 3bab6a9..4624a08 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -680,7 +680,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 220 +LT_VERS_REVISION = 221 LT_VERS_AGE = 0 # This library is our main target. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index e281d7d..d1eba9b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.230 currently under development +HDF5 version 1.9.231 currently under development ================================================================================ @@ -2321,3 +2321,113 @@ H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC_retag_copied_metadata */ + +/*------------------------------------------------------------------------- + * Function: H5AC_get_entry_ring + * + * Purpose: Given a file address, retrieve the ring for an entry at that + * address. + * + * On error, the value of *ring is not modified. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 9/8/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(ring); + + /* Retrieve the ring value for the entry at address */ + if(H5C_get_entry_ring(f, addr, ring) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "Can't retrieve ring for entry") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_get_entry_ring() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC_set_ring + * + * Purpose: Routine to set the ring on a DXPL (for passing through + * to the metadata cache). + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_set_ring(hid_t dxpl_id, H5AC_ring_t ring, H5P_genplist_t **dxpl, + H5AC_ring_t *orig_ring) +{ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(dxpl); + HDassert(orig_ring); + + /* Set the ring type in the DXPL */ + if(NULL == ((*dxpl) = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + if((H5P_get((*dxpl), H5AC_RING_NAME, orig_ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get original ring value") + if((H5P_set((*dxpl), H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set ring value") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5AC_set_ring() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC_reset_ring + * + * Purpose: Routine to reset the original ring on a DXPL (after passing + * through to the metadata cache). + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_reset_ring(H5P_genplist_t *dxpl, H5AC_ring_t orig_ring) +{ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Reset the ring in the DXPL, if it's been changed */ + if(orig_ring) { + /* Sanity check */ + HDassert(dxpl); + + if((H5P_set(dxpl, H5AC_RING_NAME, &orig_ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5AC_reset_ring() */ + diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 584ce9d..fded15c 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -132,6 +132,15 @@ typedef enum { #define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG #define H5AC__SERIALIZE_COMPRESSED_FLAG H5C__SERIALIZE_COMPRESSED_FLAG +/* Aliases for the "ring" type and values */ +typedef H5C_ring_t H5AC_ring_t; +#define H5AC_RING_INV H5C_RING_UNDEFINED +#define H5AC_RING_US H5C_RING_USER +#define H5AC_RING_FSM H5C_RING_FSM +#define H5AC_RING_SBE H5C_RING_SBE +#define H5AC_RING_SB H5C_RING_SB +#define H5AC_RING_NTYPES H5C_RING_NTYPES + /* Aliases for 'notify action' type & values */ typedef H5C_notify_action_t H5AC_notify_action_t; #define H5AC_NOTIFY_ACTION_AFTER_INSERT H5C_NOTIFY_ACTION_AFTER_INSERT @@ -185,6 +194,8 @@ typedef H5C_t H5AC_t; #define H5AC_METADATA_TAG_SIZE sizeof(haddr_t) #define H5AC_METADATA_TAG_DEF H5AC__INVALID_TAG +#define H5AC_RING_NAME "H5AC_ring_type" + /* Dataset transfer property list for flush calls */ /* (Collective set, "block before metadata write" set and "library internal" set) */ /* (Global variable declaration, definition is in H5AC.c) */ @@ -350,9 +361,16 @@ H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_close_trace_file(H5AC_t *cache_ptr); H5_DLL herr_t H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name); + +/* Tag & Ring routines */ H5_DLL herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t *prev_tag); H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag); H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f); +H5_DLL herr_t H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring); +H5_DLL herr_t H5AC_set_ring(hid_t dxpl_id, H5AC_ring_t ring, H5P_genplist_t **dxpl, + H5AC_ring_t *orig_ring); +H5_DLL herr_t H5AC_reset_ring(H5P_genplist_t *dxpl, H5AC_ring_t orig_ring); + #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr); @@ -147,6 +147,12 @@ static herr_t H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags); +static herr_t H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, + H5C_ring_t ring, unsigned flags); + +static herr_t H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, + unsigned flags); + static void * H5C_load_entry(H5F_t * f, hid_t dxpl_id, const H5C_class_t * type, @@ -496,6 +502,16 @@ H5C_create(size_t max_cache_size, cache_ptr->clean_index_size = (size_t)0; cache_ptr->dirty_index_size = (size_t)0; + for(i = 0; i < H5C_RING_NTYPES; i++) { + cache_ptr->index_ring_len[i] = 0; + cache_ptr->index_ring_size[i] = (size_t)0; + cache_ptr->clean_index_ring_size[i] = (size_t)0; + cache_ptr->dirty_index_ring_size[i] = (size_t)0; + + cache_ptr->slist_ring_len[i] = 0; + cache_ptr->slist_ring_size[i] = (size_t)0; + } /* end for */ + /* Tagging Field Initializations */ cache_ptr->ignore_tags = FALSE; @@ -510,10 +526,8 @@ H5C_create(size_t max_cache_size, cache_ptr->slist_size_increase = 0; #endif /* H5C_DO_SANITY_CHECKS */ - for ( i = 0; i < H5C__HASH_TABLE_LEN; i++ ) - { + for(i = 0; i < H5C__HASH_TABLE_LEN; i++) (cache_ptr->index)[i] = NULL; - } cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; @@ -1009,13 +1023,6 @@ done: * all unprotected entries should be flushed before the * function returns failure. * - * The primary_dxpl_id and secondary_dxpl_id parameters - * specify the dxpl_ids used on the first write occasioned - * by the flush (primary_dxpl_id), and on all subsequent - * writes (secondary_dxpl_id). This is useful in the metadata - * cache, but may not be needed elsewhere. If so, just use the - * same dxpl_id for both parameters. - * * Return: Non-negative on success/Negative on failure or if there was * a request to flush all items and something was protected. * @@ -1036,408 +1043,105 @@ done: * * JRM -- 12/13/14 * + * Modified function to support rings. Basic idea is that + * every entry in the cache is assigned to a ring. Entries + * in the outermost ring are flushed first, followed by + * those in the next outermost ring, and so on until the + * innermost ring is flushed. See header comment on + * H5C_ring_t in H5Cprivate.h for a more detailed + * discussion. + * + * JRM -- 8/30/15 + * *------------------------------------------------------------------------- */ herr_t H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) { - H5C_t * cache_ptr = f->shared->cache; - herr_t ret_value = SUCCEED; - hbool_t destroy; - hbool_t flushed_entries_last_pass; - hbool_t flush_marked_entries; - hbool_t ignore_protected; - hbool_t tried_to_flush_protected_entry = FALSE; - hbool_t restart_slist_scan; - int32_t passes = 0; - int32_t protected_entries = 0; - H5SL_node_t * node_ptr = NULL; - H5C_cache_entry_t * entry_ptr = NULL; - H5C_cache_entry_t * next_entry_ptr = NULL; #if H5C_DO_SANITY_CHECKS - int64_t flushed_entries_count = 0; - int64_t flushed_entries_size = 0; - int64_t initial_slist_len = 0; - size_t initial_slist_size = 0; - int64_t entry_size_change; - int64_t * entry_size_change_ptr = &entry_size_change; -#else /* H5C_DO_SANITY_CHECKS */ - int64_t * entry_size_change_ptr = NULL; + int i; + int32_t index_len = 0; + size_t index_size = (size_t)0; + size_t clean_index_size = (size_t)0; + size_t dirty_index_size = (size_t)0; + size_t slist_size = (size_t)0; + int32_t slist_len = 0; #endif /* H5C_DO_SANITY_CHECKS */ + H5C_ring_t ring; + H5C_t * cache_ptr; + hbool_t destroy; + hbool_t ignore_protected; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->slist_ptr ); + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); -#if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { +#if H5C_DO_SANITY_CHECKS + HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + + for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { + index_len += cache_ptr->index_ring_len[i]; + index_size += cache_ptr->index_ring_size[i]; + clean_index_size += cache_ptr->clean_index_ring_size[i]; + dirty_index_size += cache_ptr->dirty_index_ring_size[i]; + + slist_len += cache_ptr->slist_ring_len[i]; + slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on entry.\n"); - } + HDassert(cache_ptr->index_len == index_len); + HDassert(cache_ptr->index_size == index_size); + HDassert(cache_ptr->clean_index_size == clean_index_size); + HDassert(cache_ptr->dirty_index_size == dirty_index_size); + HDassert(cache_ptr->slist_len == slist_len); + HDassert(cache_ptr->slist_size == slist_size); +#endif /* H5C_DO_SANITY_CHECKS */ + +#if H5C_DO_EXTREME_SANITY_CHECKS + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); - destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); - - /* note that flush_marked_entries is set to FALSE if destroy is TRUE */ - flush_marked_entries = ( ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ) - && - ( ! destroy ) - ); - HDassert( ! ( destroy && ignore_protected ) ); - HDassert( ! ( cache_ptr->flush_in_progress ) ); cache_ptr->flush_in_progress = TRUE; - if ( destroy ) { + if(destroy) { if(H5C_flush_invalidate_cache(f, dxpl_id, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate failed.") - } else { - /* When we are only flushing marked entries, the slist will usually - * still contain entries when we have flushed everything we should. - * Thus we track whether we have flushed any entries in the last - * pass, and terminate if we haven't. - */ - - flushed_entries_last_pass = TRUE; - - /* set the cache_ptr->slist_change_in_pre_serialize and - * cache_ptr->slist_change_in_serialize to false. - * - * These flags are set to TRUE by H5C__flush_single_entry if the - * slist is modified by a pre_serialize or serialize call respectively. - * H5C_flush_cache uses these flags to detect any modifications - * to the slist that might corrupt the scan of the slist -- and - * restart the scan in this event. + } /* end if */ + else { + /* flush each ring, starting from the outermost ring and + * working inward. */ - cache_ptr->slist_change_in_pre_serialize = FALSE; - cache_ptr->slist_change_in_serialize = FALSE; - - while ( ( passes < H5C__MAX_PASSES_ON_FLUSH ) && - ( cache_ptr->slist_len != 0 ) && - ( protected_entries == 0 ) && - ( flushed_entries_last_pass ) ) - { - unsigned curr_flush_dep_height = 0; - unsigned flush_dep_passes = 0; - - flushed_entries_last_pass = FALSE; - - /* Loop over all flush dependency heights of entries */ - while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) && - (cache_ptr->slist_len != 0) && - (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH) ) - { - hbool_t flushed_during_dep_loop = FALSE; - -#if H5C_DO_SANITY_CHECKS - /* For sanity checking, try to verify that the skip list has - * the expected size and number of entries at the end of each - * internal while loop (see below). - * - * Doing this get a bit tricky, as depending on flags, we may - * or may not flush all the entries in the slist. - * - * To make things more entertaining, with the advent of the - * fractal heap, the entry serialize callback can cause entries - * to be dirtied, resized, and/or moved. Also, the - * pre_serialize callback can result in an entry being - * removed from the cache via the take ownership flag. - * - * To deal with this, we first make note of the initial - * skip list length and size: - */ - initial_slist_len = cache_ptr->slist_len; - initial_slist_size = cache_ptr->slist_size; - - /* We then zero counters that we use to track the number - * and total size of entries flushed: - */ - flushed_entries_count = 0; - flushed_entries_size = 0; - - /* As mentioned above, there is the possibility that - * entries will be dirtied, resized, flushed, or removed - * from the cache via the take ownership flag during - * our pass through the skip list. To capture the number - * of entries added, and the skip list size delta, - * zero the slist_len_increase and slist_size_increase of - * the cache's instance of H5C_t. These fields will be - * updated elsewhere to account for slist insertions and/or - * dirty entry size changes. - */ - cache_ptr->slist_len_increase = 0; - cache_ptr->slist_size_increase = 0; - - /* at the end of the loop, use these values to compute the - * expected slist length and size and compare this with the - * value recorded in the cache's instance of H5C_t. - */ -#endif /* H5C_DO_SANITY_CHECKS */ - - restart_slist_scan = TRUE; - - while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) - { - if ( restart_slist_scan ) - { - restart_slist_scan = FALSE; - - /* Start at beginning of skip list */ - node_ptr = H5SL_first(cache_ptr->slist_ptr); - - if ( node_ptr == NULL ) - { - /* the slist is empty -- break out of inner loop */ - break; - } - HDassert( node_ptr != NULL ); - - /* Get cache entry for this node */ - next_entry_ptr = - (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL ?!?!") - - HDassert( next_entry_ptr->magic == \ - H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - } - - entry_ptr = next_entry_ptr; - - /* With the advent of the fractal heap, the free space - * manager, and the version 3 cache, it is possible - * that the pre-serialize or serialize callback will - * dirty, resize, or take ownership of other entries - * in the cache. - * - * To deal with this, I have inserted code to detect any - * change in the skip list not directly under the control - * of this function. If such modifications are detected, - * we must re-start the scan of the skip list to avoid - * the possibility that the target of the next_entry_ptr - * may have been flushed or deleted from the cache. - * - * To verify that all such possibilities have been dealt - * with, we do a bit of extra sanity checking on - * entry_ptr. - */ - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->in_slist); - HDassert(entry_ptr->is_dirty); - - /* increment node pointer now, before we delete its target - * from the slist. - */ - node_ptr = H5SL_next(node_ptr); - - if ( node_ptr != NULL ) { - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( NULL == next_entry_ptr ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - HDassert( entry_ptr != next_entry_ptr ); - } else { - next_entry_ptr = NULL; - } - - HDassert( entry_ptr != NULL ); - HDassert( entry_ptr->in_slist ); - - if ( ( ( ! flush_marked_entries ) || - ( entry_ptr->flush_marker ) ) && - ( ( ! entry_ptr->flush_me_last ) || - ( ( entry_ptr->flush_me_last ) && - ( cache_ptr->num_last_entries >= - cache_ptr->slist_len ) ) ) ) { - - if ( entry_ptr->is_protected ) { - - /* we probably have major problems -- but lets - * flush everything we can before we decide - * whether to flag an error. - */ - tried_to_flush_protected_entry = TRUE; - protected_entries++; - - } else if ( entry_ptr->is_pinned ) { - /* Test to see if we are can flush the entry now. - * If we can, go ahead and flush. Note that we - * aren't trying to do a destroy here, so that - * is not an issue. - */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ) { -#if H5C_DO_SANITY_CHECKS - flushed_entries_count++; - flushed_entries_size += (int64_t)entry_ptr->size; - entry_size_change = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") - -#if H5C_DO_SANITY_CHECKS - /* it is possible that the entry size changed - * during flush -- update flushed_entries_size - * to account for this. - */ - flushed_entries_size += entry_size_change; -#endif /* H5C_DO_SANITY_CHECKS */ - - flushed_during_dep_loop = TRUE; - - if ((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) - { - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize - = FALSE; - cache_ptr->slist_change_in_serialize - = FALSE; - - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") - } /* end if */ - else { - /* Test to see if we are can flush the entry now. - * If we can, go ahead and flush. Note that we - * aren't trying to do a destroy here, so that - * is not an issue. - */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ) { -#if H5C_DO_SANITY_CHECKS - flushed_entries_count++; - flushed_entries_size += (int64_t)entry_ptr->size; - entry_size_change = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") - -#if H5C_DO_SANITY_CHECKS - /* it is possible that the entry size changed - * during flush -- update flushed_entries_size - * to account for this. - */ - flushed_entries_size += entry_size_change; -#endif /* H5C_DO_SANITY_CHECKS */ - - flushed_during_dep_loop = TRUE; - - if ((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) - { - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize - = FALSE; - cache_ptr->slist_change_in_serialize - = FALSE; - - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") - } /* end else */ - } /* end if */ - } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ - - /* Check for incrementing flush dependency height */ - if(flushed_during_dep_loop) { - /* If we flushed an entry at this flush dependency height - * start over at the bottom level of the flush dependencies - */ - curr_flush_dep_height = 0; - - /* Make certain we don't get stuck in an infinite loop */ - flush_dep_passes++; - - /* Set flag for outer loop */ - flushed_entries_last_pass = TRUE; - } /* end if */ - else - curr_flush_dep_height++; - - } /* while ( curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) */ - - passes++; - -#if H5C_DO_SANITY_CHECKS - /* Verify that the slist size and length are as expected. */ - - HDassert( (initial_slist_len + cache_ptr->slist_len_increase - - flushed_entries_count) == cache_ptr->slist_len ); - HDassert( (size_t)((int64_t)initial_slist_size + - cache_ptr->slist_size_increase - - flushed_entries_size) == cache_ptr->slist_size ); -#endif /* H5C_DO_SANITY_CHECKS */ - - } /* while */ - - HDassert( protected_entries <= cache_ptr->pl_len ); - - if ( ( ( cache_ptr->pl_len > 0 ) && ( !ignore_protected ) ) - || - ( tried_to_flush_protected_entry ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "cache has protected items") - } - - if ( ( cache_ptr->slist_len != 0 ) && - ( passes >= H5C__MAX_PASSES_ON_FLUSH ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "flush pass limit exceeded.") - } - -#if H5C_DO_SANITY_CHECKS - if ( ! flush_marked_entries ) { - - HDassert( cache_ptr->slist_len == 0 ); - HDassert( cache_ptr->slist_size == 0 ); - } -#endif /* H5C_DO_SANITY_CHECKS */ - - } + ring = H5C_RING_USER; + while(ring < H5C_RING_NTYPES) { + if(H5C_flush_ring(f, dxpl_id, ring, flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush ring failed.") + ring++; + } /* end while */ + } /* end else */ done: - cache_ptr->flush_in_progress = FALSE; FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_flush_cache() */ @@ -2045,7 +1749,8 @@ H5C_insert_entry(H5F_t * f, unsigned int flags) { H5C_t * cache_ptr; - herr_t result; + H5P_genplist_t *dxpl; + H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t insert_pinned; hbool_t flush_last; #ifdef H5_HAVE_PARALLEL @@ -2092,6 +1797,14 @@ H5C_insert_entry(H5F_t * f, flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); #endif /* H5_HAVE_PARALLEL */ + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a property list") + + /* Get the ring type from the DXPL */ + if((H5P_get(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to query ring value") + entry_ptr = (H5C_cache_entry_t *)thing; /* verify that the new entry isn't already in the hash table -- scream @@ -2169,6 +1882,8 @@ H5C_insert_entry(H5F_t * f, entry_ptr->flush_in_progress = FALSE; entry_ptr->destroy_in_progress = FALSE; + entry_ptr->ring = ring; + /* Initialize flush dependency height fields */ entry_ptr->flush_dep_parent = NULL; for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++) @@ -2189,13 +1904,8 @@ H5C_insert_entry(H5F_t * f, if ( ( cache_ptr->flash_size_increase_possible ) && ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { - result = H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "H5C__flash_increase_cache_size failed.") - } + if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed.") } if(cache_ptr->index_size >= cache_ptr->max_cache_size) @@ -2212,33 +1922,20 @@ H5C_insert_entry(H5F_t * f, size_t space_needed; - if ( empty_space <= entry_ptr->size ) { - + if(empty_space <= entry_ptr->size) cache_ptr->cache_full = TRUE; - } - - if ( cache_ptr->check_write_permitted != NULL ) { - - result = (cache_ptr->check_write_permitted)(f, &write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "Can't get write_permitted") - } - } else { + if(cache_ptr->check_write_permitted != NULL) { + if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "Can't get write_permitted") + } /* end if */ + else write_permitted = cache_ptr->write_permitted; - } - - HDassert( entry_ptr->size <= H5C_MAX_ENTRY_SIZE ); + HDassert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE); space_needed = entry_ptr->size; - - if ( space_needed > cache_ptr->max_cache_size ) { - + if(space_needed > cache_ptr->max_cache_size) space_needed = cache_ptr->max_cache_size; - } /* Note that space_needed is just the amount of space that * needed to insert the new entry without exceeding the cache @@ -2265,16 +1962,8 @@ H5C_insert_entry(H5F_t * f, * no point in worrying about the third. */ - result = H5C_make_space_in_cache(f, - dxpl_id, - space_needed, - write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "H5C_make_space_in_cache failed.") - } + if(H5C_make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_make_space_in_cache failed.") } H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) @@ -2896,6 +2585,8 @@ H5C_protect(H5F_t * f, unsigned flags) { H5C_t * cache_ptr; + H5P_genplist_t *dxpl; + H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t hit; hbool_t have_write_permitted = FALSE; hbool_t read_only = FALSE; @@ -2904,7 +2595,6 @@ H5C_protect(H5F_t * f, hbool_t flush_collectively; #endif /* H5_HAVE_PARALLEL */ hbool_t write_permitted; - herr_t result; size_t empty_space; void * thing; H5C_cache_entry_t * entry_ptr; @@ -2928,7 +2618,7 @@ H5C_protect(H5F_t * f, ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ "an extreme sanity check failed on entry.\n"); } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2939,10 +2629,20 @@ H5C_protect(H5F_t * f, flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); #endif /* H5_HAVE_PARALLEL */ + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "not a property list") + + /* Get the ring type from the DXPL */ + if((H5P_get(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "unable to query ring value") + /* first check to see if the target is in cache */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL) if ( entry_ptr != NULL ) { + if(entry_ptr->ring != ring) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occured for cache entry\n"); /* Check for trying to load the wrong type of entry from an address */ if(entry_ptr->type != type) @@ -2950,7 +2650,6 @@ H5C_protect(H5F_t * f, #if H5C_DO_TAGGING_SANITY_CHECKS { - H5P_genplist_t *dxpl; /* dataset transfer property list */ haddr_t tag = HADDR_UNDEF; /* The entry is already in the cache, but make sure that the tag value @@ -2959,21 +2658,15 @@ H5C_protect(H5F_t * f, and it would have received a legal tag value after getting loaded from disk. */ - /* Get the dataset transfer property list */ - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); - /* Get the tag from the DXPL */ - if( (H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0 ) + if((H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to query property value"); /* Verify tag value */ - if (cache_ptr->ignore_tags != TRUE) { - + if(cache_ptr->ignore_tags != TRUE) { /* Verify legal tag value */ - if ( (H5C_verify_tag(entry_ptr->type->id, tag)) < 0 ) + if((H5C_verify_tag(entry_ptr->type->id, tag)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed"); - } /* end if */ } #endif @@ -2996,6 +2689,8 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; + entry_ptr->ring = ring; + /* Apply tag to newly protected entry */ if(H5C_tag_entry(cache_ptr, entry_ptr, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry") @@ -3006,14 +2701,8 @@ H5C_protect(H5F_t * f, if ( ( cache_ptr->flash_size_increase_possible ) && ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { - result = H5C__flash_increase_cache_size(cache_ptr, 0, - entry_ptr->size); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "H5C__flash_increase_cache_size failed.") - } + if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__flash_increase_cache_size failed.") } if(cache_ptr->index_size >= cache_ptr->max_cache_size) @@ -3039,20 +2728,11 @@ H5C_protect(H5F_t * f, if(empty_space <= entry_ptr->size) cache_ptr->cache_full = TRUE; - if ( cache_ptr->check_write_permitted != NULL ) { - - result = (cache_ptr->check_write_permitted)(f, &write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "Can't get write_permitted 1") - - } else { - + if(cache_ptr->check_write_permitted != NULL) { + if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 1") + else have_write_permitted = TRUE; - - } } else { write_permitted = cache_ptr->write_permitted; @@ -3099,16 +2779,8 @@ H5C_protect(H5F_t * f, * see no point in worrying about the fourth. */ - result = H5C_make_space_in_cache(f, - dxpl_id, - space_needed, - write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "H5C_make_space_in_cache failed 1.") - } + if(H5C_make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_make_space_in_cache failed 1.") } /* Insert the entry in the hash table. It can't be dirty yet, so @@ -3202,19 +2874,10 @@ H5C_protect(H5F_t * f, if ( ! have_write_permitted ) { if ( cache_ptr->check_write_permitted != NULL ) { - - result = (cache_ptr->check_write_permitted)(f, &write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "Can't get write_permitted 2") - - } else { - + if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 2") + else have_write_permitted = TRUE; - - } } else { write_permitted = cache_ptr->write_permitted; @@ -3228,14 +2891,8 @@ H5C_protect(H5F_t * f, ( cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length ) ) { - result = H5C__auto_adjust_cache_size(f, - dxpl_id, - write_permitted); - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "Cache auto-resize failed.") - } + if(H5C__auto_adjust_cache_size(f, dxpl_id, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Cache auto-resize failed.") } if ( cache_ptr->size_decreased ) { @@ -3264,16 +2921,8 @@ H5C_protect(H5F_t * f, if(cache_ptr->index_size > cache_ptr->max_cache_size) cache_ptr->cache_full = TRUE; - result = H5C_make_space_in_cache(f, - dxpl_id, - (size_t)0, - write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "H5C_make_space_in_cache failed 2.") - } + if(H5C_make_space_in_cache(f, dxpl_id, (size_t)0, write_permitted) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_make_space_in_cache failed 2.") } } } @@ -5394,6 +5043,7 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) HDassert(H5F_addr_defined(child_entry->addr)); HDassert(child_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS); cache_ptr = parent_entry->cache_ptr; + HDassert(parent_entry->ring == child_entry->ring); HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr == child_entry->cache_ptr); @@ -6860,48 +6510,139 @@ done: * Programmer: John Mainzer * 3/24/065 * - * Changes: Modified function to test for slist chamges in - * pre_serialize and serialize callbacks, and re-start - * scans through the slist when such changes occur. - * - * This has been a potential problem for some time, - * and there has been code in this function to deal - * with elements of this issue. However the shift - * to the V3 cache in combination with the activities - * of some of the cache clients (in particular the - * free space manager and the fractal heap) have - * made this re-work necessary in H5C_flush_cache. - * - * At present, this issue doesn't seem to be causing problems - * in H5C_flush_invalidate_cache(). However, it seems - * prudent to port the H5C_flush_cache changes to this - * function as well. - * - * JRM -- 12/14/14 - * - * Added code to track entry size change during flush single - * entry. This didn't used to be a problem, as the entry - * was largely removed from the cache data structures before - * the flush proper. However, re-entrant calls to the cache - * in the parallel case required a re-factoring of the - * H5C__flush_single_entry() function to keep entries fully - * in the cache until after the pre-serialize and serialize - * calls. - * JRM -- 12/25/14 + *------------------------------------------------------------------------- + */ +static herr_t +H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags) +{ + H5C_t * cache_ptr; + H5C_ring_t ring; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); + +#if H5C_DO_SANITY_CHECKS +{ + int32_t i; + int32_t index_len = 0; + int32_t slist_len = 0; + size_t index_size = (size_t)0; + size_t clean_index_size = (size_t)0; + size_t dirty_index_size = (size_t)0; + size_t slist_size = (size_t)0; + + HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + + for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { + index_len += cache_ptr->index_ring_len[i]; + index_size += cache_ptr->index_ring_size[i]; + clean_index_size += cache_ptr->clean_index_ring_size[i]; + dirty_index_size += cache_ptr->dirty_index_ring_size[i]; + + slist_len += cache_ptr->slist_ring_len[i]; + slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ + + HDassert(cache_ptr->index_len == index_len); + HDassert(cache_ptr->index_size == index_size); + HDassert(cache_ptr->clean_index_size == clean_index_size); + HDassert(cache_ptr->dirty_index_size == dirty_index_size); + HDassert(cache_ptr->slist_len == slist_len); + HDassert(cache_ptr->slist_size == slist_size); +} +#endif /* H5C_DO_SANITY_CHECKS */ + + /* remove ageout markers if present */ + if(cache_ptr->epoch_markers_active > 0) + if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.") + + /* flush invalidate each ring, starting from the outermost ring and + * working inward. + */ + ring = H5C_RING_USER; + while(ring < H5C_RING_NTYPES) { + if(H5C_flush_invalidate_ring(f, dxpl_id, ring, flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed.") + ring++; + } /* end while */ + + /* Invariants, after destroying all entries in the hash table */ + HDassert(cache_ptr->index_size == 0); + HDassert(cache_ptr->clean_index_size == 0); + HDassert(cache_ptr->dirty_index_size == 0); + HDassert(cache_ptr->slist_len == 0); + HDassert(cache_ptr->slist_size == 0); + HDassert(cache_ptr->pel_len == 0); + HDassert(cache_ptr->pel_size == 0); + HDassert(cache_ptr->pl_len == 0); + HDassert(cache_ptr->pl_size == 0); + HDassert(cache_ptr->LRU_list_len == 0); + HDassert(cache_ptr->LRU_list_size == 0); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_flush_invalidate_cache() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_flush_invalidate_ring + * + * Purpose: Flush and destroy the entries contained in the target + * cache and ring. + * + * If the ring contains protected entries, the function will + * fail, as protected entries cannot be either flushed or + * destroyed. However all unprotected entries should be + * flushed and destroyed before the function returns failure. + * + * While pinned entries can usually be flushed, they cannot + * be destroyed. However, they should be unpinned when all + * the entries that reference them have been destroyed (thus + * reduding the pinned entry's reference count to 0, allowing + * it to be unpinned). + * + * If pinned entries are present, the function makes repeated + * passes through the cache, flushing all dirty entries + * (including the pinned dirty entries where permitted) and + * destroying all unpinned entries. This process is repeated + * until either the cache is empty, or the number of pinned + * entries stops decreasing on each pass. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the cache flushing + * entries in flush dependency order. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + * Programmer: John Mainzer + * 9/1/15 * *------------------------------------------------------------------------- */ static herr_t -H5C_flush_invalidate_cache(const H5F_t * f, - hid_t dxpl_id, - unsigned flags) +H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, + unsigned flags) { - H5C_t * cache_ptr = f->shared->cache; + H5C_t * cache_ptr; hbool_t restart_slist_scan; int32_t protected_entries = 0; int32_t i; - int32_t cur_pel_len; - int32_t old_pel_len; + int32_t cur_ring_pel_len; + int32_t old_ring_pel_len; int32_t passes = 0; unsigned cooked_flags; H5SL_node_t * node_ptr = NULL; @@ -6921,27 +6662,29 @@ H5C_flush_invalidate_cache(const H5F_t * f, FUNC_ENTER_NOAPI(FAIL) - HDassert( f ); - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->slist_ptr ); + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); + HDassert(ring > H5C_RING_UNDEFINED); + HDassert(ring < H5C_RING_NTYPES); + + HDassert(cache_ptr->epoch_markers_active == 0); /* Filter out the flags that are not relevant to the flush/invalidate. * At present, only the H5C__FLUSH_CLEAR_ONLY_FLAG is kept. */ cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG; - /* remove ageout markers if present */ - if(cache_ptr->epoch_markers_active > 0) - if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.") /* The flush proceedure here is a bit strange. * * In the outer while loop we make at least one pass through the - * cache, and then repeat until either all the pinned entries - * unpin themselves, or until the number of pinned entries stops - * declining. In this later case, we scream and die. + * cache, and then repeat until either all the pinned entries in + * the ring unpin themselves, or until the number of pinned entries + * in the ring stops declining. In this later case, we scream and die. * * Since the fractal heap can dirty, resize, and/or move entries * in is flush callback, it is possible that the cache will still @@ -6967,19 +6710,27 @@ H5C_flush_invalidate_cache(const H5F_t * f, * to increasing address order, but there are no guarantees. */ - cur_pel_len = cache_ptr->pel_len; - old_pel_len = cache_ptr->pel_len; + /* compute the number of pinned entries in this ring */ + entry_ptr = cache_ptr->pel_head_ptr; + cur_ring_pel_len = 0; + while(entry_ptr != NULL) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring >= ring); + if(entry_ptr->ring == ring) + cur_ring_pel_len++; - while ( cache_ptr->index_len > 0 ) - { + entry_ptr = entry_ptr->next; + } /* end while */ + + old_ring_pel_len = cur_ring_pel_len; + while(cache_ptr->index_ring_len[ring] > 0) { unsigned curr_flush_dep_height = 0; unsigned flush_dep_passes = 0; /* Loop over all flush dependency heights of entries */ while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) && - (cache_ptr->index_len > 0 ) && - (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH) ) - { + (cache_ptr->index_ring_len[ring] > 0) && + (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH)) { hbool_t flushed_during_dep_loop = FALSE; /* first, try to flush-destroy any dirty entries. Do this by @@ -7034,37 +6785,27 @@ H5C_flush_invalidate_cache(const H5F_t * f, cache_ptr->slist_change_in_serialize = FALSE; /* this done, start the scan of the slist */ - restart_slist_scan = TRUE; - - while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) - { - if ( restart_slist_scan ) - { + while(restart_slist_scan || (node_ptr != NULL)) { + if(restart_slist_scan) { restart_slist_scan = FALSE; /* Start at beginning of skip list */ node_ptr = H5SL_first(cache_ptr->slist_ptr); - - if ( node_ptr == NULL ) - { + if(node_ptr == NULL) /* the slist is empty -- break out of inner loop */ break; - } - HDassert( node_ptr != NULL ); /* Get cache entry for this node */ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL ?!?!") - - HDassert( next_entry_ptr->magic == \ - H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - } + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + HDassert(next_entry_ptr->ring >= ring); + } /* end if */ entry_ptr = next_entry_ptr; @@ -7079,27 +6820,27 @@ H5C_flush_invalidate_cache(const H5F_t * f, * slist if we find them. However, best we do some extra * sanity checking just in case. */ - - HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( entry_ptr->in_slist ); - HDassert( entry_ptr->is_dirty ); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->in_slist); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->ring >= ring); /* increment node pointer now, before we delete its target * from the slist. */ - node_ptr = H5SL_next(node_ptr); - if ( node_ptr != NULL ) { + if(node_ptr != NULL) { next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( NULL == next_entry_ptr ) + if(NULL == next_entry_ptr) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - HDassert( entry_ptr != next_entry_ptr ); - } else { + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + HDassert(next_entry_ptr->ring >= ring); + HDassert(entry_ptr != next_entry_ptr); + } /* end if */ + else next_entry_ptr = NULL; - } /* Note that we now remove nodes from the slist as we flush * the associated entries, instead of leaving them there @@ -7111,30 +6852,26 @@ H5C_flush_invalidate_cache(const H5F_t * f, * flush, we must keep the slist in cannonical form at all * times. */ - - HDassert( entry_ptr != NULL ); - HDassert( entry_ptr->in_slist ); - - if ( ( ! entry_ptr->flush_me_last ) || - ( ( entry_ptr->flush_me_last ) && - ( cache_ptr->num_last_entries >= - cache_ptr->slist_len ) ) ) { - - if ( entry_ptr->is_protected ) { - + HDassert(entry_ptr != NULL); + HDassert(entry_ptr->in_slist); + + if(((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && + (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->ring == ring)) { + if(entry_ptr->is_protected) { /* we have major problems -- but lets flush * everything we can before we flag an error. */ protected_entries++; - - } else if ( entry_ptr->is_pinned ) { + } else if(entry_ptr->is_pinned) { /* Test to see if we are can flush the entry now. * If we can, go ahead and flush, but don't tell * H5C__flush_single_entry() to destroy the entry * as pinned entries can't be evicted. */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ) { + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { #if H5C_DO_SANITY_CHECKS /* update flushed_slist_len & flushed_slist_size * before the flush. Note that the entry will @@ -7151,7 +6888,6 @@ H5C_flush_invalidate_cache(const H5F_t * f, if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, entry_size_change_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") - #if H5C_DO_SANITY_CHECKS /* entry size may have changed during the flush. * Update flushed_slist_size to account for this. @@ -7160,10 +6896,8 @@ H5C_flush_invalidate_cache(const H5F_t * f, #endif /* H5C_DO_SANITY_CHECKS */ flushed_during_dep_loop = TRUE; - - if ( ( cache_ptr->slist_change_in_serialize ) || - ( cache_ptr->slist_change_in_pre_serialize ) ) - { + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { /* The slist has been modified by something * other than the simple removal of the * of the flushed entry after the flush. @@ -7172,18 +6906,17 @@ H5C_flush_invalidate_cache(const H5F_t * f, * scan through the slist, so restart it. */ restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize - = FALSE; + cache_ptr->slist_change_in_pre_serialize = FALSE; cache_ptr->slist_change_in_serialize = FALSE; H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); - } + } /* end if */ } /* end if */ else if(entry_ptr->flush_dep_height < curr_flush_dep_height) /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") } /* end if */ else { - if(entry_ptr->flush_dep_height == curr_flush_dep_height ){ + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { #if H5C_DO_SANITY_CHECKS /* update flushed_slist_len & flushed_slist_size * before the flush. Note that the entry will @@ -7198,9 +6931,10 @@ H5C_flush_invalidate_cache(const H5F_t * f, entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), entry_size_change_ptr) < 0) + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), + entry_size_change_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed.") - #if H5C_DO_SANITY_CHECKS /* entry size may have changed during the flush. * Update flushed_slist_size to account for this. @@ -7210,9 +6944,8 @@ H5C_flush_invalidate_cache(const H5F_t * f, flushed_during_dep_loop = TRUE; - if ((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) - { + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { /* The slist has been modified by something * other than the simple removal of the * of the flushed entry after the flush. @@ -7221,15 +6954,14 @@ H5C_flush_invalidate_cache(const H5F_t * f, * scan through the slist, so restart it. */ restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize - = FALSE; + cache_ptr->slist_change_in_pre_serialize = FALSE; cache_ptr->slist_change_in_serialize = FALSE; H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } + } /* end if */ } /* end if */ else if(entry_ptr->flush_dep_height < curr_flush_dep_height) /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") } /* end else */ } /* end if */ } /* end while loop scanning skip list */ @@ -7244,13 +6976,12 @@ H5C_flush_invalidate_cache(const H5F_t * f, * out from under us. */ - if ( node_ptr == NULL ) { - - HDassert( (flushed_slist_len + cache_ptr->slist_len) == - (initial_slist_len + cache_ptr->slist_len_increase) ); - HDassert( (flushed_slist_size + (int64_t)cache_ptr->slist_size) == - ((int64_t)initial_slist_size + cache_ptr->slist_size_increase) ); - } + if(node_ptr == NULL) { + HDassert((flushed_slist_len + cache_ptr->slist_len) == + (initial_slist_len + cache_ptr->slist_len_increase)); + HDassert((flushed_slist_size + (int64_t)cache_ptr->slist_size) == + ((int64_t)initial_slist_size + cache_ptr->slist_size_increase)); + } /* end if */ #endif /* H5C_DO_SANITY_CHECKS */ /* Since we are doing a destroy, we must make a pass through @@ -7264,42 +6995,37 @@ H5C_flush_invalidate_cache(const H5F_t * f, * * Writes to disk are possible here. */ - for ( i = 0; i < H5C__HASH_TABLE_LEN; i++ ) - { + for(i = 0; i < H5C__HASH_TABLE_LEN; i++) { next_entry_ptr = cache_ptr->index[i]; - while ( next_entry_ptr != NULL ) - { + while(next_entry_ptr != NULL) { entry_ptr = next_entry_ptr; - HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring >= ring); next_entry_ptr = entry_ptr->ht_next; - HDassert ( ( next_entry_ptr == NULL ) || - ( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ) ); + HDassert((next_entry_ptr == NULL) || + (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC)); - if ( ( ! entry_ptr->flush_me_last ) || - ( ( entry_ptr->flush_me_last ) && - ( cache_ptr->num_last_entries >= - cache_ptr->slist_len ) ) ) { - - if ( entry_ptr->is_protected ) { + if(((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && + (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->ring == ring)) { + if(entry_ptr->is_protected) { /* we have major problems -- but lets flush and * destroy everything we can before we flag an * error. */ protected_entries++; - - if ( ! entry_ptr->in_slist ) { - - HDassert( !(entry_ptr->is_dirty) ); - } - } else if ( ! ( entry_ptr->is_pinned ) ) { + if(!entry_ptr->in_slist) + HDassert(!(entry_ptr->is_dirty)); + } else if(!(entry_ptr->is_pinned)) { /* Test to see if we are can flush the entry now. * If we can, go ahead and flush. */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ){ + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { /* if *entry_ptr is dirty, it is possible * that one or more other entries may be * either removed from the cache, loaded @@ -7327,24 +7053,25 @@ H5C_flush_invalidate_cache(const H5F_t * f, entry_was_dirty = entry_ptr->is_dirty; - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), NULL) < 0) + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), + NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed.") - if ( entry_was_dirty ) { - + if(entry_was_dirty) { /* update stats for hash bucket scan * restart here. * -- JRM */ next_entry_ptr = cache_ptr->index[i]; H5C__UPDATE_STATS_FOR_HASH_BUCKET_SCAN_RESTART(cache_ptr) - } + } /* end if */ flushed_during_dep_loop = TRUE; } /* end if */ else if(entry_ptr->flush_dep_height < curr_flush_dep_height) /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") } /* end if */ } /* end if */ /* We can't do anything if the entry is pinned. The @@ -7371,16 +7098,11 @@ H5C_flush_invalidate_cache(const H5F_t * f, * in case I am wrong. * -- JRM */ - if ( ( next_entry_ptr != NULL ) && - ( next_entry_ptr->magic != - H5C__H5C_CACHE_ENTRY_T_MAGIC ) ) { - + if((next_entry_ptr != NULL) && (next_entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC)) /* Something horrible has happened to * *next_entry_ptr -- scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr->magic is invalid?!?!?.") - } + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr->magic is invalid?!?!?.") } /* end while loop scanning hash table bin */ } /* end for loop scanning hash table */ @@ -7399,68 +7121,439 @@ H5C_flush_invalidate_cache(const H5F_t * f, } /* end while loop over flush dependency heights */ - old_pel_len = cur_pel_len; - cur_pel_len = cache_ptr->pel_len; - - if ( ( cur_pel_len > 0 ) && ( cur_pel_len >= old_pel_len ) ) { - - /* The number of pinned entries is positive, and it is not - * declining. Scream and die. - */ + old_ring_pel_len = cur_ring_pel_len; + entry_ptr = cache_ptr->pel_head_ptr; + cur_ring_pel_len = 0; + while(entry_ptr != NULL) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring >= ring); - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Pinned entry count not decreasing, cur_pel_len = %d, old_pel_len = %d", (int)cur_pel_len, (int)old_pel_len) + if(entry_ptr->ring == ring) + cur_ring_pel_len++; - } else if ( ( cur_pel_len == 0 ) && ( old_pel_len == 0 ) ) { + entry_ptr = entry_ptr->next; + } /* end while */ + if((cur_ring_pel_len > 0) && (cur_ring_pel_len >= old_ring_pel_len)) { + /* The number of pinned entries in the ring is positive, and + * it is not declining. Scream and die. + */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = %d, ring = %d", (int)cur_ring_pel_len, (int)old_ring_pel_len, (int)ring) + } else if((cur_ring_pel_len == 0) && (old_ring_pel_len == 0)) { /* increment the pass count */ passes++; } - if ( passes >= H5C__MAX_PASSES_ON_FLUSH ) { - + if(passes >= H5C__MAX_PASSES_ON_FLUSH) /* we have exceeded the maximum number of passes through the * cache to flush and destroy all entries. Scream and die. */ - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Maximum passes on flush exceeded.") - } + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Maximum passes on flush exceeded.") } /* main while loop */ - /* Invariants, after destroying all entries in the hash table */ - HDassert( cache_ptr->index_size == 0 ); - HDassert( cache_ptr->clean_index_size == 0 ); - HDassert( cache_ptr->dirty_index_size == 0 ); - HDassert( cache_ptr->slist_len == 0 ); - HDassert( cache_ptr->slist_size == 0 ); - HDassert( cache_ptr->pel_len == 0 ); - HDassert( cache_ptr->pel_size == 0 ); - HDassert( cache_ptr->pl_len == 0 ); - HDassert( cache_ptr->pl_size == 0 ); - HDassert( cache_ptr->LRU_list_len == 0 ); - HDassert( cache_ptr->LRU_list_size == 0 ); + /* Invariants, after destroying all entries in the ring */ + for(i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++) { + HDassert(cache_ptr->index_ring_len[i] == 0); + HDassert(cache_ptr->index_ring_size[i] == (size_t)0); + HDassert(cache_ptr->clean_index_ring_size[i] == (size_t)0); + HDassert(cache_ptr->dirty_index_ring_size[i] == (size_t)0); + + HDassert(cache_ptr->slist_ring_len[i] == 0); + HDassert(cache_ptr->slist_ring_size[i] == (size_t)0); + } /* end for */ + + HDassert(protected_entries <= cache_ptr->pl_len); + if(protected_entries > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries.") + else if(cur_ring_pel_len > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring.") - HDassert( protected_entries <= cache_ptr->pl_len ); +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_flush_invalidate_ring() */ - if ( protected_entries > 0 ) { + +/*------------------------------------------------------------------------- + * Function: H5C_flush_ring + * + * Purpose: Flush the entries contained in the specified cache and + * ring. All entries in rings outside the specified ring + * must have been flushed on entry. + * + * If the cache contains protected entries in the specified + * ring, the function will fail, as protected entries cannot + * be flushed. However all unprotected entries in the target + * ring should be flushed before the function returns failure. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the slist flushing + * entries in flush dependency order. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + * Programmer: John Mainzer + * 9/1/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) +{ + H5C_t * cache_ptr = f->shared->cache; + hbool_t flushed_entries_last_pass; + hbool_t flush_marked_entries; + hbool_t ignore_protected; + hbool_t tried_to_flush_protected_entry = FALSE; + hbool_t restart_slist_scan; + int32_t passes = 0; + int32_t protected_entries = 0; + H5SL_node_t * node_ptr = NULL; + H5C_cache_entry_t * entry_ptr = NULL; + H5C_cache_entry_t * next_entry_ptr = NULL; +#if H5C_DO_SANITY_CHECKS + int64_t flushed_entries_count = 0; + int64_t flushed_entries_size = 0; + int64_t initial_slist_len = 0; + size_t initial_slist_size = 0; + int64_t entry_size_change; + int64_t * entry_size_change_ptr = &entry_size_change; +#else /* H5C_DO_SANITY_CHECKS */ + int64_t * entry_size_change_ptr = NULL; +#endif /* H5C_DO_SANITY_CHECKS */ + int i; + herr_t ret_value = SUCCEED; - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Cache has protected entries.") + FUNC_ENTER_NOAPI(FAIL) - } else if ( cur_pel_len > 0 ) { + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); + HDassert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0); + HDassert(ring > H5C_RING_UNDEFINED); + HDassert(ring < H5C_RING_NTYPES); - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Can't unpin all pinned entries.") +#if H5C_DO_EXTREME_SANITY_CHECKS + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0 || + (H5C_validate_lru_list(cache_ptr) < 0)) { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - } + ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); + flush_marked_entries = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ); -done: + if(!flush_marked_entries) + for(i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) + HDassert(cache_ptr->slist_ring_len[i] == 0); - FUNC_LEAVE_NOAPI(ret_value) + HDassert(cache_ptr->flush_in_progress); -} /* H5C_flush_invalidate_cache() */ + /* When we are only flushing marked entries, the slist will usually + * still contain entries when we have flushed everything we should. + * Thus we track whether we have flushed any entries in the last + * pass, and terminate if we haven't. + */ + flushed_entries_last_pass = TRUE; + + /* set the cache_ptr->slist_change_in_pre_serialize and + * cache_ptr->slist_change_in_serialize to false. + * + * These flags are set to TRUE by H5C__flush_single_entry if the + * slist is modified by a pre_serialize or serialize call respectively. + * H5C_flush_cache uses these flags to detect any modifications + * to the slist that might corrupt the scan of the slist -- and + * restart the scan in this event. + */ + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + + while((passes < H5C__MAX_PASSES_ON_FLUSH) && + (cache_ptr->slist_ring_len[ring] > 0) && + (protected_entries == 0) && + (flushed_entries_last_pass)) { + unsigned curr_flush_dep_height = 0; + unsigned flush_dep_passes = 0; + + flushed_entries_last_pass = FALSE; + + /* Loop over all flush dependency heights of entries */ + while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) && + (cache_ptr->slist_ring_len[ring] > 0) && + (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH)) { + hbool_t flushed_during_dep_loop = FALSE; + +#if H5C_DO_SANITY_CHECKS + /* For sanity checking, try to verify that the skip list has + * the expected size and number of entries at the end of each + * internal while loop (see below). + * + * Doing this get a bit tricky, as depending on flags, we may + * or may not flush all the entries in the slist. + * + * To make things more entertaining, with the advent of the + * fractal heap, the entry serialize callback can cause entries + * to be dirtied, resized, and/or moved. Also, the + * pre_serialize callback can result in an entry being + * removed from the cache via the take ownership flag. + * + * To deal with this, we first make note of the initial + * skip list length and size: + */ + initial_slist_len = cache_ptr->slist_len; + initial_slist_size = cache_ptr->slist_size; + + /* We then zero counters that we use to track the number + * and total size of entries flushed: + */ + flushed_entries_count = 0; + flushed_entries_size = 0; + + /* As mentioned above, there is the possibility that + * entries will be dirtied, resized, flushed, or removed + * from the cache via the take ownership flag during + * our pass through the skip list. To capture the number + * of entries added, and the skip list size delta, + * zero the slist_len_increase and slist_size_increase of + * the cache's instance of H5C_t. These fields will be + * updated elsewhere to account for slist insertions and/or + * dirty entry size changes. + */ + cache_ptr->slist_len_increase = 0; + cache_ptr->slist_size_increase = 0; + + /* at the end of the loop, use these values to compute the + * expected slist length and size and compare this with the + * value recorded in the cache's instance of H5C_t. + */ +#endif /* H5C_DO_SANITY_CHECKS */ + + restart_slist_scan = TRUE; + + while((restart_slist_scan ) || (node_ptr != NULL)) { + if(restart_slist_scan) { + restart_slist_scan = FALSE; + + /* Start at beginning of skip list */ + node_ptr = H5SL_first(cache_ptr->slist_ptr); + + if(node_ptr == NULL) + /* the slist is empty -- break out of inner loop */ + break; + + /* Get cache entry for this node */ + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + } /* end if */ + + entry_ptr = next_entry_ptr; + + /* With the advent of the fractal heap, the free space + * manager, and the version 3 cache, it is possible + * that the pre-serialize or serialize callback will + * dirty, resize, or take ownership of other entries + * in the cache. + * + * To deal with this, I have inserted code to detect any + * change in the skip list not directly under the control + * of this function. If such modifications are detected, + * we must re-start the scan of the skip list to avoid + * the possibility that the target of the next_entry_ptr + * may have been flushed or deleted from the cache. + * + * To verify that all such possibilities have been dealt + * with, we do a bit of extra sanity checking on + * entry_ptr. + */ + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->in_slist); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->ring >= ring); + + /* increment node pointer now, before we delete its target + * from the slist. + */ + node_ptr = H5SL_next(node_ptr); + if(node_ptr != NULL) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + HDassert(next_entry_ptr->ring >= ring); + HDassert(entry_ptr != next_entry_ptr); + } /* end if */ + else + next_entry_ptr = NULL; + + HDassert(entry_ptr != NULL); + HDassert(entry_ptr->in_slist); + + if(((!flush_marked_entries) || (entry_ptr->flush_marker)) && + ((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && + (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->ring == ring)) { + if(entry_ptr->is_protected) { + /* we probably have major problems -- but lets + * flush everything we can before we decide + * whether to flag an error. + */ + tried_to_flush_protected_entry = TRUE; + protected_entries++; + } /* end if */ + else if(entry_ptr->is_pinned) { + + /* Test to see if we are can flush the entry now. + * If we can, go ahead and flush. Note that we + * aren't trying to do a destroy here, so that + * is not an issue. + */ + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { +#if H5C_DO_SANITY_CHECKS + flushed_entries_count++; + flushed_entries_size += (int64_t)entry_ptr->size; + entry_size_change = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") + +#if H5C_DO_SANITY_CHECKS + /* it is possible that the entry size changed + * during flush -- update flushed_entries_size + * to account for this. + */ + flushed_entries_size += entry_size_change; +#endif /* H5C_DO_SANITY_CHECKS */ + + flushed_during_dep_loop = TRUE; + + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) + } /* end if */ + } /* end if */ + else if(entry_ptr->flush_dep_height < curr_flush_dep_height) + /* This shouldn't happen -- if it does, just scream and die. */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + } /* end else-if */ + else { + /* Test to see if we are can flush the entry now. + * If we can, go ahead and flush. Note that we + * aren't trying to do a destroy here, so that + * is not an issue. + */ + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { +#if H5C_DO_SANITY_CHECKS + flushed_entries_count++; + flushed_entries_size += (int64_t)entry_ptr->size; + entry_size_change = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") + +#if H5C_DO_SANITY_CHECKS + /* it is possible that the entry size changed + * during flush -- update flushed_entries_size + * to account for this. + */ + flushed_entries_size += entry_size_change; +#endif /* H5C_DO_SANITY_CHECKS */ + + flushed_during_dep_loop = TRUE; + + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) + } /* end if */ + } /* end if */ + else if(entry_ptr->flush_dep_height < curr_flush_dep_height) + /* This shouldn't happen -- if it does, just scream and die. */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + } /* end else */ + } /* end if */ + } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ + + /* Check for incrementing flush dependency height */ + if(flushed_during_dep_loop) { + + /* If we flushed an entry at this flush dependency height + * start over at the bottom level of the flush dependencies + */ + curr_flush_dep_height = 0; + + /* Make certain we don't get stuck in an infinite loop */ + flush_dep_passes++; + + /* Set flag for outer loop */ + flushed_entries_last_pass = TRUE; + } /* end if */ + else + curr_flush_dep_height++; + } /* while ( curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) */ + + passes++; + +#if H5C_DO_SANITY_CHECKS + /* Verify that the slist size and length are as expected. */ + HDassert((initial_slist_len + cache_ptr->slist_len_increase - + flushed_entries_count) == cache_ptr->slist_len); + HDassert((size_t)((int64_t)initial_slist_size + + cache_ptr->slist_size_increase - + flushed_entries_size) == cache_ptr->slist_size); +#endif /* H5C_DO_SANITY_CHECKS */ + } /* while */ + + HDassert(protected_entries <= cache_ptr->pl_len); + + if(((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items") + + if((cache_ptr->slist_len != 0) && (passes >= H5C__MAX_PASSES_ON_FLUSH)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush pass limit exceeded.") + +#if H5C_DO_SANITY_CHECKS + if(!flush_marked_entries) { + HDassert(cache_ptr->slist_ring_len[ring] == 0); + HDassert(cache_ptr->slist_ring_size[ring] == 0); + } /* end if */ +#endif /* H5C_DO_SANITY_CHECKS */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_flush_ring() */ /*------------------------------------------------------------------------- @@ -7550,6 +7643,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(entry_ptr); + HDassert(entry_ptr->ring != H5C_RING_UNDEFINED); /* If defined, initialize *entry_size_change_ptr to 0 */ if(entry_size_change_ptr != NULL) @@ -7630,7 +7724,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ unsigned coll_meta; /* Collective metadata write flag */ /* Get the dataset transfer property list */ - if(NULL == (dxpl = H5I_object(dxpl_id))) + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Get the collective metadata write property */ @@ -8558,6 +8652,8 @@ H5C_load_entry(H5F_t * f, entry->flush_in_progress = FALSE; entry->destroy_in_progress = FALSE; + entry->ring = H5C_RING_UNDEFINED; + /* Initialize flush dependency height fields */ entry->flush_dep_parent = NULL; for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++) @@ -9925,3 +10021,47 @@ H5C_retag_copied_metadata(H5C_t * cache_ptr, haddr_t metadata_tag) FUNC_LEAVE_NOAPI_VOID } /* H5C_retag_copied_metadata */ + +/*------------------------------------------------------------------------- + * Function: H5C_get_entry_ring + * + * Purpose: Given a file address, retrieve the ring for an entry at that + * address. + * + * On error, the value of *ring is not modified. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 9/8/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring) +{ + H5C_t *cache_ptr; /* Pointer to cache */ + H5C_cache_entry_t *entry_ptr; /* Pointer to cache entry at address */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(H5F_addr_defined(addr)); + + /* Locate the entry at the address */ + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + HDassert(entry_ptr); + + /* Return the ring value */ + *ring = entry_ptr->ring; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_get_entry_ring() */ + diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 7d9d0f9..ea965fd 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -824,6 +824,12 @@ if ( ( (entry_ptr) == NULL ) || \ * * JRM -- 11/5/08 * + * - Updated existing index macros and sanity check macros to maintain + * the index_ring_len, index_ring_size, clean_index_ring_size, and + * dirty_index_ring_size fields of H5C_t. + * + * JRM -- 9/1/15 + * ***********************************************************************/ /* H5C__HASH_TABLE_LEN is defined in H5Cpkg.h. It mut be a power of two. */ @@ -848,7 +854,17 @@ if ( ( (cache_ptr) == NULL ) || \ ((cache_ptr)->clean_index_size + \ (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ "Pre HT insert SC failed") \ } @@ -860,7 +876,16 @@ if ( ( (cache_ptr) == NULL ) || \ ((cache_ptr)->clean_index_size + \ (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] == 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ "Post HT insert SC failed") \ } @@ -887,7 +912,20 @@ if ( ( (cache_ptr) == NULL ) || \ ((cache_ptr)->clean_index_size + \ (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] < \ + (entry_ptr)->size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Pre HT remove SC failed") \ } @@ -903,7 +941,15 @@ if ( ( (cache_ptr) == NULL ) || \ ((cache_ptr)->clean_index_size + \ (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Post HT remove SC failed") \ } @@ -971,7 +1017,18 @@ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->clean_index_size < (old_size) ) ) && \ ( ( (was_clean) ) || \ ( (cache_ptr)->dirty_index_size < (old_size) ) ) ) || \ - ( (entry_ptr) == NULL ) ) { \ + ( (entry_ptr) == NULL ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Pre HT entry size change SC failed") \ } @@ -992,7 +1049,15 @@ if ( ( (cache_ptr) == NULL ) || \ ( ( ((entry_ptr)->is_dirty) ) || \ ( (cache_ptr)->clean_index_size < (new_size) ) ) ) || \ ( ( (cache_ptr)->index_len == 1 ) && \ - ( (cache_ptr)->index_size != (new_size) ) ) ) { \ + ( (cache_ptr)->index_size != (new_size) ) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Post HT entry size change SC failed") \ } @@ -1009,7 +1074,18 @@ if ( \ ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Pre HT update for entry clean SC failed") \ } @@ -1026,7 +1102,18 @@ if ( \ ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Pre HT update for entry dirty SC failed") \ } @@ -1035,7 +1122,15 @@ if ( \ if ( ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Post HT update for entry clean SC failed") \ } @@ -1044,7 +1139,15 @@ if ( ( (cache_ptr)->index_size != \ if ( ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Post HT update for entry dirty SC failed") \ } @@ -1070,30 +1173,38 @@ if ( ( (cache_ptr)->index_size != \ #endif /* H5C_DO_SANITY_CHECKS */ -#define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \ -{ \ - int k; \ - H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ - k = H5C__HASH_FCN((entry_ptr)->addr); \ - if ( ((cache_ptr)->index)[k] == NULL ) \ - ((cache_ptr)->index)[k] = (entry_ptr); \ - else { \ - (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ - (entry_ptr)->ht_next->ht_prev = (entry_ptr); \ - ((cache_ptr)->index)[k] = (entry_ptr); \ - } \ - (cache_ptr)->index_len++; \ - (cache_ptr)->index_size += (entry_ptr)->size; \ - if ( (entry_ptr)->is_dirty ) \ - (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ - else \ - (cache_ptr)->clean_index_size += (entry_ptr)->size; \ - if ((entry_ptr)->flush_me_last) { \ - (cache_ptr)->num_last_entries++; \ - HDassert((cache_ptr)->num_last_entries <= 2); \ - } \ - H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \ - H5C__POST_HT_INSERT_SC(cache_ptr, fail_val) \ +#define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \ +{ \ + int k; \ + H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ + k = H5C__HASH_FCN((entry_ptr)->addr); \ + if ( ((cache_ptr)->index)[k] == NULL ) \ + ((cache_ptr)->index)[k] = (entry_ptr); \ + else { \ + (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ + (entry_ptr)->ht_next->ht_prev = (entry_ptr); \ + ((cache_ptr)->index)[k] = (entry_ptr); \ + } \ + (cache_ptr)->index_len++; \ + (cache_ptr)->index_size += (entry_ptr)->size; \ + ((cache_ptr)->index_ring_len[entry_ptr->ring])++; \ + ((cache_ptr)->index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ + if ( (entry_ptr)->is_dirty ) { \ + (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ + } else { \ + (cache_ptr)->clean_index_size += (entry_ptr)->size; \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ + } \ + if ((entry_ptr)->flush_me_last) { \ + (cache_ptr)->num_last_entries++; \ + HDassert((cache_ptr)->num_last_entries <= 2); \ + } \ + H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \ + H5C__POST_HT_INSERT_SC(cache_ptr, fail_val) \ } #define H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr) \ @@ -1111,10 +1222,18 @@ if ( ( (cache_ptr)->index_size != \ (entry_ptr)->ht_prev = NULL; \ (cache_ptr)->index_len--; \ (cache_ptr)->index_size -= (entry_ptr)->size; \ - if ( (entry_ptr)->is_dirty ) \ + ((cache_ptr)->index_ring_len[entry_ptr->ring])--; \ + ((cache_ptr)->index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ + if ( (entry_ptr)->is_dirty ) { \ (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ - else \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ + } else { \ (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ + } \ if ((entry_ptr)->flush_me_last) { \ (cache_ptr)->num_last_entries--; \ HDassert((cache_ptr)->num_last_entries <= 1); \ @@ -1182,7 +1301,11 @@ if ( ( (cache_ptr)->index_size != \ { \ H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \ (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ (cache_ptr)->clean_index_size += (entry_ptr)->size; \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \ } @@ -1190,27 +1313,39 @@ if ( ( (cache_ptr)->index_size != \ { \ H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \ (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \ } -#define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ -{ \ - H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ - (cache_ptr)->index_size -= (old_size); \ - (cache_ptr)->index_size += (new_size); \ - if ( was_clean ) \ - (cache_ptr)->clean_index_size -= (old_size); \ - else \ - (cache_ptr)->dirty_index_size -= (old_size); \ - if ( (entry_ptr)->is_dirty ) \ - (cache_ptr)->dirty_index_size += (new_size); \ - else \ - (cache_ptr)->clean_index_size += (new_size); \ - H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr) \ +#define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \ + entry_ptr, was_clean) \ +{ \ + H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ + entry_ptr, was_clean) \ + (cache_ptr)->index_size -= (old_size); \ + (cache_ptr)->index_size += (new_size); \ + ((cache_ptr)->index_ring_size[entry_ptr->ring]) -= (old_size); \ + ((cache_ptr)->index_ring_size[entry_ptr->ring]) += (new_size); \ + if ( was_clean ) { \ + (cache_ptr)->clean_index_size -= (old_size); \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])-= (old_size); \ + } else { \ + (cache_ptr)->dirty_index_size -= (old_size); \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])-= (old_size); \ + } \ + if ( (entry_ptr)->is_dirty ) { \ + (cache_ptr)->dirty_index_size += (new_size); \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])+= (new_size); \ + } else { \ + (cache_ptr)->clean_index_size += (new_size); \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])+= (new_size); \ + } \ + H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ + entry_ptr) \ } @@ -1275,6 +1410,10 @@ if ( ( (cache_ptr)->index_size != \ * Added code to set cache_ptr->slist_changed to TRUE * when an entry is inserted in the slist. * + * JRM -- 9/1/15 + * Added code to maintain the cache_ptr->slist_ring_len + * and cache_ptr->slist_ring_size arrays. + * *------------------------------------------------------------------------- */ @@ -1296,6 +1435,12 @@ if ( ( (cache_ptr)->index_size != \ HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ HDassert( !((entry_ptr)->in_slist) ); \ HDassert( !ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ \ if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ @@ -1305,6 +1450,8 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->slist_changed = TRUE; \ (cache_ptr)->slist_len++; \ (cache_ptr)->slist_size += (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size; \ (cache_ptr)->slist_len_increase++; \ (cache_ptr)->slist_size_increase += (int64_t)((entry_ptr)->size); \ \ @@ -1324,6 +1471,12 @@ if ( ( (cache_ptr)->index_size != \ HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ HDassert( !((entry_ptr)->in_slist) ); \ HDassert( !ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ \ if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ @@ -1333,6 +1486,8 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->slist_changed = TRUE; \ (cache_ptr)->slist_len++; \ (cache_ptr)->slist_size += (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size; \ \ HDassert( (cache_ptr)->slist_len > 0 ); \ HDassert( (cache_ptr)->slist_size > 0 ); \ @@ -1375,32 +1530,46 @@ if ( ( (cache_ptr)->index_size != \ * Added code to set cache_ptr->slist_changed to TRUE * when an entry is removed from the slist. * + * JRM -- 9/1/15 + * Added code to maintain the cache_ptr->slist_ring_len + * and cache_ptr->slist_ring_size arrays. + * *------------------------------------------------------------------------- */ -#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( (entry_ptr)->in_slist ); \ - HDassert( (cache_ptr)->slist_ptr ); \ - \ - if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ - != (entry_ptr) ) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ - "Can't delete entry from skip list.") \ - \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - (cache_ptr)->slist_changed = TRUE; \ - (cache_ptr)->slist_len--; \ - HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ - (cache_ptr)->slist_size -= (entry_ptr)->size; \ - (entry_ptr)->in_slist = FALSE; \ +#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + HDassert( !((entry_ptr)->is_protected) ); \ + HDassert( !((entry_ptr)->is_read_only) ); \ + HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ + HDassert( (entry_ptr)->size > 0 ); \ + HDassert( (entry_ptr)->in_slist ); \ + HDassert( (cache_ptr)->slist_ptr ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ + != (entry_ptr) ) \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ + "Can't delete entry from skip list.") \ + \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + (cache_ptr)->slist_changed = TRUE; \ + (cache_ptr)->slist_len--; \ + HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ + (cache_ptr)->slist_size -= (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ + (entry_ptr)->size ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size; \ + (entry_ptr)->in_slist = FALSE; \ } /* H5C__REMOVE_ENTRY_FROM_SLIST */ @@ -1432,52 +1601,76 @@ if ( ( (cache_ptr)->index_size != \ * in this case, as the structure of the slist is not * modified. * + * JRM -- 9/1/15 + * Added code to maintain the cache_ptr->slist_ring_len + * and cache_ptr->slist_ring_size arrays. + * *------------------------------------------------------------------------- */ #if H5C_DO_SANITY_CHECKS -#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (old_size) > 0 ); \ - HDassert( (new_size) > 0 ); \ - HDassert( (old_size) <= (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( ((cache_ptr)->slist_len > 1) || \ - ( (cache_ptr)->slist_size == (old_size) ) ); \ - \ - (cache_ptr)->slist_size -= (old_size); \ - (cache_ptr)->slist_size += (new_size); \ - \ - (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ - (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ - \ - HDassert( (new_size) <= (cache_ptr)->slist_size ); \ - HDassert( ( (cache_ptr)->slist_len > 1 ) || \ - ( (cache_ptr)->slist_size == (new_size) ) ); \ +#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (old_size) > 0 ); \ + HDassert( (new_size) > 0 ); \ + HDassert( (old_size) <= (cache_ptr)->slist_size ); \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + HDassert( ((cache_ptr)->slist_len > 1) || \ + ( (cache_ptr)->slist_size == (old_size) ) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + (cache_ptr)->slist_size -= (old_size); \ + (cache_ptr)->slist_size += (new_size); \ + \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >=(old_size) ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ + \ + (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ + (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ + \ + HDassert( (new_size) <= (cache_ptr)->slist_size ); \ + HDassert( ( (cache_ptr)->slist_len > 1 ) || \ + ( (cache_ptr)->slist_size == (new_size) ) ); \ } /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ #else /* H5C_DO_SANITY_CHECKS */ -#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (old_size) > 0 ); \ - HDassert( (new_size) > 0 ); \ - HDassert( (old_size) <= (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( ((cache_ptr)->slist_len > 1) || \ - ( (cache_ptr)->slist_size == (old_size) ) ); \ - \ - (cache_ptr)->slist_size -= (old_size); \ - (cache_ptr)->slist_size += (new_size); \ - \ - HDassert( (new_size) <= (cache_ptr)->slist_size ); \ - HDassert( ( (cache_ptr)->slist_len > 1 ) || \ - ( (cache_ptr)->slist_size == (new_size) ) ); \ +#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (old_size) > 0 ); \ + HDassert( (new_size) > 0 ); \ + HDassert( (old_size) <= (cache_ptr)->slist_size ); \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + HDassert( ((cache_ptr)->slist_len > 1) || \ + ( (cache_ptr)->slist_size == (old_size) ) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + (cache_ptr)->slist_size -= (old_size); \ + (cache_ptr)->slist_size += (new_size); \ + \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >=(old_size) ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ + \ + HDassert( (new_size) <= (cache_ptr)->slist_size ); \ + HDassert( ( (cache_ptr)->slist_len > 1 ) || \ + ( (cache_ptr)->slist_size == (new_size) ) ); \ } /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ #endif /* H5C_DO_SANITY_CHECKS */ @@ -2854,6 +3047,16 @@ if ( ( (cache_ptr)->index_size != \ * index_size by three should yield a conservative estimate * of the cache's memory footprint. * + * index_ring_len: Array of integer of length H5C_RING_NTYPES used to + * maintain a count of entries in the index by ring. Note + * that the sum of all the cells in this array must equal + * the value stored in index_len above. + * + * index_ring_size: Array of size_t of length H5C_RING_NTYPES used to + * maintain the sum of the sizes of all entries in the index + * by ring. Note that the sum of all cells in this array must + * equal the value stored in index_size above. + * * clean_index_size: Number of bytes of clean entries currently stored in * the hash table. Note that the index_size field (above) * is also the sum of the sizes of all entries in the cache. @@ -2868,12 +3071,22 @@ if ( ( (cache_ptr)->index_size != \ * clean_index_size plus the amount of empty space (if any) * in the cache. * + * clean_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to + * maintain the sum of the sizes of all clean entries in the + * index by ring. Note that the sum of all cells in this array + * must equal the value stored in clean_index_size above. + * * dirty_index_size: Number of bytes of dirty entries currently stored in * the hash table. Note that the index_size field (above) * is also the sum of the sizes of all entries in the cache. * Thus we should have the invariant that clean_index_size + * dirty_index_size == index_size. * + * dirty_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to + * maintain the sum of the sizes of all dirty entries in the + * index by ring. Note that the sum of all cells in this array + * must equal the value stored in dirty_index_size above. + * * index: Array of pointer to H5C_cache_entry_t of size * H5C__HASH_TABLE_LEN. At present, this value is a power * of two, not the usual prime number. @@ -2962,6 +3175,16 @@ if ( ( (cache_ptr)->index_size != \ * skip list used to maintain a sorted list of * dirty entries in the cache. * + * slist_ring_len: Array of integer of length H5C_RING_NTYPES used to + * maintain a count of entries in the slist by ring. Note + * that the sum of all the cells in this array must equal + * the value stored in slist_len above. + * + * slist_ring_size: Array of size_t of length H5C_RING_NTYPES used to + * maintain the sum of the sizes of all entries in the + * slist by ring. Note that the sum of all cells in this + * array must equal the value stored in slist_size above. + * * slist_ptr: pointer to the instance of H5SL_t used maintain a sorted * list of dirty entries in the cache. This sorted list has * two uses: @@ -3602,8 +3825,12 @@ struct H5C_t { /* Fields for maintaining [hash table] index of entries */ int32_t index_len; size_t index_size; + int32_t index_ring_len[H5C_RING_NTYPES]; + size_t index_ring_size[H5C_RING_NTYPES]; size_t clean_index_size; + size_t clean_index_ring_size[H5C_RING_NTYPES]; size_t dirty_index_size; + size_t dirty_index_ring_size[H5C_RING_NTYPES]; H5C_cache_entry_t * (index[H5C__HASH_TABLE_LEN]); /* Fields to detect entries removed during scans */ @@ -3619,6 +3846,8 @@ struct H5C_t { hbool_t slist_change_in_serialize; int32_t slist_len; size_t slist_size; + int32_t slist_ring_len[H5C_RING_NTYPES]; + size_t slist_ring_size[H5C_RING_NTYPES]; H5SL_t * slist_ptr; int32_t num_last_entries; #if H5C_DO_SANITY_CHECKS diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 3cd74c1..2a3efc9 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1115,6 +1115,60 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr, /**************************************************************************** * + * H5C_ring_t & associated #defines + * + * The metadata cache uses the concept of rings to order the flushes of + * classes of entries. In this arrangement, each entry in the cache is + * assigned to a ring, and on flush, the members of the outermost ring + * are flushed first, followed by the next outermost, and so on with the + * members of the innermost ring being flushed last. + * + * Note that flush dependencies are used to order flushes within rings. + * + * Note also that at the conceptual level, rings are argueably superfluous, + * as a similar effect could be obtained via the flush dependency mechanism. + * However, this would require all entries in the cache to participate in a + * flush dependency -- with the implied setup and takedown overhead and + * added complexity. Further, the flush ordering between rings need only + * be enforced on flush operations, and thus the use of flush dependencies + * instead would apply unecessary constraints on flushes under normal + * operating circumstances. + * + * As of this writing, all metadata entries pretaining to data sets and + * groups must be flushed first, and are thus assigned to the outermost + * ring. + * + * Free space managers managing file space must be flushed next, + * and are assigned to the second outermost ring. + * + * The object header and associated chunks used to implement superblock + * extension messages must be flushed next, and are thus assigned to + * the third outermost ring. + * + * The superblock proper must be flushed last, and is thus assigned to + * the innermost ring. + * + * The H5C_ring_t and the associated #defines below are used to define + * the rings. Each entry must be assigned to the appropriate ring on + * insertion or protect. + * + * Note that H5C_ring_t was originally an enumerated type. It was + * converted to an integer and a set of #defines for convenience in + * debugging. + */ + +#define H5C_RING_UNDEFINED 0 /* shouldn't appear in the cache */ +#define H5C_RING_USER 1 /* outermost ring */ +#define H5C_RING_FSM 2 +#define H5C_RING_SBE 4 /* temporarily merged with H5C_RING_SB */ +#define H5C_RING_SB 4 /* innermost ring */ +#define H5C_RING_NTYPES 5 + +typedef int H5C_ring_t; + + +/**************************************************************************** + * * structure H5C_cache_entry_t * * Instances of the H5C_cache_entry_t structure are used to store cache @@ -1376,6 +1430,25 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr, * is in the process of being flushed and destroyed. * * + * Fields supporting rings for flush ordering: + * + * All entries in the metadata cache are assigned to a ring. On cache + * flush, all entries in the outermost ring are flushed first, followed + * by all members of the next outermost ring, and so on until the + * innermost ring is flushed. Note that this ordering is ONLY applied + * in flush and serialize calls. Rings are ignored during normal operations + * in which entries are flushed as directed by the replacement policy. + * + * See the header comment on H5C_ring_t above for further details. + * + * Note that flush dependencies (see below) are used to order flushes + * within rings. Unlike rings, flush dependencies are applied to ALL + * writes, not just those triggered by flush or serialize calls. + * + * ring: Instance of H5C_ring_t indicating the ring to which this + * entry is assigned. + * + * * Fields supporting the 'flush dependency' feature: * * Entries in the cache may have a 'flush dependency' on another entry in the @@ -1543,6 +1616,9 @@ typedef struct H5C_cache_entry_t { hbool_t flush_in_progress; hbool_t destroy_in_progress; + /* fields supporting rings for purposes of flush ordering */ + H5C_ring_t ring; + /* fields supporting the 'flush dependency' feature: */ struct H5C_cache_entry_t * flush_dep_parent; uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; @@ -1917,6 +1993,7 @@ H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests); H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr); H5_DLL void H5C_retag_copied_metadata(H5C_t *cache_ptr, haddr_t metadata_tag); +H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id, diff --git a/src/H5FScache.c b/src/H5FScache.c index 25a9c5e..455a96e 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -343,7 +343,7 @@ H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len, /*------------------------------------------------------------------------- - * Function: H5FS__cache_hdf_pre_serialize + * Function: H5FS__cache_hdr_pre_serialize * * Purpose: The free space manager header contains the address, size, and * allocation size of the free space manager section info. However, @@ -376,6 +376,8 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, unsigned *flags) { H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -391,6 +393,16 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(flags); if(fspace->sinfo) { + H5AC_ring_t ring; + + /* Retrieve the ring type for the header */ + if(H5AC_get_entry_ring(f, addr, &ring) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to get property value"); + + /* Set the ring type for the section info in the DXPL */ + if(H5AC_set_ring(dxpl_id, ring, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set ring value") + /* This implies that the header "owns" the section info. * * Unfortunately, the comments in the code are not clear as to @@ -596,6 +608,10 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, *flags = 0; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5FS__cache_hdr_pre_serialize() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index ce3f2ea..d353d4f 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -206,6 +206,8 @@ herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, hbool_t was_created) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -216,13 +218,17 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, /* Check if extension was created */ if(was_created) { + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Increment link count on superblock extension's object header */ if(H5O_link(ext_ptr, 1, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_LINKCOUNT, FAIL, "unable to increment hard link count") /* Decrement refcount on superblock extension's object header in memory */ if(H5O_dec_rc_by_loc(ext_ptr, dxpl_id) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement refcount on superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement refcount on superblock extension"); } /* end if */ /* Twiddle the number of open objects to avoid closing the file. */ @@ -232,6 +238,10 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, f->nopen_objs--; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* H5F_super_ext_close() */ @@ -256,7 +266,8 @@ done: herr_t H5F__super_read(H5F_t *f, hid_t dxpl_id) { - H5P_genplist_t *dxpl; /* DXPL object */ + H5P_genplist_t *dxpl = NULL; /* DXPL object */ + H5AC_ring_t ring, orig_ring = H5AC_RING_INV; H5F_super_t * sblock = NULL; /* Superblock structure */ H5F_superblock_cache_ud_t udata; /* User data for cache callbacks */ H5P_genplist_t *c_plist; /* File creation property list */ @@ -276,6 +287,8 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) /* Get the DXPL plist object for DXPL ID */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + if((H5P_get(dxpl, H5AC_RING_NAME, &orig_ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get property value"); /* Find the superblock */ if(H5FD_locate_signature(f->shared->lf, dxpl, &super_addr) < 0) @@ -320,6 +333,11 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) udata.stored_eof = HADDR_UNDEF; udata.drvrinfo_removed = FALSE; + /* Set the ring type in the DXPL */ + ring = H5AC_RING_SB; + if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value"); + /* Look up the superblock */ if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags))) HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock") @@ -419,6 +437,11 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) * allocated so that it knows how to allocate additional memory. */ + /* Set the ring type in the DXPL */ + ring = H5AC_RING_SBE; + if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value"); + /* Decode the optional driver information block */ if(H5F_addr_defined(sblock->driver_addr)) { H5O_drvinfo_t *drvinfo; /* Driver info */ @@ -647,6 +670,10 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) f->shared->sblock = sblock; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + /* Release the superblock */ if(sblock && H5AC_unprotect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") @@ -705,6 +732,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) H5O_drvinfo_t *drvinfo = NULL; /* Driver info */ hbool_t drvinfo_in_cache = FALSE; /* Whether the driver info block has been inserted into the metadata cache */ H5P_genplist_t *plist; /* File creation property list */ + H5P_genplist_t *dxpl = NULL; + H5AC_ring_t ring, orig_ring = H5AC_RING_INV; hsize_t userblock_size; /* Size of userblock, in bytes */ hsize_t superblock_size; /* Size of superblock, in bytes */ size_t driver_size; /* Size of driver info block (bytes) */ @@ -830,6 +859,10 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) if(H5F__set_eoa(f, H5FD_MEM_SUPER, superblock_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for superblock") + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SB, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Insert superblock into cache, pinned */ if(H5AC_insert_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG | H5AC__FLUSH_LAST_FLAG | H5AC__FLUSH_COLLECTIVELY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache") @@ -875,6 +908,11 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) else need_ext = FALSE; + /* Set the ring type in the DXPL */ + ring = H5AC_RING_SBE; + if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value") + /* Create the superblock extension for "extra" superblock data, if necessary. */ if(need_ext) { /* The superblock extension isn't actually a group, but the @@ -976,6 +1014,10 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + /* Close superblock extension, if it was created */ if(ext_created && H5F_super_ext_close(f, &ext_loc, dxpl_id, ext_created) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") @@ -1114,6 +1156,8 @@ H5F__super_free(H5F_super_t *sblock) herr_t H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1138,6 +1182,10 @@ H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext ext_loc.file = f; ext_loc.addr = f->shared->sblock->ext_addr; + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Get object header info for superblock extension */ if(H5O_get_hdr_info(&ext_loc, dxpl_id, &hdr_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") @@ -1151,6 +1199,10 @@ H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_size() */ @@ -1169,6 +1221,8 @@ done: herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ hbool_t ext_created = FALSE; /* Whether superblock extension was created */ hbool_t ext_opened = FALSE; /* Whether superblock extension was opened */ H5O_loc_t ext_loc; /* "Object location" for superblock extension */ @@ -1182,6 +1236,10 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_ HDassert(f->shared); HDassert(f->shared->sblock); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Open/create the superblock extension object header */ if(H5F_addr_defined(f->shared->sblock->ext_addr)) { if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) @@ -1219,6 +1277,10 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_ } /* end else */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + /* Close the superblock extension, if it was opened */ if(ext_opened && H5F_super_ext_close(f, &ext_loc, dxpl_id, ext_created) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") @@ -1245,6 +1307,8 @@ done: herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5O_loc_t ext_loc; /* "Object location" for superblock extension */ hbool_t ext_opened = FALSE; /* Whether the superblock extension was opened */ int null_count = 0; /* # of null messages */ @@ -1256,6 +1320,10 @@ H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) /* Make sure that the superblock extension object header exists */ HDassert(H5F_addr_defined(f->shared->sblock->ext_addr)); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Open superblock extension object header */ if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") @@ -1289,6 +1357,10 @@ H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + /* Close superblock extension object header, if opened */ if(ext_opened && H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index ac1f840..477f58f 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -515,6 +515,8 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, size_t H5_ATTR_UNUSED *new_len, size_t H5_ATTR_UNUSED *new_compressed_len, unsigned H5_ATTR_UNUSED *flags) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the super block */ herr_t ret_value = SUCCEED; /* Return value */ @@ -562,6 +564,10 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Write driver info information to the superblock extension */ drvinfo.len = driver_size; drvinfo.buf = dbuf; @@ -577,6 +583,10 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FS_cache_superblock_pre_serialize() */ @@ -237,6 +237,8 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) { const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for file */ H5MF_FSPACE_SECT_CLS_SIMPLE}; + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -250,6 +252,10 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) HDassert(H5F_addr_defined(f->shared->fs_addr[type])); HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Open an existing free space structure for the file */ if(NULL == (f->shared->fs_man[type] = H5FS_open(f, dxpl_id, f->shared->fs_addr[type], NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) @@ -260,6 +266,10 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) f->shared->fs_state[type] = H5F_FS_STATE_OPEN; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_alloc_open() */ @@ -423,6 +433,8 @@ done: haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */ haddr_t ret_value; /* Return value */ @@ -440,6 +452,10 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ /* Get free space type from allocation type */ fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, HADDR_UNDEF, "unable to set ring value") + /* Check if we are using the free space manager for this file */ if(H5F_HAVE_FREE_SPACE_MANAGER(f)) { /* Check if the free space manager for the file has been initialized */ @@ -512,6 +528,10 @@ HDfprintf(stderr, "%s: Check 2.0\n", FUNC); HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd") done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, HADDR_UNDEF, "unable to set property value") + #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ @@ -604,6 +624,8 @@ H5MF_xfree(const H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, H5F_io_info_t fio_info; /* I/O info for operation */ H5MF_free_section_t *node = NULL; /* Free space section pointer */ H5MF_sect_ud_t udata; /* User data for callback */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */ herr_t ret_value = SUCCEED; /* Return value */ @@ -622,6 +644,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN if(H5F_addr_le(f->shared->tmp_addr, addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "attempting to free temporary file space") + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Set up I/O info for operation */ fio_info.f = f; if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) @@ -729,6 +755,10 @@ HDfprintf(stderr, "%s: After H5FS_sect_add()\n", FUNC); } /* end else */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + /* Release section node, if allocated and not added to section list or merged */ if(node) if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) @@ -762,6 +792,8 @@ htri_t H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsize_t extra_requested) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ haddr_t end; /* End of block to extend */ H5FD_mem_t map_type; /* Mapped type */ htri_t ret_value; /* Return value */ @@ -781,6 +813,10 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r /* Compute end of block to extend */ end = addr + size; + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Check if the block is exactly at the end of the file */ if((ret_value = H5FD_try_extend(f->shared->lf, map_type, f, end, extra_requested)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") @@ -810,6 +846,10 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); #endif /* H5MF_ALLOC_DEBUG */ @@ -842,6 +882,8 @@ H5MF_sects_dump(f, dxpl_id, stderr); herr_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_size) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ haddr_t eoa; /* End of allocated space in the file */ haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */ hsize_t ma_size = 0; /* Size of "metadata aggregator" */ @@ -865,6 +907,10 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Retrieve metadata aggregator info, if available */ if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") @@ -953,6 +999,10 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si *meta_size = tot_meta_size; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_get_freespace() */ @@ -977,6 +1027,8 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, { H5MF_free_section_t *node = NULL; /* Free space section pointer */ H5MF_sect_ud_t udata; /* User data for callback */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -991,6 +1043,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HDassert(H5F_addr_defined(addr)); HDassert(size > 0); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Create free space section for block */ if(NULL == (node = H5MF_sect_simple_new(addr, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") @@ -1012,6 +1068,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + /* Free section node allocated */ if(node && H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") @@ -1104,6 +1164,8 @@ done: herr_t H5MF_close(H5F_t *f, hid_t dxpl_id) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t type; /* Memory type for iteration */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1118,6 +1180,10 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert(f->shared->lf); HDassert(f->shared->sblock); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Free the space in aggregators */ /* (for space not at EOF, it may be put into free space managers) */ if(H5MF_free_aggrs(f, dxpl_id) < 0) @@ -1280,6 +1346,10 @@ HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ @@ -1337,6 +1407,8 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects, { size_t total_sects = 0; /* total number of sections */ H5MF_sect_iter_ud_t sect_udata; /* User data for callback */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t start_type, end_type; /* Memory types to iterate over */ H5FD_mem_t ty; /* Memory type for iteration */ ssize_t ret_value; /* Return value */ @@ -1363,6 +1435,10 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects, sect_udata.sect_count = nsects; sect_udata.sect_idx = 0; + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Iterate over memory types, retrieving the number of sections of each type */ for(ty = start_type; ty < end_type; H5_INC_ENUM(H5FD_mem_t, ty)) { hbool_t fs_started = FALSE; @@ -1406,6 +1482,10 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects, ret_value = (ssize_t)total_sects; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* H5MF_get_free_sections() */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index b5bc720..980b001 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -34,7 +34,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Cache */ +#include "H5ACprivate.h" /* Cache */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ @@ -167,6 +167,11 @@ #define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF NULL #define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(uint32_t) #define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0 +/* Ring type - private property */ +#define H5AC_XFER_RING_SIZE sizeof(unsigned) +#define H5AC_XFER_RING_DEF H5AC_RING_US +#define H5AC_XFER_RING_ENC H5P__encode_unsigned +#define H5AC_XFER_RING_DEC H5P__decode_unsigned /******************/ /* Local Typedefs */ @@ -271,6 +276,7 @@ static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_F static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */ static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */ static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */ +static const H5AC_ring_t H5D_ring_g = H5AC_XFER_RING_DEF; /* Default value for the cache entry ring type */ /*------------------------------------------------------------------------- @@ -465,6 +471,12 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the data transform property */ + if(H5P_register_real(pclass, H5AC_RING_NAME, H5AC_XFER_RING_SIZE, &H5D_ring_g, + NULL, NULL, NULL, H5AC_XFER_RING_ENC, H5AC_XFER_RING_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ @@ -122,6 +122,8 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d { H5O_shmesg_table_t sohm_table; /* SOHM message for superblock extension */ H5SM_master_table_t *table = NULL; /* SOHM master table for file */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t ring, orig_ring = H5AC_RING_INV; /* Original ring value */ haddr_t table_addr = HADDR_UNDEF; /* Address of SOHM master table in file */ unsigned list_max, btree_min; /* Phase change limits for SOHM indices */ unsigned index_type_flags[H5O_SHMESG_MAX_NINDEXES]; /* Messages types stored in each index */ @@ -136,6 +138,10 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d /* File should not already have a SOHM table */ HDassert(!H5F_addr_defined(H5F_SOHM_ADDR(f))); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_US, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set ring value") + /* Initialize master table */ if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t))) HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") @@ -220,6 +226,11 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d if(type_flags_used & H5O_SHMESG_ATTR_FLAG) H5F_SET_STORE_MSG_CRT_IDX(f, TRUE); + /* Set the ring type to superblock extension */ + ring = H5AC_RING_SBE; + if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value") + /* Write shared message information to the superblock extension */ sohm_table.addr = H5F_SOHM_ADDR(f); sohm_table.version = H5F_SOHM_VERS(f); @@ -228,6 +239,10 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to update SOHM header message") done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value") + if(ret_value < 0) { if(table_addr != HADDR_UNDEF) H5MF_xfree(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_addr, (hsize_t)table->table_size); @@ -1929,6 +1944,8 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) H5F_t *f = ext_loc->file; /* File pointer (convenience variable) */ H5O_shmesg_table_t sohm_table; /* SOHM message from superblock extension */ H5SM_master_table_t *table = NULL; /* SOHM master table */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ unsigned tmp_sohm_nindexes; /* Number of shared messages indexes in the table */ htri_t status; /* Status for message existing */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1969,6 +1986,10 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) /* Set up user data for callback */ cache_udata.f = f; + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_US, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set ring value") + /* Read the rest of the SOHM table information from the cache */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") @@ -2020,6 +2041,10 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) } /* end else */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value") + /* Release the master SOHM table if we took it out of the cache */ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index ab7287c..910bef9 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -21,28 +21,6 @@ #ifndef H5API_ADPT_H #define H5API_ADPT_H -/* - * Does the compiler support the __attribute__(()) syntax? It's no - * big deal if we don't. - * - * Note that Solaris Studio supports attribute, but does not support the - * attributes we use. - */ -#ifdef __cplusplus -# define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ -#else /* __cplusplus */ -#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) -# define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) -# define H5_ATTR_UNUSED __attribute__((unused)) -# define H5_ATTR_NORETURN __attribute__((noreturn)) -#else -# define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ -#endif -#endif /* __cplusplus */ /* This will only be defined if HDF5 was built with CMake */ #ifdef H5_BUILT_AS_DYNAMIC_LIB diff --git a/src/H5config.h.in b/src/H5config.h.in index 252ec04..9363813 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -172,9 +172,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Define to 1 if you have the `get_fpc_csr' function. */ -#undef HAVE_GET_FPC_CSR - /* Define if the compiler understands inline */ #undef HAVE_INLINE @@ -203,15 +200,9 @@ /* Define to 1 if you have the `mpe' library (-lmpe). */ #undef HAVE_LIBMPE -/* Define to 1 if you have the `nsl' library (-lnsl). */ -#undef HAVE_LIBNSL - /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD -/* Define to 1 if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET - /* Define to 1 if you have the `sz' library (-lsz). */ #undef HAVE_LIBSZ @@ -326,15 +317,9 @@ /* Define to 1 if you have the `system' function. */ #undef HAVE_SYSTEM -/* Define to 1 if you have the <sys/fpu.h> header file. */ -#undef HAVE_SYS_FPU_H - /* Define to 1 if you have the <sys/ioctl.h> header file. */ #undef HAVE_SYS_IOCTL_H -/* Define to 1 if you have the <sys/proc.h> header file. */ -#undef HAVE_SYS_PROC_H - /* Define to 1 if you have the <sys/resource.h> header file. */ #undef HAVE_SYS_RESOURCE_H @@ -344,9 +329,6 @@ /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H -/* Define to 1 if you have the <sys/sysinfo.h> header file. */ -#undef HAVE_SYS_SYSINFO_H - /* Define to 1 if you have the <sys/timeb.h> header file. */ #undef HAVE_SYS_TIMEB_H diff --git a/src/H5private.h b/src/H5private.h index 5e968a0..738d4ff 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -288,12 +288,23 @@ /* * Does the compiler support the __attribute__(()) syntax? It's no * big deal if we don't. + * + * Note that Solaris Studio supports attribute, but does not support the + * attributes we use. */ #ifdef __cplusplus -# define __attribute__(X) /*void*/ +# define H5_ATTR_FORMAT(X,Y,Z) /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ #else /* __cplusplus */ -#ifndef H5_HAVE_ATTRIBUTE -# define __attribute__(X) /*void*/ +#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) +# define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) +# define H5_ATTR_UNUSED __attribute__((unused)) +# define H5_ATTR_NORETURN __attribute__((noreturn)) +#else +# define H5_ATTR_FORMAT(X,Y,Z) /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ #endif #endif /* __cplusplus */ diff --git a/src/H5public.h b/src/H5public.h index 5a2cb5c..0650988 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 230 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 231 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.230" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.231" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index 6cef273..8741540 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -742,7 +742,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 220 +LT_VERS_REVISION = 221 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 522e968..662b8c9 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -452,6 +452,7 @@ set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-testmeta PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) +set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT 2400) if (BUILD_SHARED_LIBS) # Remove any output file left over from previous test run @@ -542,6 +543,7 @@ if (BUILD_SHARED_LIBS) set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-testmeta PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800) + set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT 2400) endif (BUILD_SHARED_LIBS) ############################################################################## @@ -730,7 +732,7 @@ if (BUILD_SHARED_LIBS) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 2400) + set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT 2400) endif (NOT CYGWIN) #-- Adding test for cache_api diff --git a/test/cache_common.c b/test/cache_common.c index f3da908..a3287cf 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3061,7 +3061,7 @@ setup_cache(size_t max_cache_size, if ( pass ) { /* allocate space for test entries */ - actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, + actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); if ( actual_base_addr == HADDR_UNDEF ) { @@ -3171,7 +3171,7 @@ takedown_cache(H5F_t * file_ptr, HDassert ( file_ptr ); } - H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr, + H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, saved_actual_base_addr, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); saved_actual_base_addr = HADDR_UNDEF; } diff --git a/testpar/t_cache.c b/testpar/t_cache.c index bb1ccc6..42788f4 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -4202,7 +4202,7 @@ setup_cache_for_test(hid_t * fid_ptr, */ if ( success ) { /* allocate space for test entries */ - actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, + actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, (hsize_t)(max_addr + BASE_ADDR)); if ( actual_base_addr == HADDR_UNDEF ) { diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 8a297a7..1d71c13 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -47,473 +47,473 @@ obj_list_t* parse_filter(const char *str, - int *n_objs, - filter_info_t *filt, - pack_opt_t *options, - int *is_glb) + int *n_objs, + filter_info_t *filt, + pack_opt_t *options, + int *is_glb) { - unsigned i, u; - char c; - size_t len=HDstrlen(str); - int j, m, n, k, l, p, r, q, end_obj=-1, no_param=0; - char sobj[MAX_NC_NAME]; - char scomp[10]; - char stype[5]; - char smask[3]; - obj_list_t* obj_list=NULL; - unsigned pixels_per_block; - - - /* initialize compression info */ - HDmemset(filt,0,sizeof(filter_info_t)); - *is_glb = 0; - - /* check for the end of object list and number of objects */ - for ( i = 0, n = 0; i < len; i++) - { - c = str[i]; - if ( c==':' ) - { - end_obj=i; - } - if ( c==',' ) - { - n++; - } - } - - if (end_obj==-1) /* missing : */ - { - /* apply to all objects */ - options->all_filter=1; - *is_glb = 1; - } - - n++; - obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t)); - if (obj_list==NULL) - { - error_msg("could not allocate object list\n"); - return NULL; - } - *n_objs=n; - - /* get object list */ - for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++) - { - c = str[j]; - sobj[k] = c; - if ( c==',' || j==end_obj-1) - { - if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; - HDstrcpy(obj_list[n].obj,sobj); - HDmemset(sobj,0,sizeof(sobj)); - n++; - k=-1; - } - } - /* nothing after : */ - if (end_obj+1==(int)len) - { - if (obj_list) HDfree(obj_list); - error_msg("input Error: Invalid compression type in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - - - /* get filter additional parameters */ - m=0; - for ( i=end_obj+1, k=0, j=0; i<len; i++,k++) - { - c = str[i]; - scomp[k]=c; - if ( c=='=' || i==len-1) - { - if ( c=='=') /*one more parameter */ - { - scomp[k]='\0'; /*cut space */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - * szip has the format SZIP=<pixels per block,coding> - * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN' - * example SZIP=8,NN - *------------------------------------------------------------------------- - */ - if (HDstrcmp(scomp,"SZIP")==0) - { - l=-1; /* mask index check */ - for ( m=0,u=i+1; u<len; u++,m++) - { - if (str[u]==',') - { - stype[m]='\0'; /* end digit of szip */ - l=0; /* start EC or NN search */ - u++; /* skip ',' */ - } - c = str[u]; - if (!isdigit(c) && l==-1) - { - if (obj_list) HDfree(obj_list); - error_msg("compression parameter not digit in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - if (l==-1) - stype[m]=c; - else - { - smask[l]=c; - l++; - if (l==2) - { - smask[l]='\0'; - i=len-1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ - if (HDstrcmp(smask,"NN")==0) - filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK; - else if (HDstrcmp(smask,"EC")==0) - filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK; - else - { - error_msg("szip mask must be 'NN' or 'EC' \n"); - HDexit(EXIT_FAILURE); - } - - - } - } - - } /* u */ - } /*if */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - * scaleoffset has the format SOFF=<scale_factor,scale_type> - * scale_type can be - * integer datatype, H5Z_SO_INT (IN) - * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS) - * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented - * for integer datatypes, scale_factor denotes Minimum Bits - * for float datatypes, scale_factor denotes decimal scale factor - * examples - * SOFF=31,IN - * SOFF=3,DF - *------------------------------------------------------------------------- - */ - - else if (HDstrcmp(scomp,"SOFF")==0) - { - l=-1; /* mask index check */ - for ( m=0,u=i+1; u<len; u++,m++) - { - if (str[u]==',') - { - stype[m]='\0'; /* end digit */ - l=0; /* start 'IN' , 'DS', or 'ES' search */ - u++; /* skip ',' */ - } - c = str[u]; - if (!isdigit(c) && l==-1) - { - if (obj_list) HDfree(obj_list); - error_msg("compression parameter is not a digit in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - if (l==-1) - stype[m]=c; - else - { - smask[l]=c; - l++; - if (l==2) - { - smask[l]='\0'; - i=len-1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ - if (HDstrcmp(smask,"IN")==0) - filt->cd_values[j++]=H5Z_SO_INT; - else if (HDstrcmp(smask,"DS")==H5Z_SO_FLOAT_DSCALE) - filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE; - else - { - error_msg("scale type must be 'IN' or 'DS' \n"); - HDexit(EXIT_FAILURE); - } - - } - } - - } /* u */ - } /*if */ - /*------------------------------------------------------------------------- - * User Defined - * has the format UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]> - * BZIP2 example - * UD=307,1,9 - *------------------------------------------------------------------------- - */ - - else if (HDstrcmp(scomp,"UD")==0) - { - l=-1; /* filter number index check */ - p=-1; /* CD_VAL count check */ - r=-1; /* CD_VAL check */ - for ( m=0,q=0,u=i+1; u<len; u++,m++,q++) - { - if (str[u]==',') - { - stype[q]='\0'; /* end digit */ - if (l==-1) - { - filt->filtn=atoi(stype); - l=0; - } - else if (p==-1) - { - filt->cd_nelmts=atoi(stype); - p=0; - } - else - r=0; - q=0; - u++; /* skip ',' */ - } - c = str[u]; - if (!isdigit(c) && l==-1) - { - if (obj_list) HDfree(obj_list); - error_msg("filter number parameter is not a digit in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - stype[q]=c; - if (l==0 && p==0) - { - if (r==0) - filt->cd_values[j++]=atoi(stype); - } - - } /* u */ - - stype[q]='\0'; - } /*if */ - - - /*------------------------------------------------------------------------- - * all other filters - *------------------------------------------------------------------------- - */ - - else - { - /* here we could have 1 or 2 digits */ - for ( m=0,u=i+1; u<len; u++,m++) - { - c = str[u]; - if (!isdigit(c)){ - if (obj_list) HDfree(obj_list); - error_msg("compression parameter is not a digit in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - stype[m]=c; - } /* u */ - - stype[m]='\0'; - } /*if */ - - - - filt->cd_values[j++]=atoi(stype); - i+=m; /* jump */ - } - else if (i==len-1) - { /*no more parameters */ - scomp[k+1]='\0'; - no_param=1; - } - - /*------------------------------------------------------------------------- - * translate from string to filter symbol - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_NONE - *------------------------------------------------------------------------- - */ - if (HDstrcmp(scomp,"NONE")==0) - { - filt->filtn=H5Z_FILTER_NONE; - filt->cd_nelmts = 0; - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"GZIP")==0) - { - filt->filtn=H5Z_FILTER_DEFLATE; - filt->cd_nelmts = 1; - if (no_param) - { /*no more parameters, GZIP must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SZIP")==0) - { - filt->filtn=H5Z_FILTER_SZIP; - filt->cd_nelmts = 2; - if (no_param) - { /*no more parameters, SZIP must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SHUFFLE - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SHUF")==0) - { - filt->filtn=H5Z_FILTER_SHUFFLE; - filt->cd_nelmts = 0; - if (m>0) - { /*shuffle does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in SHUF <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_FLETCHER32 - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"FLET")==0) - { - filt->filtn=H5Z_FILTER_FLETCHER32; - filt->cd_nelmts = 0; - if (m>0) - { /*shuffle does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in FLET <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_NBIT - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"NBIT")==0) - { - filt->filtn=H5Z_FILTER_NBIT; - filt->cd_nelmts = 0; - if (m>0) - { /*nbit does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in NBIT <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SOFF")==0) - { - filt->filtn=H5Z_FILTER_SCALEOFFSET; - filt->cd_nelmts = 2; - if (no_param) - { /*no more parameters, SOFF must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * User Defined Filter - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"UD")==0) - { - if (filt->cd_nelmts != j) - { /* parameters does not match count */ - if (obj_list) HDfree(obj_list); - error_msg("incorrect number of compression parameters in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - else { - if (obj_list) HDfree(obj_list); - error_msg("invalid filter type in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - } /*i*/ - - /*------------------------------------------------------------------------- - * check valid parameters - *------------------------------------------------------------------------- - */ - - switch (filt->filtn) - { - - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE - *------------------------------------------------------------------------- - */ - - case H5Z_FILTER_DEFLATE: - if (filt->cd_values[0]>9 ) - { - if (obj_list) HDfree(obj_list); - error_msg("invalid compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - break; - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - *------------------------------------------------------------------------- - */ - - case H5Z_FILTER_SZIP: - pixels_per_block=filt->cd_values[0]; - if ((pixels_per_block%2)==1) - { - if (obj_list) HDfree(obj_list); - error_msg("pixels_per_block is not even in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) - { - if (obj_list) HDfree(obj_list); - error_msg("pixels_per_block is too large in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - if ( (HDstrcmp(smask,"NN")!=0) && (HDstrcmp(smask,"EC")!=0) ) - { - if (obj_list) HDfree(obj_list); - error_msg("szip mask must be 'NN' or 'EC' \n"); - HDexit(EXIT_FAILURE); - } - break; - default: - break; - - - }; - - return obj_list; + unsigned i, u; + char c; + size_t len=HDstrlen(str); + int j, m, n, k, l, p, r, q, end_obj=-1, no_param=0; + char sobj[MAX_NC_NAME]; + char scomp[10]; + char stype[6]; + char smask[3]; + obj_list_t* obj_list=NULL; + unsigned pixels_per_block; + + + /* initialize compression info */ + HDmemset(filt,0,sizeof(filter_info_t)); + *is_glb = 0; + + /* check for the end of object list and number of objects */ + for ( i = 0, n = 0; i < len; i++) + { + c = str[i]; + if ( c==':' ) + { + end_obj=i; + } + if ( c==',' ) + { + n++; + } + } + + if (end_obj==-1) /* missing : */ + { + /* apply to all objects */ + options->all_filter=1; + *is_glb = 1; + } + + n++; + obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t)); + if (obj_list==NULL) + { + error_msg("could not allocate object list\n"); + return NULL; + } + *n_objs=n; + + /* get object list */ + for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++) + { + c = str[j]; + sobj[k] = c; + if ( c==',' || j==end_obj-1) + { + if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; + HDstrcpy(obj_list[n].obj,sobj); + HDmemset(sobj,0,sizeof(sobj)); + n++; + k=-1; + } + } + /* nothing after : */ + if (end_obj+1==(int)len) + { + if (obj_list) HDfree(obj_list); + error_msg("input Error: Invalid compression type in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + + + /* get filter additional parameters */ + m=0; + for ( i=end_obj+1, k=0, j=0; i<len; i++,k++) + { + c = str[i]; + scomp[k]=c; + if ( c=='=' || i==len-1) + { + if ( c=='=') /*one more parameter */ + { + scomp[k]='\0'; /*cut space */ + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SZIP + * szip has the format SZIP=<pixels per block,coding> + * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN' + * example SZIP=8,NN + *------------------------------------------------------------------------- + */ + if (HDstrcmp(scomp,"SZIP")==0) + { + l=-1; /* mask index check */ + for ( m=0,u=i+1; u<len; u++,m++) + { + if (str[u]==',') + { + stype[m]='\0'; /* end digit of szip */ + l=0; /* start EC or NN search */ + u++; /* skip ',' */ + } + c = str[u]; + if (!isdigit(c) && l==-1) + { + if (obj_list) HDfree(obj_list); + error_msg("compression parameter not digit in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + if (l==-1) + stype[m]=c; + else + { + smask[l]=c; + l++; + if (l==2) + { + smask[l]='\0'; + i=len-1; /* end */ + (*n_objs)--; /* we counted an extra ',' */ + if (HDstrcmp(smask,"NN")==0) + filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK; + else if (HDstrcmp(smask,"EC")==0) + filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK; + else + { + error_msg("szip mask must be 'NN' or 'EC' \n"); + HDexit(EXIT_FAILURE); + } + + + } + } + + } /* u */ + } /*if */ + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET + * scaleoffset has the format SOFF=<scale_factor,scale_type> + * scale_type can be + * integer datatype, H5Z_SO_INT (IN) + * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS) + * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented + * for integer datatypes, scale_factor denotes Minimum Bits + * for float datatypes, scale_factor denotes decimal scale factor + * examples + * SOFF=31,IN + * SOFF=3,DF + *------------------------------------------------------------------------- + */ + + else if (HDstrcmp(scomp,"SOFF")==0) + { + l=-1; /* mask index check */ + for ( m=0,u=i+1; u<len; u++,m++) + { + if (str[u]==',') + { + stype[m]='\0'; /* end digit */ + l=0; /* start 'IN' , 'DS', or 'ES' search */ + u++; /* skip ',' */ + } + c = str[u]; + if (!isdigit(c) && l==-1) + { + if (obj_list) HDfree(obj_list); + error_msg("compression parameter is not a digit in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + if (l==-1) + stype[m]=c; + else + { + smask[l]=c; + l++; + if (l==2) + { + smask[l]='\0'; + i=len-1; /* end */ + (*n_objs)--; /* we counted an extra ',' */ + if (HDstrcmp(smask,"IN")==0) + filt->cd_values[j++]=H5Z_SO_INT; + else if (HDstrcmp(smask,"DS")==H5Z_SO_FLOAT_DSCALE) + filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE; + else + { + error_msg("scale type must be 'IN' or 'DS' \n"); + HDexit(EXIT_FAILURE); + } + + } + } + + } /* u */ + } /*if */ + /*------------------------------------------------------------------------- + * User Defined + * has the format UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]> + * BZIP2 example + * UD=307,1,9 + *------------------------------------------------------------------------- + */ + + else if (HDstrcmp(scomp,"UD")==0) + { + l=-1; /* filter number index check */ + p=-1; /* CD_VAL count check */ + r=-1; /* CD_VAL check */ + for ( m=0,q=0,u=i+1; u<len; u++,m++,q++) + { + if (str[u]==',') + { + stype[q]='\0'; /* end digit */ + if (l==-1) + { + filt->filtn=atoi(stype); + l=0; + } + else if (p==-1) + { + filt->cd_nelmts=atoi(stype); + p=0; + } + else + r=0; + q=0; + u++; /* skip ',' */ + } + c = str[u]; + if (!isdigit(c) && l==-1) + { + if (obj_list) HDfree(obj_list); + error_msg("filter number parameter is not a digit in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + stype[q]=c; + if (l==0 && p==0) + { + if (r==0) + filt->cd_values[j++]=atoi(stype); + } + + } /* u */ + + stype[q]='\0'; + } /*if */ + + + /*------------------------------------------------------------------------- + * all other filters + *------------------------------------------------------------------------- + */ + + else + { + /* here we could have 1 or 2 digits */ + for ( m=0,u=i+1; u<len; u++,m++) + { + c = str[u]; + if (!isdigit(c)){ + if (obj_list) HDfree(obj_list); + error_msg("compression parameter is not a digit in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + stype[m]=c; + } /* u */ + + stype[m]='\0'; + } /*if */ + + + + filt->cd_values[j++]=atoi(stype); + i+=m; /* jump */ + } + else if (i==len-1) + { /*no more parameters */ + scomp[k+1]='\0'; + no_param=1; + } + + /*------------------------------------------------------------------------- + * translate from string to filter symbol + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5Z_FILTER_NONE + *------------------------------------------------------------------------- + */ + if (HDstrcmp(scomp,"NONE")==0) + { + filt->filtn=H5Z_FILTER_NONE; + filt->cd_nelmts = 0; + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_DEFLATE + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"GZIP")==0) + { + filt->filtn=H5Z_FILTER_DEFLATE; + filt->cd_nelmts = 1; + if (no_param) + { /*no more parameters, GZIP must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SZIP + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SZIP")==0) + { + filt->filtn=H5Z_FILTER_SZIP; + filt->cd_nelmts = 2; + if (no_param) + { /*no more parameters, SZIP must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SHUFFLE + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SHUF")==0) + { + filt->filtn=H5Z_FILTER_SHUFFLE; + filt->cd_nelmts = 0; + if (m>0) + { /*shuffle does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in SHUF <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_FLETCHER32 + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"FLET")==0) + { + filt->filtn=H5Z_FILTER_FLETCHER32; + filt->cd_nelmts = 0; + if (m>0) + { /*shuffle does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in FLET <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_NBIT + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"NBIT")==0) + { + filt->filtn=H5Z_FILTER_NBIT; + filt->cd_nelmts = 0; + if (m>0) + { /*nbit does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in NBIT <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SOFF")==0) + { + filt->filtn=H5Z_FILTER_SCALEOFFSET; + filt->cd_nelmts = 2; + if (no_param) + { /*no more parameters, SOFF must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * User Defined Filter + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"UD")==0) + { + if (filt->cd_nelmts != j) + { /* parameters does not match count */ + if (obj_list) HDfree(obj_list); + error_msg("incorrect number of compression parameters in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + else { + if (obj_list) HDfree(obj_list); + error_msg("invalid filter type in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + } /*i*/ + + /*------------------------------------------------------------------------- + * check valid parameters + *------------------------------------------------------------------------- + */ + + switch (filt->filtn) + { + + /*------------------------------------------------------------------------- + * H5Z_FILTER_DEFLATE + *------------------------------------------------------------------------- + */ + + case H5Z_FILTER_DEFLATE: + if (filt->cd_values[0]>9 ) + { + if (obj_list) HDfree(obj_list); + error_msg("invalid compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + break; + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SZIP + *------------------------------------------------------------------------- + */ + + case H5Z_FILTER_SZIP: + pixels_per_block=filt->cd_values[0]; + if ((pixels_per_block%2)==1) + { + if (obj_list) HDfree(obj_list); + error_msg("pixels_per_block is not even in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) + { + if (obj_list) HDfree(obj_list); + error_msg("pixels_per_block is too large in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + if ( (HDstrcmp(smask,"NN")!=0) && (HDstrcmp(smask,"EC")!=0) ) + { + if (obj_list) HDfree(obj_list); + error_msg("szip mask must be 'NN' or 'EC' \n"); + HDexit(EXIT_FAILURE); + } + break; + default: + break; + + + }; + + return obj_list; } @@ -540,9 +540,9 @@ obj_list_t* parse_filter(const char *str, *------------------------------------------------------------------------- */ obj_list_t* parse_layout(const char *str, - int *n_objs, - pack_info_t *pack, /* info about layout needed */ - pack_opt_t *options) + int *n_objs, + pack_info_t *pack, /* info about layout needed */ + pack_opt_t *options) { obj_list_t* obj_list=NULL; unsigned i; @@ -636,10 +636,10 @@ obj_list_t* parse_layout(const char *str, if ( pack->layout==H5D_CHUNKED ) { - /*------------------------------------------------------------------------- - * get chunk info - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * get chunk info + *------------------------------------------------------------------------- + */ k=0; if (j>(int)len) @@ -656,11 +656,11 @@ obj_list_t* parse_layout(const char *str, k++; /*increment sdim index */ if (!isdigit(c) && c!='x' - && c!='N' && c!='O' && c!='N' && c!='E' - ){ + && c!='N' && c!='O' && c!='N' && c!='E' + ){ if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> Not a valid character in <%s>\n", - sdim,str); + sdim,str); HDexit(EXIT_FAILURE); } @@ -673,7 +673,7 @@ obj_list_t* parse_layout(const char *str, if (pack->chunk.chunk_lengths[c_index]==0) { if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", - sdim,str); + sdim,str); HDexit(EXIT_FAILURE); } c_index++; @@ -691,7 +691,7 @@ obj_list_t* parse_layout(const char *str, if (pack->chunk.chunk_lengths[c_index]==0){ if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", - sdim,str); + sdim,str); HDexit(EXIT_FAILURE); } pack->chunk.rank=c_index+1; diff --git a/tools/misc/vds/Makefile.in b/tools/misc/vds/Makefile.in index 9fa9426..8977925 100644 --- a/tools/misc/vds/Makefile.in +++ b/tools/misc/vds/Makefile.in @@ -475,6 +475,7 @@ FORTRAN_C_LONG_DOUBLE_IS_UNIQUE = @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ +Fortran_COMPILER_ID = @Fortran_COMPILER_ID@ GREP = @GREP@ H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ |