diff --git a/.github/workflows/cmake-analysis.yml b/.github/workflows/cmake-analysis.yml index 9fc9ed998d4..7c5a1d9466d 100644 --- a/.github/workflows/cmake-analysis.yml +++ b/.github/workflows/cmake-analysis.yml @@ -27,7 +27,7 @@ jobs: # Linux (Ubuntu) w/ gcc + coverage # name: "Ubuntu GCC Coverage" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Install CMake Dependencies (Linux_coverage) run: | @@ -99,6 +99,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") @@ -122,19 +123,19 @@ jobs: # Linux (Ubuntu) w/ clang + LeakSanitizer # name: "Ubuntu Clang LeakSanitizer" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Install CMake Dependencies (Linux_Leak) run: | sudo apt update - sudo apt-get install ninja-build doxygen graphviz curl + sudo apt-get install ninja-build doxygen graphviz curl libtinfo5 - name: add clang to env uses: KyleMayes/install-llvm-action@v2.0.5 id: setup-clang with: env: true - version: '18' + version: '18.1' - name: Set file base name (Linux_Leak) id: set-file-base @@ -202,6 +203,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Linux_Leak) run: | @@ -222,19 +224,19 @@ jobs: # Linux (Ubuntu) w/ clang + AddressSanitizer # name: "Ubuntu Clang AddressSanitizer" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Install CMake Dependencies (Linux_Address) run: | sudo apt update - sudo apt-get install ninja-build doxygen graphviz curl + sudo apt-get install ninja-build doxygen graphviz curl libtinfo5 - name: add clang to env uses: KyleMayes/install-llvm-action@v2.0.5 id: setup-clang with: env: true - version: '18' + version: '18.1' - name: Set file base name (Linux_Address) id: set-file-base @@ -302,6 +304,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Linux_Address) run: | @@ -322,19 +325,19 @@ jobs: # Linux (Ubuntu) w/ clang + UndefinedBehaviorSanitizer # name: "Ubuntu Clang UndefinedBehaviorSanitizer" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Install CMake Dependencies (Linux_UndefinedBehavior) run: | sudo apt update - sudo apt-get install ninja-build doxygen graphviz curl + sudo apt-get install ninja-build doxygen graphviz curl libtinfo5 - name: add clang to env uses: KyleMayes/install-llvm-action@v2.0.5 id: setup-clang with: env: true - version: '18' + version: '18.1' - name: Set file base name (Linux_UndefinedBehavior) id: set-file-base @@ -402,6 +405,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Linux_UndefinedBehavior) run: | diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index 7941528c2ba..13963c64340 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -333,6 +333,12 @@ jobs: with: version: "1.9.7" + - name: check clang version + shell: bash + run: | + which clang + clang -v + - name: Install the Apple certificate and provisioning profile shell: bash env: diff --git a/.github/workflows/cmake-par-script.yml b/.github/workflows/cmake-par-script.yml index c47b89e89d9..61b9dde0e53 100644 --- a/.github/workflows/cmake-par-script.yml +++ b/.github/workflows/cmake-par-script.yml @@ -131,9 +131,10 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest script (${{ matrix.mpi }}) run: | @@ -244,9 +245,10 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest script (${{ matrix.mpi }}) run: | @@ -353,9 +355,10 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest script (${{ matrix.mpi }}) run: | diff --git a/.github/workflows/cmake-par-source.yml b/.github/workflows/cmake-par-source.yml index 04e2cb1764f..97b8e2e4d4b 100644 --- a/.github/workflows/cmake-par-source.yml +++ b/.github/workflows/cmake-par-source.yml @@ -136,6 +136,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest script (OpenMPI) run: | @@ -251,6 +252,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest script (MPICH) run: | diff --git a/.github/workflows/cmake-script.yml b/.github/workflows/cmake-script.yml index f4e1acaa000..914298d89e9 100644 --- a/.github/workflows/cmake-script.yml +++ b/.github/workflows/cmake-script.yml @@ -109,6 +109,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest script (Windows) run: | @@ -200,6 +201,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Linux) run: | @@ -230,6 +232,12 @@ jobs: with: version: "1.9.7" + - name: check clang version + shell: bash + run: | + which clang + clang -v + - name: Set up JDK 19 uses: actions/setup-java@v4 with: @@ -303,6 +311,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (MacOS_latest) id: run-ctest @@ -391,6 +400,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Linux S3) run: | @@ -495,6 +505,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Windows_intel) with oneapi env: @@ -591,6 +602,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Linux_intel) env: @@ -615,19 +627,25 @@ jobs: # Linux (Ubuntu) w/ clang + CMake # name: "Ubuntu Clang CMake" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Install CMake Dependencies (Linux_clang) run: | sudo apt-get update - sudo apt-get install ninja-build doxygen graphviz curl + sudo apt-get install ninja-build doxygen graphviz curl libtinfo5 - name: add clang to env uses: KyleMayes/install-llvm-action@v2.0.5 id: setup-clang with: env: true - version: '18' + version: '18.1' + + - name: check clang version + shell: bash + run: | + which clang + clang -v - name: Set file base name (Linux_clang) id: set-file-base @@ -690,6 +708,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Linux_clang) run: | diff --git a/.github/workflows/cygwin-cmake.yml b/.github/workflows/cygwin-cmake.yml index 73f13f30569..8c10a35552c 100644 --- a/.github/workflows/cygwin-cmake.yml +++ b/.github/workflows/cygwin-cmake.yml @@ -103,6 +103,7 @@ jobs: set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DPLUGIN_USE_LOCALCONTENT:BOOL=OFF") - name: Run ctest (Cygwin) shell: C:\cygwin\bin\bash.exe -eo pipefail -o igncr '{0}' diff --git a/.github/workflows/i386-cmake.yml b/.github/workflows/i386-cmake.yml index 9867c70558e..4eea1b2f801 100644 --- a/.github/workflows/i386-cmake.yml +++ b/.github/workflows/i386-cmake.yml @@ -40,12 +40,10 @@ jobs: -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=OFF \ -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF \ + -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF \ -DHDF5_BUILD_CPP_LIB:BOOL=OFF \ - -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF \ - -DZLIB_USE_LOCALCONTENT:BOOL=OFF \ -DHDF5_BUILD_FORTRAN:BOOL=OFF \ -DHDF5_BUILD_JAVA:BOOL=OFF \ - -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF \ .. - name: CMake Build diff --git a/.github/workflows/intel-cmake.yml b/.github/workflows/intel-cmake.yml index 3fc37359065..8e69c40800f 100644 --- a/.github/workflows/intel-cmake.yml +++ b/.github/workflows/intel-cmake.yml @@ -46,8 +46,6 @@ jobs: -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ -DHDF5_BUILD_FORTRAN:BOOL=ON \ -DHDF5_BUILD_CPP_LIB:BOOL=ON \ - -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF \ - -DZLIB_USE_LOCALCONTENT:BOOL=OFF \ ${{ github.workspace }} - name: CMake Build (Linux) diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index f054eae2048..598f1a8a3ab 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -66,8 +66,6 @@ jobs: # Linux (Ubuntu) w/ gcc + CMake # - # We might think about adding Clang, but MacOS already tests that - # so it's not critical - name: "Ubuntu gcc" os: ubuntu-latest cpp: ON @@ -87,12 +85,10 @@ jobs: # MacOS w/ Clang + CMake # - # We could also build with the Autotools via brew installing them, - # but that seems unnecessary - name: "MacOS Clang" os: macos-latest cpp: ON - fortran: ON + fortran: OFF java: ON docs: ON libaecfc: ON @@ -139,13 +135,13 @@ jobs: if: ${{ matrix.os == 'macos-latest' }} # symlinks the compiler executables to a common location - - name: Install GNU Fortran (macOS) - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran - with: - compiler: gcc - version: 14 - if: ${{ matrix.os == 'macos-latest' }} +# - name: Install GNU Fortran (macOS) +# uses: fortran-lang/setup-fortran@v1 +# id: setup-fortran +# with: +# compiler: gcc +# version: 14 +# if: ${{ matrix.os == 'macos-latest' }} - name: Install Dependencies uses: ssciwr/doxygen-install@v1 @@ -180,6 +176,8 @@ jobs: -DHDF5_BUILD_FORTRAN:BOOL=${{ matrix.fortran }} \ -DHDF5_BUILD_JAVA:BOOL=${{ matrix.java }} \ -DHDF5_BUILD_DOC:BOOL=${{ matrix.docs }} \ + -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=${{ matrix.zlibfc }} \ + -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=${{ matrix.libaecfc }} \ -DLIBAEC_USE_LOCALCONTENT:BOOL=${{ matrix.localaec }} \ -DZLIB_USE_LOCALCONTENT:BOOL=${{ matrix.localzlib }} \ -DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} \ @@ -210,6 +208,8 @@ jobs: -DHDF5_BUILD_JAVA:BOOL=OFF \ -DHDF5_BUILD_HL_LIB:BOOL=OFF \ -DHDF5_BUILD_DOC:BOOL=OFF \ + -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=${{ matrix.zlibfc }} \ + -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=${{ matrix.libaecfc }} \ -DLIBAEC_USE_LOCALCONTENT:BOOL=${{ matrix.localaec }} \ -DZLIB_USE_LOCALCONTENT:BOOL=${{ matrix.localzlib }} \ -DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} \ diff --git a/.github/workflows/msys2-cmake.yml b/.github/workflows/msys2-cmake.yml index 363146c85d5..a1ea7ec044e 100644 --- a/.github/workflows/msys2-cmake.yml +++ b/.github/workflows/msys2-cmake.yml @@ -70,8 +70,6 @@ jobs: -DHDF5_BUILD_FORTRAN:BOOL=OFF \ -DHDF5_BUILD_JAVA:BOOL=OFF \ -DHDF5_BUILD_DOC:BOOL=OFF \ - -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF \ - -DZLIB_USE_LOCALCONTENT:BOOL=OFF \ $GITHUB_WORKSPACE - name: CMake Build diff --git a/.github/workflows/netcdf.yml b/.github/workflows/netcdf.yml index 14a3a858da3..12f58ce25d4 100644 --- a/.github/workflows/netcdf.yml +++ b/.github/workflows/netcdf.yml @@ -50,9 +50,8 @@ jobs: -DHDF5_BUILD_FORTRAN:BOOL=OFF \ -DHDF5_BUILD_JAVA:BOOL=OFF \ -DHDF5_BUILD_DOC:BOOL=OFF \ - -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF \ - -DZLIB_USE_LOCALCONTENT:BOOL=OFF \ -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=ON \ + -DZLIB_USE_LOCALCONTENT:BOOL=OFF \ -DH5_NO_DEPRECATED_SYMBOLS:BOOL=OFF \ -DBUILD_TESTING:BOOL=OFF \ -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml index ae25effc982..7f3b484ae1f 100644 --- a/.github/workflows/nvhpc-cmake.yml +++ b/.github/workflows/nvhpc-cmake.yml @@ -52,14 +52,10 @@ jobs: cd "${{ runner.workspace }}/build" cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \ -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ - -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=OFF \ - -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF \ -DHDF5_ENABLE_PARALLEL:BOOL=ON \ -DMPIEXEC_NUMPROC_FLAG:STRING=-np \ -DMPIEXEC_MAX_NUMPROCS:STRING=2 \ -DHDF5_BUILD_CPP_LIB:BOOL=OFF \ - -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF \ - -DZLIB_USE_LOCALCONTENT:BOOL=OFF \ -DHDF5_BUILD_FORTRAN:BOOL=ON \ -DHDF5_BUILD_JAVA:BOOL=OFF \ -DMPIEXEC_MAX_NUMPROCS:STRING="2" \ diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 2b5297f198d..dcdbd011edd 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -85,7 +85,6 @@ endif () if(NOT DEFINED ZLIBNG_PACKAGE_NAME) set(ZLIBNG_PACKAGE_NAME "zlib-ng") endif () -option (HDF5_ENABLE_ZLIB_SUPPORT "Enable Zlib Filters" OFF) if (HDF5_ENABLE_ZLIB_SUPPORT) if (NOT H5_ZLIB_HEADER) if (NOT ZLIB_USE_EXTERNAL) @@ -151,7 +150,7 @@ if (HDF5_ENABLE_ZLIB_SUPPORT) set (HDF5_ENABLE_ZLIB_SUPPORT OFF CACHE BOOL "" FORCE) message (FATAL_ERROR " ZLib support in HDF5 was enabled but not found") endif () - message(STATUS "H5_ZLIB_HEADER=${H5_ZLIB_HEADER}") + message (VERBOSE "H5_ZLIB_HEADER=${H5_ZLIB_HEADER}") endif () #----------------------------------------------------------------------------- @@ -161,7 +160,6 @@ set(H5_SZIP_FOUND FALSE) if(NOT DEFINED LIBAEC_PACKAGE_NAME) set(LIBAEC_PACKAGE_NAME "libaec") endif () -option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) if (HDF5_ENABLE_SZIP_SUPPORT) option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON) if (NOT SZIP_USE_EXTERNAL) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73dc2d3ee28..48c25154dc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -920,7 +920,11 @@ include (UserMacros.cmake) #----------------------------------------------------------------------------- # Include filter (zlib, szip, etc.) macros #----------------------------------------------------------------------------- -include (CMakeFilters.cmake) +option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) +option (HDF5_ENABLE_ZLIB_SUPPORT "Enable Zlib Filters" OFF) +if (HDF5_ENABLE_ZLIB_SUPPORT OR HDF5_ENABLE_SZIP_SUPPORT) + include (CMakeFilters.cmake) +endif () #----------------------------------------------------------------------------- # Include external VOL connectors @@ -1079,10 +1083,10 @@ if (HDF5_BUILD_DOC AND EXISTS "${HDF5_DOXYGEN_DIR}" AND IS_DIRECTORY "${HDF5_DOX else () set (HDF5_DOXY_WARNINGS "NO") endif () - message(STATUS "Doxygen version: ${DOXYGEN_VERSION}") + message(VERBOSE "Doxygen version: ${DOXYGEN_VERSION}") add_subdirectory (doxygen) else () - message(STATUS "Doxygen needs to be installed to generate the doxygen documentation") + message(WARNING "Doxygen needs to be installed to generate the doxygen documentation") endif () endif () @@ -1101,22 +1105,22 @@ if (EXISTS "${HDF5_SOURCE_DIR}/utils" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/utils option (HDF5_BUILD_PARALLEL_TOOLS "Build Parallel HDF5 Tools" OFF) if (HDF5_BUILD_PARALLEL_TOOLS AND HDF5_ENABLE_PARALLEL) set (CMAKE_PREFIX_PATH "$HDF_RESOURCES_DIR") - find_package(MFU REQUIRED) + find_package (MFU REQUIRED) if (MFU_FOUND) - message(STATUS "LL_PATH=${LL_PATH}") + message (VERBOSE "LL_PATH=${LL_PATH}") set (H5_HAVE_LIBMFU 1) set (H5_HAVE_MFU_H 1) set (CMAKE_REQUIRED_INCLUDES "${MFU_INCLUDE_DIR}") set (MFU_LIBRARY_DEBUG "$MFU_LIBRARY") set (MFU_LIBRARY_RELEASE "$MFU_LIBRARY") endif () - find_package(CIRCLE REQUIRED) + find_package (CIRCLE REQUIRED) if (CIRCLE_FOUND) set (H5_HAVE_LIBCIRCLE 1) set (H5_HAVE_CIRCLE_H 1) set (CMAKE_REQUIRED_INCLUDES "${CIRCLE_INCLUDE_DIR}") endif () - find_package(DTCMP REQUIRED) + find_package (DTCMP REQUIRED) if (DTCMP_FOUND) set (H5_HAVE_LIBDTCMP 1) set (H5_HAVE_DTCMP_H 1) @@ -1139,19 +1143,16 @@ endif () #----------------------------------------------------------------------------- # Include filter plugins #----------------------------------------------------------------------------- -if (${H5_LIBVER_DIR} EQUAL 16 OR HDF5_DEFAULT_API_VERSION MATCHES "v16") - set (HDF5_ENABLE_PLUGIN_SUPPORT OFF CACHE BOOL "" FORCE) - message (VERBOSE "Filter PLUGINs cannot be used with 1.6 API") -else () - include (CMakePlugins.cmake) +option (HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF) +if (HDF5_ENABLE_PLUGIN_SUPPORT) + if (${H5_LIBVER_DIR} EQUAL 16 OR HDF5_DEFAULT_API_VERSION MATCHES "v16") + set (HDF5_ENABLE_PLUGIN_SUPPORT OFF CACHE BOOL "" FORCE) + message (VERBOSE "Filter PLUGINs cannot be used with 1.6 API") + else () + include (CMakePlugins.cmake) - if (HDF5_PACKAGE_EXTLIBS AND NOT HDF5_NO_PACKAGES) - if (HDF5_ENABLE_PLUGIN_SUPPORT AND PLUGIN_FOUND) + if (HDF5_PACKAGE_EXTLIBS AND NOT HDF5_NO_PACKAGES AND PLUGIN_FOUND) PACKAGE_PLUGIN_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) -# option (HDF5_TEST_PLUGIN "Execute plugin tests" ON) -# mark_as_advanced (HDF5_TEST_PLUGIN) - -# TEST_PLUGIN_LIBRARY () endif () endif () endif () diff --git a/CMakePlugins.cmake b/CMakePlugins.cmake index 93d40b2344a..91749c26cfd 100644 --- a/CMakePlugins.cmake +++ b/CMakePlugins.cmake @@ -20,7 +20,7 @@ else () endif () set (PLUGIN_URL ${H5PL_TGZPATH}/${PLUGIN_TGZ_NAME}) endif () -message (STATUS "Filter PLUGIN file is ${PLUGIN_URL}") +message (VERBOSE "Filter PLUGIN file is ${PLUGIN_URL}") include (ExternalProject) #option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO") @@ -50,21 +50,22 @@ endif () #----------------------------------------------------------------------------- # Option for PLUGIN support #----------------------------------------------------------------------------- -option (HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF) if (HDF5_ENABLE_PLUGIN_SUPPORT) if (NOT PLUGIN_USE_EXTERNAL) find_package (PLUGIN NAMES ${PLUGIN_PACKAGE_NAME}${HDF_PACKAGE_EXT}) if (NOT PLUGIN_FOUND) find_package (PLUGIN) # Legacy find endif () - endif () - if (NOT PLUGIN_FOUND) + else () if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNAL_PLUGIN_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) message (STATUS "Filter PLUGIN is built") - else () - message (FATAL_ERROR " PLUGIN is Required for PLUGIN support in HDF5") endif () endif () - message (STATUS "Filter PLUGIN is ON") + if (PLUGIN_FOUND) + message (STATUS "Filter PLUGIN is ON") + else () + set (HDF5_ENABLE_PLUGIN_SUPPORT OFF CACHE BOOL "" FORCE) + message (FATAL_ERROR " PLUGIN support in HDF5 was enabled but not found") + endif () endif () diff --git a/HDF5Examples/CMakeLists.txt b/HDF5Examples/CMakeLists.txt index 3fd1a7eb0da..6efd8afebad 100644 --- a/HDF5Examples/CMakeLists.txt +++ b/HDF5Examples/CMakeLists.txt @@ -86,7 +86,7 @@ if (H5EX_ENABLE_PARALLEL) CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) else () - message (STATUS "Parallel libraries not found") + message (WARNING "Parallel libraries not found") endif () endif () diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 9288bd1e96a..ad95be47cd7 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -28,11 +28,6 @@ using namespace H5; using std::cerr; using std::endl; -#define MESSAGE(V, A) \ - do { \ - if (GetTestVerbosity() > (V)) \ - printf A; \ - } while (0) #define SUBTEST(TEST) \ do { \ printf(" Subtest: %-52s", TEST); \ diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index ecc6de6c972..4a9a2f0447b 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -555,10 +555,10 @@ test_reference_region_1D() *drbuf; // Buffer for reading numeric data from disk // Allocate write & read buffers - wbuf = static_cast(calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1)); - rbuf = static_cast(malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1)); - dwbuf = static_cast(malloc(sizeof(uint8_t) * SPACE3_DIM1)); - drbuf = static_cast(calloc(sizeof(uint8_t), SPACE3_DIM1)); + wbuf = static_cast(calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t))); + rbuf = static_cast(calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t))); + dwbuf = static_cast(calloc(SPACE3_DIM1, sizeof(uint8_t))); + drbuf = static_cast(calloc(SPACE3_DIM1, sizeof(uint8_t))); // Create file FILE1 H5File file1(FILE2, H5F_ACC_TRUNC); diff --git a/config/cmake/HDF5PluginCache.cmake b/config/cmake/HDF5PluginCache.cmake index 8c667077b88..6ad49bd3060 100644 --- a/config/cmake/HDF5PluginCache.cmake +++ b/config/cmake/HDF5PluginCache.cmake @@ -27,6 +27,10 @@ if (H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") set (ENABLE_LZF OFF CACHE BOOL "" FORCE) endif () +if (WIN32 AND (CMAKE_C_COMPILER_ID MATCHES "Intel[Ll][Ll][Vv][Mm]" OR CMAKE_C_COMPILER_ID MATCHES "Intel")) + set (ENABLE_ZFP OFF CACHE BOOL "" FORCE) +endif () + if (NOT DEFINED H5PL_TGZPATH) set (H5PL_TGZPATH "${TGZPATH}" CACHE PATH "PATH for finding plugin tgz file" FORCE) endif () diff --git a/config/cmake/HDF5PluginMacros.cmake b/config/cmake/HDF5PluginMacros.cmake index 3cb03ea2699..11ea0239f95 100644 --- a/config/cmake/HDF5PluginMacros.cmake +++ b/config/cmake/HDF5PluginMacros.cmake @@ -60,6 +60,6 @@ endmacro () #------------------------------------------------------------------------------- macro (PACKAGE_PLUGIN_LIBRARY compress_type) if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") - message (STATUS "Filter PLUGIN is to be packaged") + message (VERBOSE "Filter PLUGIN is to be packaged") endif () endmacro () diff --git a/config/cmake/SignPackageFiles.cmake b/config/cmake/SignPackageFiles.cmake index 81cc5bfff21..32202c3209a 100644 --- a/config/cmake/SignPackageFiles.cmake +++ b/config/cmake/SignPackageFiles.cmake @@ -1,5 +1,5 @@ # This script signs the targets for the package -message(STATUS "Signing script in ${CPACK_TEMPORARY_INSTALL_DIRECTORY} and ${CPACK_PACKAGE_INSTALL_DIRECTORY}") +message(VERBOSE "Signing script in ${CPACK_TEMPORARY_INSTALL_DIRECTORY} and ${CPACK_PACKAGE_INSTALL_DIRECTORY}") # RPM needs ALL_COMPONENTS_IN_ONE added to path between ${CPACK_TEMPORARY_INSTALL_DIRECTORY} and ${CPACK_PACKAGE_INSTALL_DIRECTORY} if (CPACK_GENERATOR MATCHES "RPM") diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index 05014142ec3..841acf48483 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -24,7 +24,7 @@ if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") endif () if (NOT TEST_FILTER) - message (STATUS "Optional TEST_FILTER to be defined") + message (VERBOSE "Optional TEST_FILTER to be defined") endif () if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 95b2648dc48..d60d134db67 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -21,7 +21,7 @@ if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") endif () if (NOT TEST_LIBRARY_DIRECTORY) - message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined") + message (VERBOSE "Require TEST_LIBRARY_DIRECTORY to be defined") endif () if (NOT TEST_FOLDER) message (FATAL_ERROR "Require TEST_FOLDER to be defined") @@ -30,7 +30,7 @@ if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") endif () if (NOT TEST_CLASSPATH) - message (STATUS "Require TEST_CLASSPATH to be defined") + message (VERBOSE "Require TEST_CLASSPATH to be defined") endif () if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index 3ab9e940d28..34635e61416 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -24,7 +24,7 @@ if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") endif () if (NOT TEST_EXPECT) - message (STATUS "Require TEST_EXPECT to be defined") + message (VERBOSE "Require TEST_EXPECT to be defined") endif () if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 079d0277a43..31cb0f714f4 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -3504,37 +3504,6 @@ h5pget_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags) ret_value = 0; return ret_value; } -/****if* H5Pf/h5pset_link_creation_order_c - * NAME - * h5pset_link_creation_order_c - * PURPOSE - * Calls H5Pset_link_creation_order - * - * INPUTS - * gcpl_id - Group creation property list identifier - * crt_order_flags - Creation order flag(s) - * OUTPUTS - * - * RETURNS - * 0 on success, -1 on failure - * SOURCE - */ -int_f -h5pset_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags) -/******/ -{ - int ret_value = -1; - herr_t ret; - /* - * Call H5Pset_link_creation_order function. - */ - ret = H5Pset_link_creation_order((hid_t)*gcpl_id, (unsigned)*crt_order_flags); - if (ret < 0) - return ret_value; - - ret_value = 0; - return ret_value; -} /****if* H5Pf/h5pget_link_phase_change_c * NAME @@ -3682,45 +3651,6 @@ h5pset_create_inter_group_c(hid_t_f *lcpl_id, int_f *crt_intermed_group) return ret_value; } -/****if* H5Pf/h5pget_link_creation_order_c - * NAME - * h5pget_link_creation_order_c - * PURPOSE - * Calls H5Pget_link_creation_order - * - * INPUTS - * - * gcpl_id - Group creation property list identifier - * OUTPUTS - * - * crt_order_flags - Creation order flag(s) - * - * RETURNS - * 0 on success, -1 on failure - * SOURCE - */ -int_f -h5pget_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags) -/******/ -{ - int ret_value = -1; - herr_t ret; - - unsigned c_crt_order_flags; - /* - * Call h5pget_link_creation_order function. - */ - - ret = H5Pget_link_creation_order((hid_t)*gcpl_id, &c_crt_order_flags); - if (ret < 0) - return ret_value; - - *crt_order_flags = (int_f)c_crt_order_flags; - - ret_value = 0; - return ret_value; -} - /****if* H5Pf/h5pset_char_encoding_c * NAME * h5pset_char_encoding_c diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 7e73ac2255a..41529a17180 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -3470,17 +3470,17 @@ SUBROUTINE h5pset_link_creation_order_f(gcpl_id, crt_order_flags, hdferr) INTEGER, INTENT(IN) :: crt_order_flags INTEGER, INTENT(OUT) :: hdferr INTERFACE - INTEGER FUNCTION h5pset_link_creation_order_c(gcpl_id, crt_order_flags) & - BIND(C,NAME='h5pset_link_creation_order_c') - IMPORT :: HID_T + INTEGER FUNCTION h5pset_link_creation_order(gcpl_id, crt_order_flags) & + BIND(C,NAME='H5Pset_link_creation_order') + IMPORT :: HID_T, C_INT IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: gcpl_id - INTEGER, INTENT(IN) :: crt_order_flags + INTEGER(HID_T), VALUE :: gcpl_id + INTEGER(C_INT), VALUE :: crt_order_flags - END FUNCTION H5pset_link_creation_order_c + END FUNCTION H5pset_link_creation_order END INTERFACE - hdferr = h5pset_link_creation_order_c(gcpl_id, crt_order_flags) + hdferr = h5pset_link_creation_order(gcpl_id, INT(crt_order_flags, C_INT)) END SUBROUTINE h5pset_link_creation_order_f @@ -3634,18 +3634,21 @@ SUBROUTINE h5pget_link_creation_order_f(gcpl_id, crt_order_flags, hdferr) INTEGER(HID_T), INTENT(IN) :: gcpl_id INTEGER, INTENT(OUT) :: crt_order_flags INTEGER, INTENT(OUT) :: hdferr + + INTEGER(C_INT) :: c_crt_order_flags INTERFACE - INTEGER FUNCTION h5pget_link_creation_order_c(gcpl_id, crt_order_flags) & - BIND(C,NAME='h5pget_link_creation_order_c') - IMPORT :: HID_T + INTEGER FUNCTION h5pget_link_creation_order(gcpl_id, crt_order_flags) & + BIND(C,NAME='H5Pget_link_creation_order') + IMPORT :: HID_T, C_INT IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: gcpl_id - INTEGER, INTENT(OUT) :: crt_order_flags + INTEGER(HID_T), VALUE :: gcpl_id + INTEGER(C_INT) :: crt_order_flags - END FUNCTION H5pget_link_creation_order_c + END FUNCTION H5pget_link_creation_order END INTERFACE - hdferr = h5pget_link_creation_order_c(gcpl_id, crt_order_flags) + hdferr = h5pget_link_creation_order(gcpl_id, c_crt_order_flags) + crt_order_flags = INT(c_crt_order_flags) END SUBROUTINE h5pget_link_creation_order_f diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2819399ed75..e1e5531065f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -732,7 +732,7 @@ set (H5Z_SOURCES ${HDF5_SRC_DIR}/H5Ztrans.c ) if (H5_ZLIB_HEADER) - message(STATUS "H5_ZLIB_HEADER=${H5_ZLIB_HEADER}") + message(VERBOSE "H5_ZLIB_HEADER for library=${H5_ZLIB_HEADER}") set_source_files_properties(${HDF5_SRC_DIR}/H5Zdeflate.c PROPERTIES COMPILE_DEFINITIONS H5_ZLIB_HEADER="${H5_ZLIB_HEADER}" ) diff --git a/src/H5FL.c b/src/H5FL.c index 575bab14053..a9e4ec0ea30 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -96,73 +96,70 @@ static size_t H5FL_fac_glb_mem_lim = H5FL_FAC_GLB_MEM_LIM; static size_t H5FL_fac_lst_mem_lim = H5FL_FAC_LST_MEM_LIM; #endif /* H5_HAVE_CONCURRENCY */ -/* A garbage collection node for regular free lists */ -typedef struct H5FL_reg_gc_node_t { - H5FL_reg_head_t *list; /* Pointer to the head of the list to garbage collect */ - struct H5FL_reg_gc_node_t *next; /* Pointer to the next node in the list of things to garbage collect */ -} H5FL_reg_gc_node_t; - /* The garbage collection head for regular free lists */ typedef struct H5FL_reg_gc_list_t { #ifdef H5_HAVE_CONCURRENCY - bool init; /* Whether the mutex has been initialized */ - H5TS_dlftt_mutex_t mutex; /* Guard access to the list of free lists */ - H5TS_atomic_size_t mem_freed; /* Amount of free memory on list */ -#else /* H5_HAVE_CONCURRENCY */ + bool init; /* Whether the mutex has been initialized */ + H5TS_dlftt_mutex_t mutex; /* Guard access to the list of free lists */ + H5TS_atomic_size_t mem_freed; /* Amount of free memory on list */ +#else /* H5_HAVE_CONCURRENCY */ size_t mem_freed; /* Amount of free memory on list */ -#endif /* H5_HAVE_CONCURRENCY */ - struct H5FL_reg_gc_node_t *first; /* Pointer to the first node in the list of things to garbage collect */ +#endif /* H5_HAVE_CONCURRENCY */ + + H5FL_reg_head_t *first; /* Pointer to the first node in the list of things to garbage collect */ } H5FL_reg_gc_list_t; /* The head of the list of things to garbage collect */ static H5FL_reg_gc_list_t H5FL_reg_gc_head; -/* A garbage collection node for array free lists */ -typedef struct H5FL_gc_arr_node_t { - H5FL_arr_head_t *list; /* Pointer to the head of the list to garbage collect */ - struct H5FL_gc_arr_node_t *next; /* Pointer to the next node in the list of things to garbage collect */ -} H5FL_gc_arr_node_t; - /* The garbage collection head for array free lists */ -typedef struct H5FL_gc_arr_list_t { +typedef struct H5FL_arr_gc_list_t { #ifdef H5_HAVE_CONCURRENCY - bool init; /* Whether the mutex has been initialized */ - H5TS_dlftt_mutex_t mutex; /* Guard access to the list of free lists */ - H5TS_atomic_size_t mem_freed; /* Amount of free memory on list */ -#else /* H5_HAVE_CONCURRENCY */ + bool init; /* Whether the mutex has been initialized */ + H5TS_dlftt_mutex_t mutex; /* Guard access to the list of free lists */ + H5TS_atomic_size_t mem_freed; /* Amount of free memory on list */ +#else /* H5_HAVE_CONCURRENCY */ size_t mem_freed; /* Amount of free memory on list */ -#endif /* H5_HAVE_CONCURRENCY */ - struct H5FL_gc_arr_node_t *first; /* Pointer to the first node in the list of things to garbage collect */ -} H5FL_gc_arr_list_t; +#endif /* H5_HAVE_CONCURRENCY */ -/* The head of the list of array things to garbage collect */ -static H5FL_gc_arr_list_t H5FL_arr_gc_head; + H5FL_arr_head_t *first; /* Pointer to the first node in the list of things to garbage collect */ +} H5FL_arr_gc_list_t; -/* A garbage collection node for blocks */ -typedef struct H5FL_blk_gc_node_t { - H5FL_blk_head_t *pq; /* Pointer to the head of the PQ to garbage collect */ - struct H5FL_blk_gc_node_t *next; /* Pointer to the next node in the list of things to garbage collect */ -} H5FL_blk_gc_node_t; +/* The head of the list of array things to garbage collect */ +static H5FL_arr_gc_list_t H5FL_arr_gc_head; /* The garbage collection head for blocks */ typedef struct H5FL_blk_gc_list_t { #ifdef H5_HAVE_CONCURRENCY - bool init; /* Whether the mutex has been initialized */ - H5TS_dlftt_mutex_t mutex; /* Guard access to the list of free lists */ - H5TS_atomic_size_t mem_freed; /* Amount of free memory on list */ -#else /* H5_HAVE_CONCURRENCY */ + bool init; /* Whether the mutex has been initialized */ + H5TS_dlftt_mutex_t mutex; /* Guard access to the list of free lists */ + H5TS_atomic_size_t mem_freed; /* Amount of free memory on list */ +#else /* H5_HAVE_CONCURRENCY */ size_t mem_freed; /* Amount of free memory on list */ -#endif /* H5_HAVE_CONCURRENCY */ - struct H5FL_blk_gc_node_t *first; /* Pointer to the first node in the list of things to garbage collect */ +#endif /* H5_HAVE_CONCURRENCY */ + + H5FL_blk_head_t *first; /* Pointer to the first node in the list of things to garbage collect */ } H5FL_blk_gc_list_t; /* The head of the list of PQs to garbage collect */ static H5FL_blk_gc_list_t H5FL_blk_gc_head; -/* A garbage collection node for factory free lists */ -struct H5FL_fac_gc_node_t { - H5FL_fac_head_t *list; /* Pointer to the head of the list to garbage collect */ - struct H5FL_fac_gc_node_t *next; /* Pointer to the next node in the list of things to garbage collect */ +/* Data structure to store each block in factory free list */ +typedef struct H5FL_fac_node_t { + struct H5FL_fac_node_t *next; /* Pointer to next block in free list */ +} H5FL_fac_node_t; + +/* Data structure for free list block factory */ +struct H5FL_fac_head_t { +#ifdef H5_HAVE_CONCURRENCY + H5TS_dlftt_mutex_t mutex; /* Guard access to this factory */ +#endif /* H5_HAVE_CONCURRENCY */ + + unsigned allocated; /* Number of blocks allocated */ + unsigned onlist; /* Number of blocks on free list */ + size_t size; /* Size of the blocks in the list */ + H5FL_fac_node_t *list; /* List of free blocks */ + H5FL_fac_head_t *next, *prev; /* Next & previous factory nodes in list */ }; /* The garbage collection head for factory free lists */ @@ -175,14 +172,9 @@ typedef struct H5FL_fac_gc_list_t { size_t mem_freed; /* Amount of free memory on list */ #endif /* H5_HAVE_CONCURRENCY */ - struct H5FL_fac_gc_node_t *first; /* Pointer to the first node in the list of things to garbage collect */ + H5FL_fac_head_t *first; /* Pointer to the first node in the list of things to garbage collect */ } H5FL_fac_gc_list_t; -/* Data structure to store each block in factory free list */ -struct H5FL_fac_node_t { - struct H5FL_fac_node_t *next; /* Pointer to next block in free list */ -}; - /* Package initialization variable */ bool H5_PKG_INIT_VAR = false; @@ -212,9 +204,6 @@ static int H5FL__fac_term_all(void); /* Declare a free list to manage the H5FL_blk_node_t struct */ H5FL_DEFINE(H5FL_blk_node_t); -/* Declare a free list to manage the H5FL_fac_gc_node_t struct */ -H5FL_DEFINE_STATIC(H5FL_fac_gc_node_t); - /* Declare a free list to manage the H5FL_fac_head_t struct */ H5FL_DEFINE(H5FL_fac_head_t); @@ -367,7 +356,7 @@ H5FL__malloc(size_t mem_size) /* Now try allocating the memory again */ if (NULL == (ret_value = H5MM_malloc(mem_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for chunk"); } /* end if */ done: @@ -377,8 +366,9 @@ H5FL__malloc(size_t mem_size) /*------------------------------------------------------------------------- * Function: H5FL__reg_init * - * Purpose: Initialize a free list for a certain type. Right now, this just - * adds the free list to the list of things to garbage collect. + * Purpose: Initialize a free list for a certain type. Right now, this + * just adds the free list to the list of things to garbage + * collect. * * Return: Success: Non-negative * Failure: Negative @@ -388,17 +378,13 @@ H5FL__malloc(size_t mem_size) static herr_t H5FL__reg_init(H5FL_reg_head_t *head) { - H5FL_reg_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ - herr_t ret_value = SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* Return value*/ +#ifdef H5_HAVE_CONCURRENCY FUNC_ENTER_PACKAGE - - /* Allocate a new garbage collection node */ - if (NULL == (new_node = (H5FL_reg_gc_node_t *)H5MM_malloc(sizeof(H5FL_reg_gc_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* Initialize the new garbage collection node */ - new_node->list = head; +#else /* H5_HAVE_CONCURRENCY */ + FUNC_ENTER_PACKAGE_NOERR +#endif /* H5_HAVE_CONCURRENCY */ #ifdef H5_HAVE_CONCURRENCY /* Initialize the mutex protecting this specific list */ @@ -417,8 +403,8 @@ H5FL__reg_init(H5FL_reg_head_t *head) #endif /* H5_HAVE_CONCURRENCY */ /* Link in to the garbage collection list */ - new_node->next = H5FL_reg_gc_head.first; - H5FL_reg_gc_head.first = new_node; + head->next = H5FL_reg_gc_head.first; + H5FL_reg_gc_head.first = head; #ifdef H5_HAVE_CONCURRENCY /* Release the mutex protecting the list of lists */ @@ -426,7 +412,9 @@ H5FL__reg_init(H5FL_reg_head_t *head) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTUNLOCK, FAIL, "can't unlock list of list's mutex"); #endif /* H5_HAVE_CONCURRENCY */ +#ifdef H5_HAVE_CONCURRENCY done: +#endif /* H5_HAVE_CONCURRENCY */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL__reg_init() */ @@ -563,7 +551,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head) /* Allocate new memory */ if (NULL == (ret_value = H5FL__malloc(head->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); #ifdef H5_HAVE_CONCURRENCY /* Acquire the mutex protecting this list */ @@ -607,7 +595,7 @@ H5FL_reg_calloc(H5FL_reg_head_t *head) /* Allocate the block */ if (NULL == (ret_value = H5FL_reg_malloc(head))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Clear to zeros */ memset(ret_value, 0, head->size); @@ -663,7 +651,7 @@ H5FL__reg_gc_list(H5FL_reg_head_t *head) free_list = tmp; } /* end while */ - /* Decrement the count of nodes allocated and free the node */ + /* Decrement the count of nodes allocated */ head->allocated -= head->onlist; /* Indicate no free nodes on the free list */ @@ -698,8 +686,8 @@ H5FL__reg_gc_list(H5FL_reg_head_t *head) static herr_t H5FL__reg_gc(void) { - H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value = SUCCEED; /* return value*/ + H5FL_reg_head_t *gc_node; /* Pointer into the list of things to garbage collect */ + herr_t ret_value = SUCCEED; /* Return value*/ FUNC_ENTER_PACKAGE @@ -714,7 +702,7 @@ H5FL__reg_gc(void) gc_node = H5FL_reg_gc_head.first; while (gc_node != NULL) { /* Release the free nodes on the list */ - if (H5FL__reg_gc_list(gc_node->list) < 0) + if (H5FL__reg_gc_list(gc_node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed"); /* Go on to the next free list to garbage collect */ @@ -759,7 +747,7 @@ H5FL__reg_gc(void) static int H5FL__reg_term(void) { - H5FL_reg_gc_node_t *left = NULL; /* pointer to garbage collection lists with work left */ + H5FL_reg_head_t *left = NULL; /* pointer to garbage collection lists with work left */ FUNC_ENTER_PACKAGE_NOERR @@ -770,33 +758,30 @@ H5FL__reg_term(void) /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ while (H5FL_reg_gc_head.first != NULL) { - H5FL_reg_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + H5FL_reg_head_t *tmp; /* Temporary pointer to a garbage collection node */ /* Get a copy of the next node */ tmp = H5FL_reg_gc_head.first->next; #ifdef H5FL_DEBUG - printf("%s: head->name = %s, head->allocated = %d\n", __func__, - H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated); + printf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_reg_gc_head.first->name, + (int)H5FL_reg_gc_head.first->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ - if (H5FL_reg_gc_head.first->list->allocated > 0) { + if (H5FL_reg_gc_head.first->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ H5FL_reg_gc_head.first->next = left; left = H5FL_reg_gc_head.first; } /* end if */ - /* No allocations left open for list, get rid of it */ + /* No allocations left open for list, reset it */ else { #ifdef H5_HAVE_CONCURRENCY /* Destroy the mutex protecting this list */ - H5TS_dlftt_mutex_destroy(&H5FL_reg_gc_head.first->list->mutex); + H5TS_dlftt_mutex_destroy(&H5FL_reg_gc_head.first->mutex); #endif /* H5_HAVE_CONCURRENCY */ /* Reset the "initialized" flag, in case we restart this list */ - H5_GLOBAL_SET_INIT(H5FL_reg_gc_head.first->list, false); - - /* Free the node from the garbage collection list */ - H5MM_xfree(H5FL_reg_gc_head.first); + H5_GLOBAL_SET_INIT(H5FL_reg_gc_head.first, false); } /* end else */ H5FL_reg_gc_head.first = tmp; @@ -824,13 +809,15 @@ H5FL__reg_term(void) /*------------------------------------------------------------------------- * Function: H5FL__blk_find_list * - * Purpose: Finds the free list for blocks of a given size. Also moves that - * free list node to the head of the priority queue (if it isn't there - * already). This routine does not manage the actual free list, it just - * works with the priority queue. + * Purpose: Finds the free list for blocks of a given size. Also moves + * that free list node to the head of the priority queue (if it + * isn't already there). This routine does not manage the actual + * free list, it just works with the priority queue. * - * Return: Success: valid pointer to the free list node + * Note: This routine assumes that head->mutex is held, for concurrency + * builds. * + * Return: Success: valid pointer to the free list node * Failure: NULL * *------------------------------------------------------------------------- @@ -853,9 +840,8 @@ H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size) /* Check if we found the correct node */ if (temp->size == size) { /* Take the node found out of it's current position */ - if (temp->next == NULL) { + if (temp->next == NULL) temp->prev->next = NULL; - } /* end if */ else { temp->prev->next = temp->next; temp->next->prev = temp->prev; @@ -884,8 +870,10 @@ H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size) * Purpose: Creates a new free list for blocks of the given size at the * head of the priority queue. * - * Return: Success: valid pointer to the free list node + * Note: This routine assumes that head->mutex is held, for concurrency + * builds. * + * Return: Success: valid pointer to the free list node * Failure: NULL * *------------------------------------------------------------------------- @@ -931,17 +919,13 @@ H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size) static herr_t H5FL__blk_init(H5FL_blk_head_t *head) { - H5FL_blk_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ - herr_t ret_value = SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ +#ifdef H5_HAVE_CONCURRENCY FUNC_ENTER_PACKAGE - - /* Allocate a new garbage collection node */ - if (NULL == (new_node = (H5FL_blk_gc_node_t *)H5MM_malloc(sizeof(H5FL_blk_gc_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* Initialize the new garbage collection node */ - new_node->pq = head; +#else /* H5_HAVE_CONCURRENCY */ + FUNC_ENTER_PACKAGE_NOERR +#endif /* H5_HAVE_CONCURRENCY */ #ifdef H5_HAVE_CONCURRENCY /* Initialize the mutex protecting this specific list */ @@ -956,8 +940,8 @@ H5FL__blk_init(H5FL_blk_head_t *head) #endif /* H5_HAVE_CONCURRENCY */ /* Link in to the garbage collection list */ - new_node->next = H5FL_blk_gc_head.first; - H5FL_blk_gc_head.first = new_node; + head->next = H5FL_blk_gc_head.first; + H5FL_blk_gc_head.first = head; #ifdef H5_HAVE_CONCURRENCY /* Release the mutex protecting the list of lists */ @@ -965,7 +949,9 @@ H5FL__blk_init(H5FL_blk_head_t *head) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTUNLOCK, FAIL, "can't unlock list of list's mutex"); #endif /* H5_HAVE_CONCURRENCY */ +#ifdef H5_HAVE_CONCURRENCY done: +#endif /* H5_HAVE_CONCURRENCY */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL__blk_init() */ @@ -1001,9 +987,9 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTLOCK, FAIL, "can't lock list's mutex"); #endif /* H5_HAVE_CONCURRENCY */ - /* check if there is a free list for blocks of this size */ + /* Check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ - if ((free_list = H5FL__blk_find_list(&(head->pq), size)) != NULL && free_list->list != NULL) + if ((free_list = H5FL__blk_find_list(&head->pq, size)) != NULL && free_list->list != NULL) ret_value = true; else ret_value = false; @@ -1026,7 +1012,6 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) * they don't thrash malloc/free as much. * * Return: Success: valid pointer to the block - * * Failure: NULL * *------------------------------------------------------------------------- @@ -1057,9 +1042,9 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size) have_mutex = true; #endif /* H5_HAVE_CONCURRENCY */ - /* check if there is a free list for blocks of this size */ + /* Check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ - if (NULL != (free_list = H5FL__blk_find_list(&(head->pq), size)) && NULL != free_list->list) { + if (NULL != (free_list = H5FL__blk_find_list(&head->pq, size)) && NULL != free_list->list) { /* Remove the first node from the free list */ temp = free_list->list; free_list->list = free_list->list->next; @@ -1090,7 +1075,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size) /* Allocate new node, with room for the page info header and the actual page data */ if (NULL == (temp = (H5FL_blk_list_t *)H5FL__malloc(sizeof(H5FL_blk_list_t) + size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for chunk"); #ifdef H5_HAVE_CONCURRENCY /* Acquire the mutex protecting this list */ @@ -1100,10 +1085,10 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size) #endif /* H5_HAVE_CONCURRENCY */ /* Check (again) if there is (now) a free list for native blocks of this size */ - if (NULL == (free_list = H5FL__blk_find_list(&(head->pq), size))) + if (NULL == (free_list = H5FL__blk_find_list(&head->pq, size))) /* Create a new list node and insert it to the queue */ - if (NULL == (free_list = H5FL__blk_create_list(&(head->pq), size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for list node"); + if (NULL == (free_list = H5FL__blk_create_list(&head->pq, size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for list node"); /* Increment the number of blocks of this size */ free_list->allocated++; @@ -1148,7 +1133,6 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size) * they don't thrash malloc/free as much. * * Return: Success: valid pointer to the block - * * Failure: NULL * *------------------------------------------------------------------------- @@ -1166,7 +1150,7 @@ H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size) /* Allocate the block */ if (NULL == (ret_value = H5FL_blk_malloc(head, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Clear the block to zeros */ memset(ret_value, 0, size); @@ -1183,7 +1167,6 @@ H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size) * they don't thrash malloc/free as much. * * Return: Success: NULL - * * Failure: never fails * *------------------------------------------------------------------------- @@ -1225,11 +1208,10 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) #endif /* H5FL_DEBUG */ /* Check if there is a free list for native blocks of this size */ - if (NULL == (free_list = H5FL__blk_find_list(&(head->pq), free_size))) + if (NULL == (free_list = H5FL__blk_find_list(&head->pq, free_size))) /* No free list available, create a new list node and insert it to the queue */ - free_list = H5FL__blk_create_list(&(head->pq), free_size); - if (NULL == free_list) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't create new list node"); + if (NULL == (free_list = H5FL__blk_create_list(&head->pq, free_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't create new list node"); /* Prepend the free'd native block to the front of the free list */ temp->next = free_list->list; /* Note: Overwrites the size field in union */ @@ -1275,9 +1257,8 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) * Purpose: Resizes a block. This does things the straightforward, simple way, * not actually using realloc. * - * Return: Success: NULL - * - * Failure: never fails + * Return: Success: Pointer to a block of the new size + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -1299,14 +1280,11 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size) /* Get the pointer to the chunk info header in front of the chunk to free */ temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - sizeof(H5FL_blk_list_t))); - /* check if we are actually changing the size of the buffer */ + /* Check if we are actually changing the size of the buffer */ if (new_size != temp->size) { - size_t blk_size; /* Temporary block size */ - if (NULL == (ret_value = H5FL_blk_malloc(head, new_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block"); - blk_size = MIN(new_size, temp->size); - H5MM_memcpy(ret_value, block, blk_size); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for block"); + H5MM_memcpy(ret_value, block, MIN(new_size, temp->size)); H5FL_blk_free(head, block); } /* end if */ else @@ -1382,7 +1360,7 @@ H5FL__blk_gc_list(H5FL_blk_head_t *head) list_freed = blk_head->onlist * blk_head->size; total_freed += list_freed; - /* Decrement global count of free memory on "block" lists */ + /* Decrement count of free memory on this "block" list */ head->list_mem -= list_freed; /* Indicate no free nodes on the free list */ @@ -1444,8 +1422,8 @@ H5FL__blk_gc_list(H5FL_blk_head_t *head) static herr_t H5FL__blk_gc(void) { - H5FL_blk_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value = SUCCEED; /* return value*/ + H5FL_blk_head_t *gc_node; /* Pointer into the list of things to garbage collect */ + herr_t ret_value = SUCCEED; /* return value*/ FUNC_ENTER_PACKAGE @@ -1460,7 +1438,7 @@ H5FL__blk_gc(void) gc_node = H5FL_blk_gc_head.first; while (gc_node != NULL) { /* For each free list being garbage collected, walk through the nodes and free them */ - if (H5FL__blk_gc_list(gc_node->pq) < 0) + if (H5FL__blk_gc_list(gc_node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed"); /* Go on to the next free list to garbage collect */ @@ -1500,7 +1478,7 @@ H5FL__blk_gc(void) static int H5FL__blk_term(void) { - H5FL_blk_gc_node_t *left = NULL; /* pointer to garbage collection lists with work left */ + H5FL_blk_head_t *left = NULL; /* pointer to garbage collection lists with work left */ FUNC_ENTER_PACKAGE_NOERR @@ -1511,17 +1489,17 @@ H5FL__blk_term(void) /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ while (H5FL_blk_gc_head.first != NULL) { - H5FL_blk_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + H5FL_blk_head_t *tmp; /* Temporary pointer to a garbage collection node */ tmp = H5FL_blk_gc_head.first->next; #ifdef H5FL_DEBUG - printf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_blk_gc_head.first->pq->name, - (int)H5FL_blk_gc_head.first->pq->allocated); + printf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_blk_gc_head.first->name, + (int)H5FL_blk_gc_head.first->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ - if (H5FL_blk_gc_head.first->pq->allocated > 0) { + if (H5FL_blk_gc_head.first->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ H5FL_blk_gc_head.first->next = left; left = H5FL_blk_gc_head.first; @@ -1530,14 +1508,11 @@ H5FL__blk_term(void) else { #ifdef H5_HAVE_CONCURRENCY /* Destroy the mutex protecting this list */ - H5TS_dlftt_mutex_destroy(&H5FL_blk_gc_head.first->pq->mutex); + H5TS_dlftt_mutex_destroy(&H5FL_blk_gc_head.first->mutex); #endif /* H5_HAVE_CONCURRENCY */ /* Reset the "initialized" flag, in case we restart this list */ - H5_GLOBAL_SET_INIT(H5FL_blk_gc_head.first->pq, false); - - /* Free the node from the garbage collection list */ - H5MM_free(H5FL_blk_gc_head.first); + H5_GLOBAL_SET_INIT(H5FL_blk_gc_head.first, false); } /* end else */ H5FL_blk_gc_head.first = tmp; @@ -1576,19 +1551,11 @@ H5FL__blk_term(void) static herr_t H5FL__arr_init(H5FL_arr_head_t *head) { - H5FL_gc_arr_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ - size_t u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* return value*/ + size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* return value*/ FUNC_ENTER_PACKAGE - /* Allocate a new garbage collection node */ - if (NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* Initialize the new garbage collection node */ - new_node->list = head; - #ifdef H5_HAVE_CONCURRENCY /* Initialize the mutex protecting this specific list */ if (H5TS_dlftt_mutex_init(&head->mutex) < 0) @@ -1598,7 +1565,7 @@ H5FL__arr_init(H5FL_arr_head_t *head) /* Allocate room for the free lists */ if (NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem * sizeof(H5FL_arr_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Initialize the size of each array */ for (u = 0; u < (size_t)head->maxelem; u++) @@ -1611,8 +1578,8 @@ H5FL__arr_init(H5FL_arr_head_t *head) #endif /* H5_HAVE_CONCURRENCY */ /* Link in to the garbage collection list */ - new_node->next = H5FL_arr_gc_head.first; - H5FL_arr_gc_head.first = new_node; + head->next = H5FL_arr_gc_head.first; + H5FL_arr_gc_head.first = head; #ifdef H5_HAVE_CONCURRENCY /* Release the mutex protecting the list of lists */ @@ -1784,7 +1751,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) /* Allocate new memory */ if (NULL == (new_obj = H5FL__malloc(sizeof(H5FL_arr_list_t) + mem_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); #ifdef H5_HAVE_CONCURRENCY /* Acquire the mutex protecting this list */ @@ -1838,7 +1805,7 @@ H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem) /* Allocate the array */ if (NULL == (ret_value = H5FL_arr_malloc(head, elem))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Clear to zeros */ memset(ret_value, 0, head->list_arr[elem].size); @@ -1999,8 +1966,8 @@ H5FL__arr_gc_list(H5FL_arr_head_t *head) static herr_t H5FL__arr_gc(void) { - H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value = SUCCEED; /* return value*/ + H5FL_arr_head_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ + herr_t ret_value = SUCCEED; /* return value*/ FUNC_ENTER_PACKAGE @@ -2015,7 +1982,7 @@ H5FL__arr_gc(void) gc_arr_node = H5FL_arr_gc_head.first; while (gc_arr_node != NULL) { /* Release the free nodes on the list */ - if (H5FL__arr_gc_list(gc_arr_node->list) < 0) + if (H5FL__arr_gc_list(gc_arr_node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed"); /* Go on to the next free list to garbage collect */ @@ -2055,7 +2022,7 @@ H5FL__arr_gc(void) static int H5FL__arr_term(void) { - H5FL_gc_arr_node_t *left = NULL; /* pointer to garbage collection lists with work left */ + H5FL_arr_head_t *left = NULL; /* pointer to garbage collection lists with work left */ FUNC_ENTER_PACKAGE_NOERR @@ -2066,16 +2033,16 @@ H5FL__arr_term(void) /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ while (H5FL_arr_gc_head.first != NULL) { - H5FL_gc_arr_node_t *tmp; /* Temporary pointer to a garbage collection node */ + H5FL_arr_head_t *tmp; /* Temporary pointer to a garbage collection node */ tmp = H5FL_arr_gc_head.first->next; /* Check if the list has allocations outstanding */ #ifdef H5FL_DEBUG - printf("%s: head->name = %s, head->allocated = %d\n", __func__, - H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated); + printf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_arr_gc_head.first->name, + (int)H5FL_arr_gc_head.first->allocated); #endif /* H5FL_DEBUG */ - if (H5FL_arr_gc_head.first->list->allocated > 0) { + if (H5FL_arr_gc_head.first->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ H5FL_arr_gc_head.first->next = left; left = H5FL_arr_gc_head.first; @@ -2083,18 +2050,15 @@ H5FL__arr_term(void) /* No allocations left open for list, get rid of it */ else { /* Free the array of free lists */ - H5MM_xfree(H5FL_arr_gc_head.first->list->list_arr); + H5MM_xfree(H5FL_arr_gc_head.first->list_arr); #ifdef H5_HAVE_CONCURRENCY /* Destroy the mutex protecting this list */ - H5TS_dlftt_mutex_destroy(&H5FL_arr_gc_head.first->list->mutex); + H5TS_dlftt_mutex_destroy(&H5FL_arr_gc_head.first->mutex); #endif /* H5_HAVE_CONCURRENCY */ /* Reset the "initialized" flag, in case we restart this list */ - H5_GLOBAL_SET_INIT(H5FL_arr_gc_head.first->list, false); - - /* Free the node from the garbage collection list */ - H5MM_free(H5FL_arr_gc_head.first); + H5_GLOBAL_SET_INIT(H5FL_arr_gc_head.first, false); } /* end else */ H5FL_arr_gc_head.first = tmp; @@ -2141,7 +2105,7 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) assert(obj); /* Use block routine */ - H5FL_blk_free(&(head->queue), obj); + H5FL_blk_free(&head->queue, obj); FUNC_LEAVE_NOAPI(NULL) } /* end H5FL_seq_free() */ @@ -2168,7 +2132,7 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem) assert(elem); /* Use block routine */ - ret_value = H5FL_blk_malloc(&(head->queue), head->size * elem); + ret_value = H5FL_blk_malloc(&head->queue, head->size * elem); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_malloc() */ @@ -2195,7 +2159,7 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem) assert(elem); /* Use block routine */ - ret_value = H5FL_blk_calloc(&(head->queue), head->size * elem); + ret_value = H5FL_blk_calloc(&head->queue, head->size * elem); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_calloc() */ @@ -2222,7 +2186,7 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem) assert(new_elem); /* Use block routine */ - ret_value = H5FL_blk_realloc(&(head->queue), obj, head->size * new_elem); + ret_value = H5FL_blk_realloc(&head->queue, obj, head->size * new_elem); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_realloc() */ @@ -2240,9 +2204,8 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem) H5FL_fac_head_t * H5FL_fac_init(size_t size) { - H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */ - H5FL_fac_head_t *factory = NULL; /* Pointer to new block factory */ - H5FL_fac_head_t *ret_value = NULL; /* Return value */ + H5FL_fac_head_t *factory = NULL; /* Pointer to new block factory */ + H5FL_fac_head_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -2251,18 +2214,11 @@ H5FL_fac_init(size_t size) /* Allocate room for the new factory */ if (NULL == (factory = (H5FL_fac_head_t *)H5FL_CALLOC(H5FL_fac_head_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for factory object"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for factory object"); /* Set size of blocks for factory */ factory->size = size; - /* Allocate a new garbage collection node */ - if (NULL == (new_node = (H5FL_fac_gc_node_t *)H5FL_MALLOC(H5FL_fac_gc_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Initialize the new garbage collection node */ - new_node->list = factory; - /* Make certain that the space allocated is large enough to store a free list pointer (eventually) */ if (factory->size < sizeof(H5FL_fac_node_t)) factory->size = sizeof(H5FL_fac_node_t); @@ -2278,11 +2234,10 @@ H5FL_fac_init(size_t size) #endif /* H5_HAVE_CONCURRENCY */ /* Link in to the garbage collection list */ - new_node->next = H5FL_fac_gc_head.first; - H5FL_fac_gc_head.first = new_node; - if (new_node->next) - new_node->next->list->prev_gc = new_node; - /* The new factory's prev_gc field will be set to NULL */ + factory->next = H5FL_fac_gc_head.first; + H5FL_fac_gc_head.first = factory; + if (factory->next) + factory->next->prev = factory; #ifdef H5_HAVE_CONCURRENCY /* Release the mutex protecting the list of lists */ @@ -2294,12 +2249,9 @@ H5FL_fac_init(size_t size) ret_value = factory; done: - if (!ret_value) { + if (!ret_value) if (factory) factory = H5FL_FREE(H5FL_fac_head_t, factory); - if (new_node) - new_node = H5FL_FREE(H5FL_fac_gc_node_t, new_node); - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_fac_init() */ @@ -2309,7 +2261,8 @@ H5FL_fac_init(size_t size) * * Purpose: Release a block back to a factory & put on free list * - * Return: NULL + * Return: Success: NULL + * Failure: never fails * *------------------------------------------------------------------------- */ @@ -2429,7 +2382,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head) #endif /* H5_HAVE_CONCURRENCY */ if (NULL == (ret_value = H5FL__malloc(head->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); #ifdef H5_HAVE_CONCURRENCY /* Acquire the mutex protecting the factory */ @@ -2474,7 +2427,7 @@ H5FL_fac_calloc(H5FL_fac_head_t *head) /* Allocate the block */ if (NULL == (ret_value = H5FL_fac_malloc(head))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Clear to zeros */ memset(ret_value, 0, head->size); @@ -2565,8 +2518,8 @@ H5FL__fac_gc_list(H5FL_fac_head_t *head) static herr_t H5FL__fac_gc(void) { - H5FL_fac_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value = SUCCEED; /* return value*/ + H5FL_fac_head_t *fac; /* Pointer into the list of things to garbage collect */ + herr_t ret_value = SUCCEED; /* return value*/ FUNC_ENTER_PACKAGE @@ -2578,14 +2531,14 @@ H5FL__fac_gc(void) #endif /* H5_HAVE_CONCURRENCY */ /* Walk through all the free lists, free()'ing the nodes */ - gc_node = H5FL_fac_gc_head.first; - while (gc_node != NULL) { + fac = H5FL_fac_gc_head.first; + while (fac != NULL) { /* Release the free nodes on the list */ - if (H5FL__fac_gc_list(gc_node->list) < 0) + if (H5FL__fac_gc_list(fac) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed"); /* Go on to the next free list to garbage collect */ - gc_node = gc_node->next; + fac = fac->next; } /* end while */ #ifdef H5_HAVE_CONCURRENCY @@ -2612,8 +2565,7 @@ H5FL__fac_gc(void) herr_t H5FL_fac_term(H5FL_fac_head_t *factory) { - H5FL_fac_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ /* NOINIT OK here because this must be called after H5FL_fac_init -NAF */ FUNC_ENTER_NOAPI_NOINIT @@ -2642,24 +2594,19 @@ H5FL_fac_term(H5FL_fac_head_t *factory) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "factory still has objects allocated"); /* Unlink block free list for factory from global free list */ - if (factory->prev_gc) { - H5FL_fac_gc_node_t *last = - factory->prev_gc; /* Garbage collection node before the one being removed */ - - assert(last->next->list == factory); - tmp = last->next->next; - last->next = H5FL_FREE(H5FL_fac_gc_node_t, last->next); - last->next = tmp; - if (tmp) - tmp->list->prev_gc = last; + if (factory->prev) { + H5FL_fac_head_t *last = factory->prev; /* Factory before the one being removed */ + + assert(last->next == factory); + last->next = factory->next; + if (factory->next) + factory->next->prev = last; } else { - assert(H5FL_fac_gc_head.first->list == factory); - tmp = H5FL_fac_gc_head.first->next; - H5FL_fac_gc_head.first = H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first); - H5FL_fac_gc_head.first = tmp; - if (tmp) - tmp->list->prev_gc = NULL; + assert(H5FL_fac_gc_head.first == factory); + H5FL_fac_gc_head.first = H5FL_fac_gc_head.first->next; + if (H5FL_fac_gc_head.first) + H5FL_fac_gc_head.first->prev = NULL; } /* end else */ #ifdef H5_HAVE_CONCURRENCY @@ -2703,25 +2650,8 @@ H5FL__fac_term_all(void) if (H5FL_fac_gc_head.init) { #endif /* H5_HAVE_CONCURRENCY */ - /* Free the nodes on the garbage collection list */ - while (H5FL_fac_gc_head.first != NULL) { - H5FL_fac_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - - tmp = H5FL_fac_gc_head.first->next; - -#ifdef H5FL_DEBUG - printf("%s: head->size = %d, head->allocated = %d\n", __func__, - (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); -#endif /* H5FL_DEBUG */ - - /* The list cannot have any allocations outstanding */ - assert(H5FL_fac_gc_head.first->list->allocated == 0); - - /* Free the node from the garbage collection list */ - H5FL_fac_gc_head.first = H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first); - - H5FL_fac_gc_head.first = tmp; - } /* end while */ + /* Sanity check */ + assert(NULL == H5FL_fac_gc_head.first); #ifdef H5_HAVE_CONCURRENCY /* Destroy concurrency objects */ @@ -2795,7 +2725,6 @@ H5FL_garbage_coll(void) * int blk_list_lim; IN: The limit on memory used in each "block" free list * * Return: Success: non-negative - * * Failure: negative * *------------------------------------------------------------------------- @@ -2870,7 +2799,7 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s /* Retrieve the amount of "regular" memory used */ if (reg_size) { - H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of lists */ + H5FL_reg_head_t *gc_node; /* Pointer into the list of lists */ #ifdef H5_HAVE_CONCURRENCY if (H5FL_reg_gc_head.init) { @@ -2883,13 +2812,11 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s *reg_size = 0; gc_node = H5FL_reg_gc_head.first; while (gc_node != NULL) { - H5FL_reg_head_t *reg_list = gc_node->list; /* Head of list */ - /* Sanity check */ - assert(H5_GLOBAL_IS_INIT(reg_list)); + assert(H5_GLOBAL_IS_INIT(gc_node)); /* Add the amount of memory for this list */ - *reg_size += (reg_list->size * reg_list->allocated); + *reg_size += (gc_node->size * gc_node->allocated); /* Go on to the next free list */ gc_node = gc_node->next; @@ -2904,7 +2831,7 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s /* Retrieve the amount of "array" memory used */ if (arr_size) { - H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ + H5FL_arr_head_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ #ifdef H5_HAVE_CONCURRENCY if (H5FL_arr_gc_head.init) { @@ -2917,19 +2844,17 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s *arr_size = 0; gc_arr_node = H5FL_arr_gc_head.first; while (gc_arr_node != NULL) { - H5FL_arr_head_t *head = gc_arr_node->list; /* Head of array list elements */ - /* Sanity check */ - assert(H5_GLOBAL_IS_INIT(head)); + assert(H5_GLOBAL_IS_INIT(gc_arr_node)); /* Check for any allocated elements in this list */ - if (head->allocated > 0) { + if (gc_arr_node->allocated > 0) { unsigned u; /* Walk through the free lists for array sizes */ - for (u = 0; u < (unsigned)head->maxelem; u++) + for (u = 0; u < (unsigned)gc_arr_node->maxelem; u++) /* Add the amount of memory for this size */ - *arr_size += head->list_arr[u].allocated * head->list_arr[u].size; + *arr_size += gc_arr_node->list_arr[u].allocated * gc_arr_node->list_arr[u].size; } /* end if */ /* Go on to the next free list */ @@ -2945,7 +2870,7 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s /* Retrieve the amount of "block" memory used */ if (blk_size) { - H5FL_blk_gc_node_t *gc_blk_node; /* Pointer into the list of things */ + H5FL_blk_head_t *gc_blk_node; /* Pointer into the list of things */ #ifdef H5_HAVE_CONCURRENCY if (H5FL_blk_gc_head.init) { @@ -2961,7 +2886,7 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list block node */ /* Loop through all the nodes in the block free list queue */ - blk_head = gc_blk_node->pq->pq; + blk_head = gc_blk_node->pq; while (blk_head != NULL) { /* Add size of blocks on this list */ *blk_size += (blk_head->allocated * blk_head->size); @@ -2983,7 +2908,7 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s /* Retrieve the amount of "factory" memory used */ if (fac_size) { - H5FL_fac_gc_node_t *gc_fac_node; /* Pointer into the list of things to garbage collect */ + H5FL_fac_head_t *gc_fac_node; /* Pointer into the list of things to garbage collect */ #ifdef H5_HAVE_CONCURRENCY if (H5FL_fac_gc_head.init) { @@ -2996,14 +2921,13 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s gc_fac_node = H5FL_fac_gc_head.first; *fac_size = 0; while (gc_fac_node != NULL) { - H5FL_fac_head_t *fac_head = gc_fac_node->list; /* Head node for factory list */ - /* Add size of blocks on this list */ - *fac_size += (fac_head->allocated * fac_head->size); + *fac_size += (gc_fac_node->allocated * gc_fac_node->size); /* Go on to the next free list to garbage collect */ gc_fac_node = gc_fac_node->next; } /* end while */ + #ifdef H5_HAVE_CONCURRENCY /* Release the mutex protecting the list of lists */ if (H5TS_dlftt_mutex_release(&H5FL_fac_gc_head.mutex) < 0) diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index c42bf8fa290..8f428d2af12 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -50,13 +50,14 @@ typedef struct H5FL_reg_head_t { H5_global_t dlcp_info; /* Information for init */ /* (MUST be first field in structure) */ #ifdef H5_HAVE_CONCURRENCY - H5TS_dlftt_mutex_t mutex; /* Guard access to this free list */ -#endif /* H5_HAVE_CONCURRENCY */ - unsigned allocated; /* Number of blocks allocated */ - unsigned onlist; /* Number of blocks on free list */ - const char *name; /* Name of the type */ - size_t size; /* Size of the blocks in the list */ - H5FL_reg_node_t *list; /* List of free blocks */ + H5TS_dlftt_mutex_t mutex; /* Guard access to this free list */ +#endif /* H5_HAVE_CONCURRENCY */ + unsigned allocated; /* Number of blocks allocated */ + unsigned onlist; /* Number of blocks on free list */ + const char *name; /* Name of the type */ + size_t size; /* Size of the blocks in the list */ + H5FL_reg_node_t *list; /* List of free blocks */ + struct H5FL_reg_head_t *next; /* Next 'reg' head free list */ } H5FL_reg_head_t; /* @@ -125,13 +126,14 @@ typedef struct H5FL_blk_head_t { H5_global_t dlcp_info; /* Information for init */ /* (MUST be first field in structure) */ #ifdef H5_HAVE_CONCURRENCY - H5TS_dlftt_mutex_t mutex; /* Guard access to this free list */ -#endif /* H5_HAVE_CONCURRENCY */ - unsigned allocated; /* Total number of blocks allocated */ - unsigned onlist; /* Total number of blocks on free list */ - size_t list_mem; /* Total amount of memory in blocks on free list */ - const char *name; /* Name of the type */ - H5FL_blk_node_t *pq; /* Pointer to first free list in queue */ + H5TS_dlftt_mutex_t mutex; /* Guard access to this free list */ +#endif /* H5_HAVE_CONCURRENCY */ + unsigned allocated; /* Total number of blocks allocated */ + unsigned onlist; /* Total number of blocks on free list */ + size_t list_mem; /* Total amount of memory in blocks on free list */ + const char *name; /* Name of the type */ + H5FL_blk_node_t *pq; /* Pointer to first free list in queue */ + struct H5FL_blk_head_t *next; /* Next 'blk' head free list */ } H5FL_blk_head_t; /* @@ -202,15 +204,16 @@ typedef struct H5FL_arr_head_t { H5_global_t dlcp_info; /* Information for init */ /* (MUST be first field in structure) */ #ifdef H5_HAVE_CONCURRENCY - H5TS_dlftt_mutex_t mutex; /* Guard access to this free list */ -#endif /* H5_HAVE_CONCURRENCY */ - unsigned allocated; /* Total number of blocks allocated */ - size_t list_mem; /* Amount of memory in block on free list */ - const char *name; /* Name of the type */ - int maxelem; /* Maximum number of elements in an array */ - size_t base_size; /* Size of the "base" object in the list */ - size_t elem_size; /* Size of the array elements in the list */ - H5FL_arr_node_t *list_arr; /* Array of lists of free blocks */ + H5TS_dlftt_mutex_t mutex; /* Guard access to this free list */ +#endif /* H5_HAVE_CONCURRENCY */ + unsigned allocated; /* Total number of blocks allocated */ + size_t list_mem; /* Amount of memory in block on free list */ + const char *name; /* Name of the type */ + int maxelem; /* Maximum number of elements in an array */ + size_t base_size; /* Size of the "base" object in the list */ + size_t elem_size; /* Size of the array elements in the list */ + H5FL_arr_node_t *list_arr; /* Array of lists of free blocks */ + struct H5FL_arr_head_t *next; /* Next 'arr' head free list */ } H5FL_arr_head_t; /* @@ -317,20 +320,7 @@ typedef struct H5FL_seq_head_t { #endif /* H5_NO_SEQ_FREE_LISTS */ /* Forward declarations of the data structures for free list block factory */ -typedef struct H5FL_fac_gc_node_t H5FL_fac_gc_node_t; -typedef struct H5FL_fac_node_t H5FL_fac_node_t; - -/* Data structure for free list block factory */ -typedef struct H5FL_fac_head_t { -#ifdef H5_HAVE_CONCURRENCY - H5TS_dlftt_mutex_t mutex; /* Guard access to this factory */ -#endif /* H5_HAVE_CONCURRENCY */ - unsigned allocated; /* Number of blocks allocated */ - unsigned onlist; /* Number of blocks on free list */ - size_t size; /* Size of the blocks in the list */ - H5FL_fac_node_t *list; /* List of free blocks */ - H5FL_fac_gc_node_t *prev_gc; /* Previous garbage collection node in list */ -} H5FL_fac_head_t; +typedef struct H5FL_fac_head_t H5FL_fac_head_t; /* * Macros for defining & using free list factories diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1219b0fb216..888ebc99163 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -512,7 +512,7 @@ endif () #-- Adding test for direct_chunk if (H5_ZLIB_HEADER) - message(STATUS "H5_ZLIB_HEADER=${H5_ZLIB_HEADER}") + message(VERBOSE "H5_ZLIB_HEADER for direct_chunk=${H5_ZLIB_HEADER}") set_source_files_properties(${HDF5_TEST_SOURCE_DIR}/direct_chunk.c PROPERTIES COMPILE_DEFINITIONS H5_ZLIB_HEADER="${H5_ZLIB_HEADER}" diff --git a/test/testframe.c b/test/testframe.c index 05cb57967ea..b960781d153 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -537,6 +537,15 @@ TestShutdown(void) return SUCCEED; } +/* + * Retrieve the MPI rank for this process. + */ +H5_ATTR_PURE int +GetTestFrameworkProcessID(void) +{ + return TestFrameworkProcessID_g; +} + /* * Retrieve the verbosity level for the testing framework */ diff --git a/test/testframe.h b/test/testframe.h index 2b24f03c07d..f90e05fb717 100644 --- a/test/testframe.h +++ b/test/testframe.h @@ -91,16 +91,16 @@ * Verbose queries * Only None needs an exact match. The rest are at least as much. */ -#define VERBOSE_NONE (TestVerbosity_g == VERBO_NONE) -#define VERBOSE_DEF (TestVerbosity_g >= VERBO_DEF) -#define VERBOSE_LO (TestVerbosity_g >= VERBO_LO) -#define VERBOSE_MED (TestVerbosity_g >= VERBO_MED) -#define VERBOSE_HI (TestVerbosity_g >= VERBO_HI) +#define VERBOSE_NONE (GetTestVerbosity() == VERBO_NONE) +#define VERBOSE_DEF (GetTestVerbosity() >= VERBO_DEF) +#define VERBOSE_LO (GetTestVerbosity() >= VERBO_LO) +#define VERBOSE_MED (GetTestVerbosity() >= VERBO_MED) +#define VERBOSE_HI (GetTestVerbosity() >= VERBO_HI) /* Used to document process through a test */ #define MESSAGE(V, A) \ do { \ - if (TestFrameworkProcessID_g == 0 && TestVerbosity_g > (V)) \ + if (GetTestFrameworkProcessID() == 0 && GetTestVerbosity() > (V)) \ printf A; \ } while (0) @@ -112,9 +112,6 @@ /* Variables */ /*************/ -H5TEST_DLLVAR int TestFrameworkProcessID_g; -H5TEST_DLLVAR int TestVerbosity_g; - /**************/ /* Prototypes */ /**************/ @@ -422,6 +419,20 @@ H5TEST_DLL herr_t PerformTests(void); */ H5TEST_DLL void TestSummary(FILE *stream); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Returns the MPI rank for this process + * + * \return The MPI rank of this process + * + * \details GetTestFrameworkProcessID() returns the MPI rank for this process. + * Always returns rank 0 in serial HDF5. + * + */ +H5TEST_DLL int GetTestFrameworkProcessID(void); + /** * -------------------------------------------------------------------------- * \ingroup H5TEST diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 0c281b006e8..95f396663af 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -631,7 +631,7 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / * create output *------------------------------------------------------------------------- */ - refbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ + refbuf = (hdset_reg_ref_t *)calloc((size_t)nelmts, sizeof(hdset_reg_ref_t)); /*init to zero */ if (refbuf == NULL) { printf("cannot allocate memory\n"); H5TOOLS_GOTO_ERROR((-1), "calloc failed"); diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 5d36e0cd764..112d5066de1 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -808,7 +808,7 @@ ADD_H5_TEST (h5diff_63 1 -v ${STRINGS1} ${STRINGS2} string4 string4) ADD_H5_TEST (h5diff_600 1 ${FILE1}) # 6.1: Check if non-exist object name is specified -ADD_H5_CMP_TEST (h5diff_601 2 "Object could not be found" ${FILE1} ${FILE1} nono_obj) +ADD_H5_CMP_TEST (h5diff_601 2 "could not be found" ${FILE1} ${FILE1} nono_obj) # ############################################################################## # # -d diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 2a06a2323a3..c81d114164f 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -2406,10 +2406,10 @@ gent_attrreg(void) int i; /* counting variables */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf = (hdset_reg_ref_t *)malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); - dwbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - drbuf = (uint8_t *)calloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2); + wbuf = (hdset_reg_ref_t *)calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t)); + rbuf = (hdset_reg_ref_t *)calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t)); + dwbuf = (uint8_t *)calloc(SPACE2_DIM1 * SPACE2_DIM2, sizeof(uint8_t)); + drbuf = (uint8_t *)calloc(SPACE2_DIM1 * SPACE2_DIM2, sizeof(uint8_t)); /* Create file */ fid1 = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -3121,7 +3121,7 @@ gent_array1_big(void) block[0] = 1; /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + wbuf = (hdset_reg_ref_t *)calloc(SPACE1_DIM1, sizeof(hdset_reg_ref_t)); wdata = (int *)malloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM)); /* Allocate and initialize array data to write */ diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 646bd1a6de2..46170f9237d 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -113,7 +113,7 @@ set (zip_perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c ) if (H5_ZLIB_HEADER) - message(STATUS "H5_ZLIB_HEADER=${H5_ZLIB_HEADER}") + message (VERBOSE "H5_ZLIB_HEADER for zip_perf=${H5_ZLIB_HEADER}") if (HDF5_USE_ZLIB_NG) add_compile_definitions(H5_HAVE_ZLIBNG_H=1 H5_ZLIB_HEADER="${H5_ZLIB_HEADER}") endif ()