diff --git a/.github/workflows/linux-auto-aocc-ompi.yml b/.github/workflows/linux-auto-aocc-ompi.yml new file mode 100644 index 00000000000..45559105b28 --- /dev/null +++ b/.github/workflows/linux-auto-aocc-ompi.yml @@ -0,0 +1,66 @@ +name: linux autotools aocc ompi + +on: + push: + pull_request: + branches: + - hdf5_1_14 + paths-ignore: + - '.github/CODEOWNERS' + - '.github/FUNDING.yml' + - 'doc/**' + - 'release_docs/**' + - 'ACKNOWLEDGEMENTS' + - 'COPYING**' + - '**.md' + +# Using concurrency to cancel any in-progress job or run +concurrency: + group: ${{ github.workflow }}-${{ github.sha || github.event.pull_request.number }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install System dependencies + run: | + sudo apt update + sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen openssl libtool libtool-bin build-essential libncurses-dev libquadmath0 libstdc++6 libxml2 + - name: Install AOCC 4.1.0 + run: | + wget https://download.amd.com/developer/eula/aocc/aocc-4-1/aocc-compiler-4.1.0.tar + tar -xvf aocc-compiler-4.1.0.tar + cd aocc-compiler-4.1.0 + bash install.sh + source /home/runner/work/hdf5/hdf5/setenv_AOCC.sh + which clang + which flang + clang -v + - name: Install OpenMPI 4.1.5 + run: | + export LD_LIBRARY_PATH=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/lib:/usr/local/lib + wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.5.tar.gz + tar zxvf openmpi-4.1.5.tar.gz + cd openmpi-4.1.5 + ./configure CC=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/bin/clang FC=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/bin/flang --prefix=/usr/local + make + sudo make install + - name: Install HDF5 + env: + NPROCS: 2 + run: | + export LD_LIBRARY_PATH=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/lib:/usr/local/lib/openmpi:/usr/local/lib + export LD_RUN_PATH=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/lib:/usr/local/lib/openmpi:/usr/local/lib + export PATH=/usr/local/bin:$PATH + ./autogen.sh + ./configure --prefix=/tmp --enable-parallel --enable-shared CC=/usr/local/bin/mpicc LDFLAGS="-L/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/lib -L/usr/local/lib/openmpi" + make -j + make check -j + make install + make uninstall diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index e07f3531be3..da8e2c74ff4 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -85,12 +85,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) endif () else () - if (BUILD_ZLIB_WITH_FETCHCONTENT) - # Only tgz files available - ORIGINAL_ZLIB_LIBRARY ("TGZ") - message (VERBOSE "HDF5_ZLIB is built from fetch content") - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY}) - elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) message (VERBOSE "Filter HDF5_ZLIB is built") set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY}) diff --git a/config/clang-cxxflags b/config/clang-cxxflags index ead31525ec8..2dcd0cbcf81 100644 --- a/config/clang-cxxflags +++ b/config/clang-cxxflags @@ -47,6 +47,7 @@ load_clang_arguments() done) IFS=' ' echo "$*" } + # Get the compiler version in a way that works for clang++ # unless a compiler version is already known # diff --git a/config/clang-fflags b/config/clang-fflags new file mode 100644 index 00000000000..786c729ca91 --- /dev/null +++ b/config/clang-fflags @@ -0,0 +1,139 @@ +# -*- 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 COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# Clang Fortran compiler (flang) or a derivative. It is careful not to do +# anything if the compiler is not Clang; otherwise 'cc_flags_set' is set +# to 'yes' +# + +# Get the compiler version in a way that works for clang +# unless a compiler version is already known +# +# cc_vendor: The compiler name: flang +# cc_version: Version number: 6.0.0, 7.3.0, ... 10.0.1 +# +if test "X-" = "X-$f9x_flags_set"; then + # flang -v will return version number following "clang" + f9x_version="`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 |\ + grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`" + if test -n "$f9x_version"; then + f9x_vendor="flang" + fi + if test "X-" != "X-$f9x_version"; then + + # Get the compiler version numbers + f9x_vers_major=`echo $f9x_version | cut -f1 -d.` + f9x_vers_minor=`echo $f9x_version | cut -f2 -d.` + f9x_vers_patch=`echo $f9x_version | cut -f3 -d.` + test -n "$f9x_vers_major" || f9x_vers_major=0 + test -n "$f9x_vers_minor" || f9x_vers_minor=0 + test -n "$f9x_vers_patch" || f9x_vers_patch=0 + fi +fi + +if test "X-flang" = "X-$f9x_vendor"; then + + echo "compiler '$FC' is $f9x_vendor-$f9x_version" + + FC_BASENAME=flang + F9XSUFFIXFLAG="" + FSEARCH_DIRS="" + + ############################### + # Architecture-specific flags # + ############################### + + arch= + # Nothing currently. (Uncomment code below and modify to add any) + #case "$host_os-$host_cpu" in + # *-i686) + # arch="-march=i686" + # ;; + #esac + + H5_FCFLAGS="$H5_FCFLAGS $arch" + + ############## + # Production # + ############## + + PROD_FCFLAGS= + + ######### + # Debug # + ######### + + DEBUG_FCFLAGS= + + ######################## + # Enhanced Diagnostics # + ######################## + + NO_DIAGS_FCFLAGS= + DIAGS_FCFLAGS= + + ########### + # Symbols # + ########### + + NO_SYMBOLS_FCFLAGS= + SYMBOLS_FCFLAGS= + + ############# + # Profiling # + ############# + + PROFILE_FCFLAGS= + + ################ + # Optimization # + ################ + + HIGH_OPT_FCFLAGS="-O3" + NO_OPT_FCFLAGS="-O0" + DEBUG_OPT_FCFLAGS="-O0" + + ############ + # Warnings # + ############ + + ########### + # General # + ########### + + # We don't use OpenMP, so don't link to it + H5_FCFLAGS="$H5_FCFLAGS -nomp" + + ###################### + # Developer warnings # + ###################### + + NO_DEVELOPER_WARNING_FCFLAGS= + DEVELOPER_WARNING_FCFLAGS= + + ############################# + # Version-specific warnings # + ############################# + + ################# + # Flags are set # + ################# + f9x_flags_set=yes +fi + +# Clear f9x info if no flags set +if test "X$f9x_flags_set" = "X"; then + f9x_vendor= + f9x_version= +fi diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake index 86d04315720..e08df05c52d 100644 --- a/config/cmake/HDFFortranCompilerFlags.cmake +++ b/config/cmake/HDFFortranCompilerFlags.cmake @@ -52,6 +52,11 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERS endif () endif () +if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG") + message (STATUS "... Select IEEE floating-point mode full") + list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ieee=full") +endif () + if (NOT MSVC AND NOT MINGW) # General flags if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 95d7d644fcc..7f3c3398048 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -92,7 +92,7 @@ else fc_version_info=`$FC -V | grep Absoft` ;; # The NAG compiler - nagfor*|nagftn*) + *nagfor*|*nagftn*) RM='rm -f' tmpfile=/tmp/cmpver.$$ $FC -V >& $tmpfile @@ -122,6 +122,9 @@ fi # Figure out Intel FC compiler flags . $srcdir/config/intel-fflags +# Figure out Clang FC compiler flags +. $srcdir/config/clang-fflags + case $FC_BASENAME in # # Absoft compiler @@ -163,7 +166,7 @@ case $FC_BASENAME in # NOTE: The default is -ieee=stop, which will cause problems # when the H5T module performs floating-point type # introspection - H5_FCFLAGS="$H5_FCFLAGS -ieee=full" + AM_FCFLAGS="$AM_FCFLAGS -ieee=full" FSEARCH_DIRS="" # Production diff --git a/configure.ac b/configure.ac index 1a745ff4204..48fdafa96de 100644 --- a/configure.ac +++ b/configure.ac @@ -4225,15 +4225,18 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ;; esac - ### libtool does not pass the correct argument linking (-Wl,-Wl,,) for the NAG Fortran compiler + ### libtool does not pass the correct linker options for some Fortran compilers ### on Linux (other OSs have not been tested). - ### Therefore, detect if we are using the NAG Fortran compiler, and replace the wl="-Wl," for Fortran to - ### wl="-Wl,-Wl,," in the libtool file. (HDFFV-10037) case "`uname`" in Linux*) + ### NAG Fortran needs to replace "-Wl," with "-Wl,-Wl,," (HDFFV-10037) if test "X$FC_BASENAME" = "Xnagfor"; then cat libtool | awk '/BEGIN LIBTOOL TAG CONFIG: FC/{flag=1}flag&&/wl=/{$NF="wl=\"-Wl,-Wl,,\"";flag=0}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool fi + ### Flang needs to replace "", with "-Wl," (avoids unknown option: -soname issues) + if test "X$FC_BASENAME" = "Xflang"; then + cat libtool | awk '/BEGIN LIBTOOL TAG CONFIG: FC/{flag=1}flag&&/wl=/{$NF="wl=\"-Wl,\"";flag=0}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool + fi ;; esac fi diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 3a16c23a0c1..ff3f299f583 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -35,9 +35,12 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_compile_options(f90_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}>) -# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) + target_compile_options(f90_ex_${example} + PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" + "$<$:${WIN_COMPILE_FLAGS}>") +# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -76,9 +79,12 @@ endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_compile_options(f03_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}>) -# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) + target_compile_options(f03_ex_${example} + PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" + "$<$:${WIN_COMPILE_FLAGS}>") +# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -117,9 +123,12 @@ endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_compile_options(f90_ex_ph5example PRIVATE $<$:${WIN_COMPILE_FLAGS}>) -# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) + target_compile_options(f90_ex_ph5example + PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" + "$<$:${WIN_COMPILE_FLAGS}>") +# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() diff --git a/fortran/examples/ph5example.f90 b/fortran/examples/ph5example.f90 index 05fedbd46fd..138969ea17a 100644 --- a/fortran/examples/ph5example.f90 +++ b/fortran/examples/ph5example.f90 @@ -16,10 +16,10 @@ PROGRAM DATASET USE HDF5 ! This module contains all necessary modules + USE MPI IMPLICIT NONE - INCLUDE 'mpif.h' CHARACTER(LEN=10), PARAMETER :: default_fname = "sds.h5" ! Default name CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name @@ -72,10 +72,8 @@ PROGRAM DATASET CALL h5pset_fapl_mpio_f(plist_id, comm, info, error) ! - ! Figure out the filename to use. If your system does not support - ! getenv, comment that statement with this, - ! filename = "" - CALL getenv("HDF5_PARAPREFIX", filename) + ! Figure out the filename to use. + CALL get_environment_variable("HDF5_PARAPREFIX", filename) fnamelen = LEN_TRIM(filename) if ( fnamelen == 0 ) then filename = default_fname diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 977d036d4c1..199a0c8f148 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -48,12 +48,12 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID) add_executable (H5_buildiface ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90) target_include_directories (H5_buildiface PRIVATE "${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR}") #if (BUILD_SHARED_LIBS) -# target_compile_definitions(H5_buildiface PRIVATE $<$:/MT>) +# target_compile_definitions(H5_buildiface PRIVATE "$<$:/MT>") #endif () if(MSVC) set_property(TARGET H5_buildiface PROPERTY COMPILE_FLAGS "/MT") endif() -#set_property(TARGET H5_buildiface APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +#set_property(TARGET H5_buildiface APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") if(MSVC) set_property(TARGET H5_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE") endif() @@ -332,8 +332,8 @@ if (BUILD_STATIC_LIBS) target_compile_options(${HDF5_F90_LIB_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_F90_LIB_TARGET} PRIVATE - $<$:HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> + "$<$:HDF5F90_WINDOWS"> + "$<$:${WIN_COMPILE_FLAGS}>" ) target_link_libraries (${HDF5_F90_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} @@ -341,8 +341,8 @@ if (BUILD_STATIC_LIBS) ${LINK_Fortran_LIBS} "$<$:${MPI_Fortran_LIBRARIES}>" ) -# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -367,17 +367,17 @@ if (BUILD_SHARED_LIBS) target_compile_definitions(${HDF5_F90_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE - $<$:BUILD_HDF5_DLL;HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> + "$<$:BUILD_HDF5_DLL;HDF5F90_WINDOWS>" + "$<$:${WIN_COMPILE_FLAGS}>" ) target_link_libraries (${HDF5_F90_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS} "$<$:${MPI_Fortran_LIBRARIES}>" ) -# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) -# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DLL">) -# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def">) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-DLL>") +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def>") if(MSVC) set_property(TARGET ${HDF5_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} /DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") endif() diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index f4fe4ac5e88..5d6ff524bb2 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -1816,7 +1816,6 @@ END SUBROUTINE h5dwrite_reference_obj SUBROUTINE h5dwrite_reference_dsetreg(dset_id, mem_type_id, buf, dims, hdferr, & mem_space_id, file_space_id, xfer_prp) - USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dset_id INTEGER(HID_T), INTENT(IN) :: mem_type_id diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index c4da8f32b06..bbc7a9dc066 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -4680,7 +4680,7 @@ SUBROUTINE h5pget_fill_value_ptr(prp_id, type_id, fillvalue, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id INTEGER(HID_T), INTENT(IN) :: type_id - TYPE(C_PTR) , INTENT(IN) :: fillvalue + TYPE(C_PTR) :: fillvalue INTEGER , INTENT(OUT) :: hdferr hdferr = INT(H5Pget_fill_value(prp_id, type_id, fillvalue)) diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index 5a1ca53cd46..e734c03d1f9 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -71,7 +71,7 @@ INTEGER FUNCTION h5screate_simple_c(rank, dims, maxdims, space_id) BIND(C,NAME=' IMPLICIT NONE INTEGER, INTENT(IN) :: rank INTEGER(HSIZE_T), INTENT(IN) :: dims(rank) - INTEGER(HSIZE_T), DIMENSION(:),INTENT(IN) :: maxdims(rank) + INTEGER(HSIZE_T), INTENT(IN) :: maxdims(rank) INTEGER(HID_T), INTENT(OUT) :: space_id END FUNCTION h5screate_simple_c END INTERFACE diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index cd4580b8c04..62ced23cf45 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -43,7 +43,6 @@ #include PROGRAM H5_buildiface - USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_LOC IMPLICIT NONE ! These values are valid REAL KINDs (with corresponding C float) found during configure diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index ff279437602..c9dc48f01d6 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -13,14 +13,14 @@ target_include_directories (H5_test_buildiface ) #if (BUILD_SHARED_LIBS) # target_compile_definitions(H5_test_buildiface -# PRIVATE $<$:/MT> +# PRIVATE "$<$:/MT>" # ) #endif () if(MSVC) set_property(TARGET H5_test_buildiface PROPERTY COMPILE_FLAGS "/MT") endif() #set_property(TARGET H5_test_buildiface APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>" #) if(MSVC) set_property(TARGET H5_test_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE") @@ -145,12 +145,12 @@ if (NOT BUILD_SHARED_LIBS) target_compile_options(${HDF5_F90_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} PRIVATE - $<$:HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> + "$<$:HDF5F90_WINDOWS>" + "$<$:${WIN_COMPILE_FLAGS}>" ) target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}) -# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -171,13 +171,13 @@ else () target_compile_definitions(${HDF5_F90_TEST_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE - $<$:BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> + "$<$:BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS>" + "$<$:${WIN_COMPILE_FLAGS}>" ) target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) -# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) -# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DLL">) +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-DLL>") if(MSVC) set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} -DLL") endif() @@ -215,10 +215,10 @@ add_executable (testhdf5_fortran target_compile_options(testhdf5_fortran PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) -#set_property(TARGET testhdf5_fortran APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -#set_property(TARGET testhdf5_fortran APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +#set_property(TARGET testhdf5_fortran APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +#set_property(TARGET testhdf5_fortran APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -254,10 +254,10 @@ add_executable (testhdf5_fortran_1_8 target_compile_options(testhdf5_fortran_1_8 PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) -#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -294,10 +294,10 @@ add_executable (fortranlib_test_F03 target_compile_options(fortranlib_test_F03 PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) -#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -326,10 +326,10 @@ add_executable (fflush1 fflush1.F90) target_compile_options(fflush1 PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) -#set_property(TARGET fflush1 APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -#set_property(TARGET fflush1 APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +#set_property(TARGET fflush1 APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +#set_property(TARGET fflush1 APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -358,10 +358,10 @@ add_executable (fflush2 fflush2.F90) target_compile_options (fflush2 PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) -#set_property(TARGET fflush2 APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -#set_property(TARGET fflush2 APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +#set_property(TARGET fflush2 APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +#set_property(TARGET fflush2 APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -390,10 +390,10 @@ add_executable (vol_connector vol_connector.F90) target_compile_options(vol_connector PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) -#set_property(TARGET vol_connector APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -#set_property(TARGET vol_connector APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +#set_property(TARGET vol_connector APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +#set_property(TARGET vol_connector APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET vol_connector PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() diff --git a/fortran/test/tH5D.F90 b/fortran/test/tH5D.F90 index 8c1484f3ddc..c38123518fe 100644 --- a/fortran/test/tH5D.F90 +++ b/fortran/test/tH5D.F90 @@ -644,7 +644,6 @@ SUBROUTINE test_dset_fill(cleanup, total_error) INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(18) !should map to INTEGER*8 on most modern processors INTEGER(KIND=int_kind_1) , DIMENSION(1:DIM0), TARGET :: data_i1 INTEGER(KIND=int_kind_4) , DIMENSION(1:DIM0), TARGET :: data_i4 - INTEGER(KIND=int_kind_8) , DIMENSION(1:DIM0), TARGET :: data_i8 INTEGER(KIND=int_kind_16), DIMENSION(1:DIM0), TARGET :: data_i16 INTEGER(KIND=int_kind_1) , TARGET :: data0_i1 = 4 INTEGER(KIND=int_kind_4) , TARGET :: data0_i4 = 4 @@ -683,7 +682,6 @@ SUBROUTINE test_dset_fill(cleanup, total_error) ! Initialize memory buffer data_i1 = -2 data_i4 = -2 - data_i8 = -2 data_i16 = -2 data_int = -2 #if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 @@ -798,7 +796,6 @@ SUBROUTINE test_dset_fill(cleanup, total_error) ! Initialize memory buffer data_i1 = -2 data_i4 = -2 - data_i8 = -2 data_i16 = -2 #if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 data_i32 = -2 diff --git a/fortran/test/tH5G_1_8.F90 b/fortran/test/tH5G_1_8.F90 index dca4cf2a956..cd354d81d2b 100644 --- a/fortran/test/tH5G_1_8.F90 +++ b/fortran/test/tH5G_1_8.F90 @@ -192,48 +192,18 @@ SUBROUTINE group_info(cleanup, fapl, total_error) IF(idx_type == H5_INDEX_CRT_ORDER_F)THEN IF(iorder == H5_ITER_INC_F)THEN order = H5_ITER_INC_F -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/o creation order index" -!!$ ENDIF ELSE IF (iorder == H5_ITER_DEC_F) THEN order = H5_ITER_DEC_F -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/o creation order index" -!!$ ENDIF ELSE order = H5_ITER_NATIVE_F -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in native order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in native order w/o creation order index" -!!$ ENDIF ENDIF ELSE IF(iorder == H5_ITER_INC_F)THEN order = H5_ITER_INC_F -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/o creation order index" -!!$ ENDIF ELSE IF (iorder == H5_ITER_DEC_F) THEN order = H5_ITER_DEC_F -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/o creation order index" -!!$ ENDIF ELSE order = H5_ITER_NATIVE_F -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in native order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"query group info by creation order index in native order w/o creation order index" -!!$ ENDIF ENDIF END IF @@ -1263,56 +1233,16 @@ SUBROUTINE delete_by_idx(cleanup, fapl, total_error) CHARACTER(LEN=2) :: chr2 INTEGER :: error INTEGER :: id_type - ! - ! - ! - CHARACTER(LEN=80) :: fix_filename1 - CHARACTER(LEN=80) :: fix_filename2 INTEGER(HSIZE_T) :: htmp LOGICAL :: cleanup - DO i = 1, 80 - fix_filename1(i:i) = " " - fix_filename2(i:i) = " " - ENDDO - ! Loop over operating on different indices on link fields DO idx_type = H5_INDEX_NAME_F, H5_INDEX_CRT_ORDER_F ! Loop over operating in different orders DO iorder = H5_ITER_INC_F, H5_ITER_DEC_F ! Loop over using index for creation order value DO i = 1, 2 - ! Print appropriate test message -!!$ IF(idx_type == H5_INDEX_CRT_ORDER_F)THEN -!!$ IF(iorder == H5_ITER_INC_F)THEN -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"deleting links by creation order index in increasing order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"deleting links by creation order index in increasing order w/o creation order index" -!!$ ENDIF -!!$ ELSE -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"deleting links by creation order index in decreasing order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"deleting links by creation order index in decreasing order w/o creation order index" -!!$ ENDIF -!!$ ENDIF -!!$ ELSE -!!$ IF(iorder == H5_ITER_INC_F)THEN -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"deleting links by name index in increasing order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"deleting links by name index in increasing order w/o creation order index" -!!$ ENDIF -!!$ ELSE -!!$ IF(use_index(i))THEN -!!$ WRITE(*,'(5x,A)')"deleting links by name index in decreasing order w/creation order index" -!!$ ELSE -!!$ WRITE(*,'(5x,A)')"deleting links by name index in decreasing order w/o creation order index" -!!$ ENDIF -!!$ ENDIF -!!$ ENDIF ! Create file CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp=fapl) diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index 4f390d5fb76..24934eb3e05 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -146,7 +146,6 @@ SUBROUTINE test_create(total_error) ! Compound datatype test f_ptr = C_LOC(fill_ctype) - CALL H5Pget_fill_value_f(dcpl, comp_type_id, f_ptr, error) CALL check("H5Pget_fill_value_f",error, total_error) @@ -184,6 +183,7 @@ SUBROUTINE test_create(total_error) CALL VERIFY("***ERROR: Returned wrong fill value (real)", rfill, 2.0, total_error) ! For the actual compound type + f_ptr = C_LOC(fill_ctype) CALL H5Pset_fill_value_f(dcpl, comp_type_id, f_ptr, error) CALL check("H5Pget_fill_value_f",error, total_error) @@ -254,7 +254,6 @@ SUBROUTINE test_create(total_error) CALL check("H5Dget_create_plist_f", error, total_error) f_ptr = C_LOC(rd_c) - CALL H5Pget_fill_value_f(dcpl, comp_type_id, f_ptr, error) CALL check("H5Pget_fill_value_f", error, total_error) CALL verify("***ERROR: Returned wrong fill value", rd_c%a, fill_ctype%a, total_error) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index ca241f6d87f..e8f010721fe 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -28,13 +28,13 @@ target_include_directories (parallel_test target_compile_options(parallel_test PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) if (NOT BUILD_SHARED_LIBS) target_link_libraries (parallel_test PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} - $<$:"ws2_32.lib"> + "$<$:ws2_32.lib>" ) set_target_properties (parallel_test PROPERTIES FOLDER test/fortran @@ -45,7 +45,7 @@ else () target_link_libraries (parallel_test PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_Fortran_LIBS} - $<$:"ws2_32.lib"> + "$<$:ws2_32.lib>" ) set_target_properties (parallel_test PROPERTIES FOLDER test/fortran @@ -68,13 +68,13 @@ target_include_directories (subfiling_test target_compile_options(subfiling_test PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) if (NOT BUILD_SHARED_LIBS) target_link_libraries (subfiling_test PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} - $<$:"ws2_32.lib"> + "$<$:ws2_32.lib>" ) set_target_properties (subfiling_test PROPERTIES FOLDER test/fortran @@ -85,7 +85,7 @@ else () target_link_libraries (subfiling_test PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_Fortran_LIBS} - $<$:"ws2_32.lib"> + "$<$:ws2_32.lib>" ) set_target_properties (subfiling_test PROPERTIES FOLDER test/fortran @@ -108,13 +108,13 @@ target_include_directories (async_test target_compile_options(async_test PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) if (NOT BUILD_SHARED_LIBS) target_link_libraries (async_test PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} - $<$:"ws2_32.lib"> + "$<$:ws2_32.lib>" ) set_target_properties (async_test PROPERTIES FOLDER test/fortran @@ -125,7 +125,7 @@ else () target_link_libraries (async_test PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_Fortran_LIBS} - $<$:"ws2_32.lib"> + "$<$:ws2_32.lib>" ) set_target_properties (async_test PROPERTIES FOLDER test/fortran diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 293bc2b096f..7afe5fc6d1c 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -10,10 +10,11 @@ foreach (example ${examples}) add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) target_compile_options(hl_f90_ex_${example} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + "${HDF5_CMAKE_Fortran_FLAGS}" + "$<$:${WIN_COMPILE_FLAGS}>" ) -# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index d9f0af2a766..ed469e57753 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -23,7 +23,7 @@ if (WIN32 AND MSVC) endif () endif () #set_property(TARGET H5HL_buildiface APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>" #) if(MSVC) set_property(TARGET H5HL_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE") @@ -178,12 +178,12 @@ if (BUILD_STATIC_LIBS) ) target_compile_options(${HDF5_HL_F90_LIB_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} - PUBLIC $<$:HDF5F90_WINDOWS> - PRIVATE $<$:${WIN_COMPILE_FLAGS}> + PUBLIC "$<$:HDF5F90_WINDOWS>" + PRIVATE "$<$:${WIN_COMPILE_FLAGS}>" ) target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) -# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -207,17 +207,17 @@ if (BUILD_SHARED_LIBS) target_compile_definitions(${HDF5_HL_F90_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE - $<$:BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> + "$<$:BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS>" + "$<$:${WIN_COMPILE_FLAGS}>" ) target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} PUBLIC ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS} ) -# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) -# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DLL">) -# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def">) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-DLL>") +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "$<$:-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def>") if(MSVC) set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} -DLL -DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") endif() diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index f78e52e50eb..23248127f64 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -16,10 +16,10 @@ macro (ADD_H5_FORTRAN_EXE file) target_compile_options(hl_f90_${file} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}" - $<$:${WIN_COMPILE_FLAGS}> + "$<$:${WIN_COMPILE_FLAGS}>" ) -# set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) -# set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +# set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS "$<$:-SUBSYSTEM:CONSOLE>") +# set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS "$<$:${WIN_LINK_FLAGS}>") if(MSVC) set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() diff --git a/hl/test/test_table.c b/hl/test/test_table.c index c475e7fee95..c6614343037 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -198,7 +198,7 @@ test_table(hid_t fid, int do_write) hsize_t chunk_size = 10; int compress = 0; int *fill = NULL; - particle_t fill1[1] = {{"no data", -1, -99.0, -99.0, -1}}; + particle_t fill1[1] = {{"no data", -1, -99.0F, -99.0, -1}}; int fill1_new[1] = {-100}; hsize_t position; char tname[20]; @@ -226,23 +226,23 @@ test_table(hid_t fid, int do_write) particle2_t rbuf2[NRECORDS]; particle3_t rbuf3[NRECORDS]; particle_t rbufc[NRECORDS * 2]; - particle_t abuf[2] = {{"eight", 80, 8.0, 80.0, 80}, {"nine", 90, 9.0, 90.0, 90}}; - particle_t ibuf[2] = {{"zero", 0, 0.0, 0.0, 0}, {"zero", 0, 0.0, 0.0, 0}}; + particle_t abuf[2] = {{"eight", 80, 8.0F, 80.0, 80}, {"nine", 90, 9.0F, 90.0, 90}}; + particle_t ibuf[2] = {{"zero", 0, 0.0F, 0.0, 0}, {"zero", 0, 0.0F, 0.0, 0}}; particle_t wbufd[NRECORDS]; particle_t wbuf[NRECORDS] = {{ "zero", 0, - 0.0, + 0.0F, 0.0, 0, }, - {"one", 10, 1.0, 10.0, 10}, - {"two", 20, 2.0, 20.0, 20}, - {"three", 30, 3.0, 30.0, 30}, - {"four", 40, 4.0, 40.0, 40}, - {"five", 50, 5.0, 50.0, 50}, - {"six", 60, 6.0, 60.0, 60}, - {"seven", 70, 7.0, 70.0, 70}}; + {"one", 10, 1.0F, 10.0, 10}, + {"two", 20, 2.0F, 20.0, 20}, + {"three", 30, 3.0F, 30.0, 30}, + {"four", 40, 4.0F, 40.0, 40}, + {"five", 50, 5.0F, 50.0, 50}, + {"six", 60, 6.0F, 60.0, 60}, + {"seven", 70, 7.0F, 70.0, 70}}; /* buffers for the field "Pressure" and "New_field" */ float pressure_in[NRECORDS] = {0.0F, 1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F}; float pressure_out[NRECORDS]; diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index f5df09cef44..2e985e78fa8 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -1186,7 +1186,7 @@ Java_hdf_hdf5lib_H5_H5AwriteVL(JNIEnv *env, jclass clss, jlong attr_id, jlong me UNUSED(clss); if (NULL == buf) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL: write buffer is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite: write buffer is NULL"); if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9e0a5cc9341..98911d1c8b3 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,20 @@ New Features Configuration: ------------- + - Added support for AOCC and classic Flang w/ the Autotools + + * Adds a config/clang-fflags options file to support Flang + * Corrects missing "-Wl," from linker options in the libtool wrappers + when using Flang, the MPI Fortran compiler wrappers, and building + the shared library. This would often result in unrecognized options + like -soname. + * Enable -nomp w/ Flang to avoid linking to the OpenMPI library. + + CMake can build the parallel, shared library w/ Fortran using AOCC + and Flang, so no changes were needed for that build system. + + Fixes GitHub issues #3439, #1588, #366, #280 + - Converted the build of libaec and zlib to use FETCH_CONTENT with CMake. Using the CMake FetchContent module, the external filters can populate @@ -348,6 +362,11 @@ Bug Fixes since HDF5-1.14.2 release skip running the atomicity tests if the major version of OpenMPI is < 5. + - Fixed Fortran 2003 test with gfortran-v13, optimization levels O2,O3 + + Fixes failing Fortran 2003 test with gfortran, optimization level O2,O3 + with -fdefault-real-16. Fixes GH #2928. + Platforms Tested =================== @@ -478,6 +497,12 @@ Platforms Tested Known Problems ============== + IEEE standard arithmetic enables software to raise exceptions such as overflow, + division by zero, and other illegal operations without interrupting or halting + the program flow. The HDF5 C library intentionally performs these exceptions. + Therefore, the "-ieee=full" nagfor switch is necessary when compiling a program + to avoid stopping on an exception. + CMake files do not behave correctly with paths containing spaces. Do not use spaces in paths because the required escaping for handling spaces results in very complex and fragile build files. diff --git a/src/H5CX.c b/src/H5CX.c index aa9d0b5aece..b3b2fca41b9 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -778,6 +778,11 @@ H5CX__push_common(H5CX_node_t *cnode) cnode->ctx.tag = H5AC__INVALID_TAG; cnode->ctx.ring = H5AC_RING_USER; +#ifdef H5_HAVE_PARALLEL + cnode->ctx.btype = MPI_BYTE; + cnode->ctx.ftype = MPI_BYTE; +#endif + /* Push context node onto stack */ cnode->next = *head; *head = cnode; diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 58fc4355e63..dae1149ae60 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1713,7 +1713,8 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c } /* end while node is not NULL */ /* remove trailing ';' from signed headers sequence */ - signed_headers_dest[strlen(signed_headers_dest) - 1] = '\0'; + if (*signed_headers_dest != '\0') + signed_headers_dest[strlen(signed_headers_dest) - 1] = '\0'; /* append signed headers and payload hash * NOTE: at present, no HTTP body is handled, per the nature of diff --git a/src/H5FDsec2.h b/src/H5FDsec2.h index 56f45751d32..a2590aee968 100644 --- a/src/H5FDsec2.h +++ b/src/H5FDsec2.h @@ -23,7 +23,23 @@ extern "C" { #endif -H5_DLL hid_t H5FD_sec2_init(void); +H5_DLL hid_t H5FD_sec2_init(void); + +/** + * \ingroup FAPL + * + * \brief Modifies the file access property list to use the #H5FD_SEC2 driver + * + * \fapl_id + * + * \returns \herr_t + * + * \details H5Pset_fapl_sec2() modifies the file access property list to use the + * #H5FD_SEC2 driver. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_sec2(hid_t fapl_id); #ifdef __cplusplus diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 39766de6594..80771c02a53 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -32,8 +32,6 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#define CANBE_UNUSED(X) (void)(X) - /* The driver identification number, initialized at runtime */ static hid_t H5FD_IOC_g = H5I_INVALID_HID; @@ -1219,13 +1217,14 @@ static herr_t H5FD__ioc_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf) { - H5FD_ioc_t *file = (H5FD_ioc_t *)_file; - herr_t ret_value = SUCCEED; +#ifndef NDEBUG + H5FD_ioc_t *file = (H5FD_ioc_t *)_file; +#endif + herr_t ret_value = SUCCEED; H5FD_IOC_LOG_CALL(__func__); assert(file && file->pub.cls); - CANBE_UNUSED(file); assert(buf); /* Check for overflow conditions */ diff --git a/src/H5FDsubfiling/H5FDioc_int.c b/src/H5FDsubfiling/H5FDioc_int.c index 674b08ddf94..5528fc8f8ff 100644 --- a/src/H5FDsubfiling/H5FDioc_int.c +++ b/src/H5FDsubfiling/H5FDioc_int.c @@ -423,8 +423,14 @@ ioc__async_completion(MPI_Request *mpi_reqs, size_t num_reqs) assert(mpi_reqs); H5_CHECK_OVERFLOW(num_reqs, size_t, int); + + /* Have to supppress gcc warnings regarding MPI_STATUSES_IGNORE + * with MPICH (https://github.com/pmodels/mpich/issues/5687) + */ + H5_GCC_DIAG_OFF("stringop-overflow") if (MPI_SUCCESS != (mpi_code = MPI_Waitall((int)num_reqs, mpi_reqs, MPI_STATUSES_IGNORE))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Waitall failed", mpi_code); + H5_GCC_DIAG_ON("stringop-overflow") done: H5_SUBFILING_FUNC_LEAVE; diff --git a/src/H5FDsubfiling/H5FDsubfile_int.c b/src/H5FDsubfiling/H5FDsubfile_int.c index cb210b6e4a6..a7dd86455cb 100644 --- a/src/H5FDsubfiling/H5FDsubfile_int.c +++ b/src/H5FDsubfiling/H5FDsubfile_int.c @@ -143,17 +143,19 @@ H5FD__subfiling__truncate_sub_files(hid_t context_id, int64_t logical_file_eof, } /* Wait for truncate operations to complete */ + H5_GCC_DIAG_OFF("stringop-overflow") if (MPI_SUCCESS != (mpi_code = MPI_Waitall(num_subfiles_owned, recv_reqs, MPI_STATUSES_IGNORE))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Waitall", mpi_code); - - /* sanity check -- compute the file eof using the same mechanism used to - * compute the subfile eof. Assert that the computed value and the - * actual value match. - * - * Do this only for debug builds -- probably delete this before release. - * - * JRM -- 12/15/21 - */ + H5_GCC_DIAG_ON("stringop-overflow") + + /* sanity check -- compute the file eof using the same mechanism used to + * compute the subfile eof. Assert that the computed value and the + * actual value match. + * + * Do this only for debug builds -- probably delete this before release. + * + * JRM -- 12/15/21 + */ #ifndef NDEBUG { @@ -339,15 +341,18 @@ H5FD__subfiling__get_real_eof(hid_t context_id, int64_t *logical_eof_ptr) } /* Wait for EOF communication to complete */ + H5_GCC_DIAG_OFF("stringop-overflow") if (MPI_SUCCESS != (mpi_code = MPI_Waitall(num_subfiles, recv_reqs, MPI_STATUSES_IGNORE))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Waitall", mpi_code); + H5_GCC_DIAG_ON("stringop-overflow") for (int i = 0; i < num_subfiles; i++) { +#ifndef NDEBUG int ioc_rank = (int)recv_msg[3 * i]; +#endif assert(ioc_rank >= 0); assert(ioc_rank < n_io_concentrators); - CANBE_UNUSED(ioc_rank); assert(sf_eofs[i] == -1); sf_eofs[i] = recv_msg[(3 * i) + 1]; diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index d8616c8c1b4..a2daba0d01b 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -1556,7 +1556,7 @@ H5FD__subfiling_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_i H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %" PRIuHADDR, addr); if (REGION_OVERFLOW(addr, size)) H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, - "addr overflow, addr = %" PRIuHADDR ", size = %" PRIuHADDR, addr, size); + "addr overflow, addr = %" PRIuHADDR ", size = %zu", addr, size); /* Temporarily reject collective I/O until support is implemented (unless types are simple MPI_BYTE) */ { @@ -1789,7 +1789,7 @@ H5FD__subfiling_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_ H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %" PRIuHADDR, addr); if (REGION_OVERFLOW(addr, size)) H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, - "addr overflow, addr = %" PRIuHADDR ", size = %" PRIuHADDR, addr, size); + "addr overflow, addr = %" PRIuHADDR ", size = %zu", addr, size); /* Temporarily reject collective I/O until support is implemented (unless types are simple MPI_BYTE) */ { diff --git a/src/H5FDsubfiling/H5FDsubfiling_priv.h b/src/H5FDsubfiling/H5FDsubfiling_priv.h index 9cc32f14abf..08fef7d1a01 100644 --- a/src/H5FDsubfiling/H5FDsubfiling_priv.h +++ b/src/H5FDsubfiling/H5FDsubfiling_priv.h @@ -63,6 +63,4 @@ H5_DLL herr_t H5FD__subfiling__get_real_eof(hid_t context_id, int64_t *logical_e } #endif -#define CANBE_UNUSED(X) (void)(X) - #endif /* H5FDsubfiling_priv_H */ diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index ef80a799ca1..6cf2c809b8c 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -47,14 +47,17 @@ static H5F_sfile_node_t *H5F_sfile_head_s = NULL; *------------------------------------------------------------------------- */ void -H5F_sfile_assert_num(unsigned n) +H5F_sfile_assert_num(unsigned H5_ATTR_NDEBUG_UNUSED n) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* The only useful work this function does is asserting so when NDEBUG + * is defined it's a no-op. + */ +#ifndef NDEBUG if (n == 0) { - /* Sanity checking */ assert(H5F_sfile_head_s == NULL); - } /* end if */ + } else { unsigned count; /* Number of open shared files */ H5F_sfile_node_t *curr; /* Current shared file node */ @@ -68,11 +71,11 @@ H5F_sfile_assert_num(unsigned n) /* Advance to next shared file node */ curr = curr->next; - } /* end while */ + } - /* Sanity checking */ assert(count == n); - } /* end else */ + } +#endif FUNC_LEAVE_NOAPI_VOID } /* H5F_sfile_assert_num() */ diff --git a/src/H5system.c b/src/H5system.c index 7ff521efb26..30a89a174af 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -620,7 +620,6 @@ H5_build_extpath(const char *name, char **extpath /*out*/) FUNC_ENTER_NOAPI_NOINIT - /* Sanity check */ assert(name); assert(extpath); @@ -634,8 +633,9 @@ H5_build_extpath(const char *name, char **extpath /*out*/) if (H5_CHECK_ABSOLUTE(name)) { if (NULL == (full_path = (char *)H5MM_strdup(name))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); - } /* end if */ - else { /* relative pathname */ + } + else { + /* relative pathname */ char *retcwd; size_t name_len; int drive; @@ -655,12 +655,12 @@ H5_build_extpath(const char *name, char **extpath /*out*/) drive = HDtoupper(name[0]) - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); strncpy(new_name, &name[2], name_len); - } /* end if */ - /* - * Windows: name[0] is a '/' or '\' - * Get current drive - * Unix: does not apply - */ + } + /* + * Windows: name[0] is a '/' or '\' + * Get current drive + * Unix: does not apply + */ else if (H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) { snprintf(cwdpath, MAX_PATH_LEN, "%c:%c", (drive + 'A' - 1), name[0]); retcwd = cwdpath; @@ -670,28 +670,32 @@ H5_build_extpath(const char *name, char **extpath /*out*/) else { retcwd = HDgetcwd(cwdpath, MAX_PATH_LEN); strncpy(new_name, name, name_len); - } /* end if */ + } if (retcwd != NULL) { size_t cwdlen; size_t path_len; - assert(cwdpath); cwdlen = strlen(cwdpath); - assert(cwdlen); - assert(new_name); + if (cwdlen == 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "cwd length is zero"); path_len = cwdlen + strlen(new_name) + 2; if (NULL == (full_path = (char *)H5MM_malloc(path_len))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); - strncpy(full_path, cwdpath, cwdlen + 1); + /* path_len will always be greater than zero, so no check before + * setting the terminal NUL byte of full_path + */ + strncpy(full_path, cwdpath, path_len); + full_path[path_len - 1] = '\0'; + if (!H5_CHECK_DELIMITER(cwdpath[cwdlen - 1])) strncat(full_path, H5_DIR_SEPS, path_len - (cwdlen + 1)); strncat(full_path, new_name, path_len - (cwdlen + 1) - strlen(H5_DIR_SEPS)); - } /* end if */ - } /* end else */ + } + } - /* strip out the last component (the file name itself) from the path */ + /* Strip out the last component (the file name itself) from the path */ if (full_path) { char *ptr = NULL; @@ -699,10 +703,9 @@ H5_build_extpath(const char *name, char **extpath /*out*/) assert(ptr); *++ptr = '\0'; *extpath = full_path; - } /* end if */ + } done: - /* Release resources */ if (cwdpath) H5MM_xfree(cwdpath); if (new_name) diff --git a/test/dt_arith.c b/test/dt_arith.c index ab89b689837..d3147cbd577 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -696,7 +696,7 @@ test_particular_fp_integer(void) /* Print errors */ if (dst_i != fill_value) { - float x = 0.0; + float x = 0.0F; int y; if (0 == fails_this_test++) @@ -2637,7 +2637,7 @@ my_isnan(dtype_t type, void *val) char s[256]; if (FLT_FLOAT == type) { - float x = 0.0; + float x = 0.0F; memcpy(&x, val, sizeof(float)); retval = isnan(x); } @@ -2663,7 +2663,7 @@ my_isnan(dtype_t type, void *val) */ if (!retval) { if (FLT_FLOAT == type) { - float x = 0.0; + float x = 0.0F; memcpy(&x, val, sizeof(float)); snprintf(s, sizeof(s), "%g", (double)x); @@ -3115,7 +3115,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) int check_expo[2]; if (FLT_FLOAT == dst_type) { - float x = 0.0; + float x = 0.0F; memcpy(&x, &buf[j * dst_size], sizeof(float)); if (underflow && fabsf(x) <= FLT_MIN && fabsf(hw_f) <= FLT_MIN) continue; /* all underflowed, no error */ @@ -3185,7 +3185,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) printf(" %02x", saved[j * src_size + ENDIAN(src_size, k, sendian)]); printf("%*s", (int)(3 * MAX(0, (ssize_t)dst_size - (ssize_t)src_size)), ""); if (FLT_FLOAT == src_type) { - float x = 0.0; + float x = 0.0F; memcpy(&x, &saved[j * src_size], sizeof(float)); printf(" %29.20e\n", (double)x); } @@ -3207,7 +3207,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) printf(" %02x", buf[j * dst_size + ENDIAN(dst_size, k, dendian)]); printf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), ""); if (FLT_FLOAT == dst_type) { - float x = 0.0; + float x = 0.0F; memcpy(&x, &buf[j * dst_size], sizeof(float)); printf(" %29.20e\n", (double)x); } diff --git a/test/dtypes.c b/test/dtypes.c index 74b6f617f1c..a8def070d0e 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1983,26 +1983,36 @@ test_compound_10(void) cmpd_struct wdata[ARRAY_DIM]; cmpd_struct rdata[ARRAY_DIM]; - hid_t file; - hid_t arr_tid, cmpd_tid, cstr_id, vlstr_id; - hid_t space_id; - hid_t dset_id; + hid_t file = H5I_INVALID_HID; + hid_t arr_tid = H5I_INVALID_HID; + hid_t cmpd_tid = H5I_INVALID_HID; + hid_t cstr_id = H5I_INVALID_HID; + hid_t vlstr_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; hsize_t arr_dim[1] = {ARRAY_DIM}; /* Array dimensions */ hsize_t dim1[1]; - void *t1, *t2; + void *t1 = NULL; + void *t2 = NULL; char filename[1024]; size_t len; int i; TESTING("array datatype of compound type with VL string"); + memset(wdata, 0, sizeof(wdata)); + memset(rdata, 0, sizeof(rdata)); + + /* Initialize */ for (i = 0; i < ARRAY_DIM; i++) { - wdata[i].i1 = i * 10 + i; - wdata[i].str = strdup("C string A"); + wdata[i].i1 = i * 10 + i; + if (NULL == (wdata[i].str = strdup("C string A"))) + FAIL_PUTS_ERROR("Unable to duplicate string"); wdata[i].str[9] = (char)(wdata[i].str[9] + i); wdata[i].i2 = i * 1000 + i * 10; - wdata[i].text.p = (void *)strdup("variable-length text A\0"); + if (NULL == (wdata[i].text.p = (void *)strdup("variable-length text A\0"))) + FAIL_PUTS_ERROR("Unable to duplicate string"); len = wdata[i].text.len = strlen((char *)wdata[i].text.p) + 1; ((char *)(wdata[i].text.p))[len - 2] = (char)(((char *)(wdata[i].text.p))[len - 2] + i); ((char *)(wdata[i].text.p))[len - 1] = '\0'; @@ -2010,160 +2020,116 @@ test_compound_10(void) /* Create File */ h5_fixname(FILENAME[4], H5P_DEFAULT, filename, sizeof filename); - if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - H5_FAILED(); - AT(); - printf("Can't create file!\n"); - goto error; - } /* end if */ + if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; /* Create first compound datatype */ - if ((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { - H5_FAILED(); - AT(); - printf("Can't create datatype!\n"); - goto error; - } /* end if */ + if ((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) + TEST_ERROR; - if (H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct, i1), H5T_NATIVE_INT) < 0) { - H5_FAILED(); - AT(); - printf("Can't insert field 'i1'\n"); - goto error; - } /* end if */ + if (H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct, i1), H5T_NATIVE_INT) < 0) + TEST_ERROR; - cstr_id = H5Tcopy(H5T_C_S1); - if (H5Tset_size(cstr_id, H5T_VARIABLE) < 0) { - H5_FAILED(); - AT(); - printf("Can't set size for C string\n"); - goto error; - } /* end if */ + if ((cstr_id = H5Tcopy(H5T_C_S1)) < 0) + TEST_ERROR; + if (H5Tset_size(cstr_id, H5T_VARIABLE) < 0) + TEST_ERROR; - if (H5Tinsert(cmpd_tid, "c_string", HOFFSET(cmpd_struct, str), cstr_id) < 0) { - H5_FAILED(); - AT(); - printf("Can't insert field 'str'\n"); - goto error; - } /* end if */ + if (H5Tinsert(cmpd_tid, "c_string", HOFFSET(cmpd_struct, str), cstr_id) < 0) + TEST_ERROR; /* Create vl-string datatype */ - if ((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) { - H5_FAILED(); - AT(); - printf("Can't create VL string\n"); - goto error; - } /* end if */ + if ((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) + TEST_ERROR; - if (H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, text), vlstr_id) < 0) { - H5_FAILED(); - AT(); - printf("Can't insert field 'text'\n"); - goto error; - } /* end if */ + if (H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, text), vlstr_id) < 0) + TEST_ERROR; - if (H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) { - H5_FAILED(); - AT(); - printf("Can't insert field 'i2'\n"); - goto error; - } /* end if */ + if (H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) + TEST_ERROR; /* Create the array datatype for c_string data */ - if ((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) { - H5_FAILED(); - AT(); - printf("Can't create array type\n"); - goto error; - } /* end if */ + if ((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) + TEST_ERROR; dim1[0] = 1; - if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0) { - H5_FAILED(); - AT(); - printf("Can't create space\n"); - goto error; - } /* end if */ + if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0) + TEST_ERROR; - if ((dset_id = H5Dcreate2(file, "Dataset", arr_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < - 0) { - H5_FAILED(); - AT(); - printf("Can't create dataset\n"); - goto error; - } /* end if */ + if ((dset_id = H5Dcreate2(file, "Dataset", arr_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; - if (H5Dwrite(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) { - H5_FAILED(); - AT(); - printf("Can't write data\n"); - goto error; - } /* end if */ + if (H5Dwrite(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) + TEST_ERROR; - if (H5Dread(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { - H5_FAILED(); - AT(); - printf("Can't read data\n"); - goto error; - } /* end if */ + if (H5Dread(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) + TEST_ERROR; for (i = 0; i < ARRAY_DIM; i++) { if (rdata[i].i1 != wdata[i].i1 || rdata[i].i2 != wdata[i].i2 || - strcmp(rdata[i].str, wdata[i].str) != 0) { - H5_FAILED(); - AT(); - printf("incorrect read data\n"); - goto error; - } /* end if */ + strcmp(rdata[i].str, wdata[i].str) != 0) + FAIL_PUTS_ERROR("incorrect read data\n"); - if (rdata[i].text.len != wdata[i].text.len) { - H5_FAILED(); - AT(); - printf("incorrect VL length\n"); - goto error; - } /* end if */ + if (rdata[i].text.len != wdata[i].text.len) + FAIL_PUTS_ERROR("incorrect VL length\n"); t1 = rdata[i].text.p; t2 = wdata[i].text.p; - if (strcmp((char *)t1, (char *)t2) != 0) { - H5_FAILED(); - AT(); - printf("incorrect VL read data\n"); - goto error; - } - } /* end for */ - if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) { - H5_FAILED(); - AT(); - printf("Can't reclaim read data\n"); - goto error; - } /* end if */ - if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) { - H5_FAILED(); - AT(); - printf("Can't reclaim read data\n"); - goto error; - } /* end if */ + if (strcmp((char *)t1, (char *)t2) != 0) + FAIL_PUTS_ERROR("incorrect VL read data\n"); + } + + if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) + TEST_ERROR; + if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) + TEST_ERROR; if (H5Dclose(dset_id) < 0) - goto error; + TEST_ERROR; if (H5Tclose(arr_tid) < 0) - goto error; + TEST_ERROR; + arr_tid = H5I_INVALID_HID; if (H5Tclose(cmpd_tid) < 0) - goto error; + TEST_ERROR; if (H5Tclose(cstr_id) < 0) - goto error; + TEST_ERROR; if (H5Tclose(vlstr_id) < 0) - goto error; + TEST_ERROR; if (H5Sclose(space_id) < 0) - goto error; + TEST_ERROR; + space_id = H5I_INVALID_HID; if (H5Fclose(file) < 0) - goto error; + TEST_ERROR; PASSED(); return 0; error: + + H5E_BEGIN_TRY + { + if (arr_tid != H5I_INVALID_HID && space_id != H5I_INVALID_HID) { + H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata); + H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata); + } + else { + /* Clean up memory if we failed out early */ + for (i = 0; i < ARRAY_DIM; i++) { + free(wdata[i].str); + free(wdata[i].text.p); + } + } + + H5Dclose(dset_id); + H5Tclose(arr_tid); + H5Tclose(cmpd_tid); + H5Tclose(cstr_id); + H5Tclose(vlstr_id); + H5Sclose(space_id); + H5Fclose(file); + } + H5E_END_TRY + return 1; } diff --git a/test/tselect.c b/test/tselect.c index 55599b3324e..55430f24ad5 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -1875,8 +1875,8 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) ** ****************************************************************/ static void -verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, size_t H5_ATTR_NDEBUG_UNUSED cube_size, - unsigned edge_size, unsigned cube_rank) +verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, size_t cube_size, unsigned edge_size, + unsigned cube_rank) { const uint16_t *cube_ptr; /* Pointer into the cube buffer */ uint16_t expected_value; /* Expected value in dataset */ @@ -1902,7 +1902,9 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, size_t H5_ATTR m = 0; do { /* Sanity check */ - assert(s < cube_size); + if (s >= cube_size) + TestErrPrintf("s should not be >= cube_size! s = %zu, cube_size = %zu\n", s, + cube_size); /* Check for correct value */ if (*cube_ptr != expected_value) diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 198201abf7b..bdfde0972b5 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -26,6 +26,8 @@ static MPI_Info info = MPI_INFO_NULL; static int mpi_rank = 0; static int mpi_size = 0; +static int test_express_level_g; + int nerrors = 0; /* Arrays of filter ID values and filter names (should match each other) */ @@ -576,7 +578,7 @@ create_datasets(hid_t parent_obj_id, const char *dset_name, hid_t type_id, hid_t dset_name_ptr = dset_name_multi_buf; n_dsets = (rand() % (MAX_NUM_DSETS_MULTI - 1)) + 2; - /* Select between 1 and (n_dsets - 1) datasets to NOT be filtered */ + /* Select between 1 and (n_dsets - 1) datasets to be unfiltered */ if (test_mode == USE_MULTIPLE_DATASETS_MIXED_FILTERED) { n_unfiltered = (rand() % (n_dsets - 1)) + 1; @@ -9705,14 +9707,16 @@ int main(int argc, char **argv) { unsigned seed; - size_t cur_filter_idx = 0; - size_t num_filters = 0; - hid_t file_id = H5I_INVALID_HID; - hid_t fcpl_id = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t fapl_id = H5I_INVALID_HID; - hid_t dxpl_id = H5I_INVALID_HID; - hid_t dcpl_id = H5I_INVALID_HID; + double total_test_time = 0.0; + size_t cur_filter_idx = 0; + size_t num_filters = 0; + hid_t file_id = H5I_INVALID_HID; + hid_t fcpl_id = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t dxpl_id = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + bool expedite_testing = false; int mpi_code; /* Initialize MPI */ @@ -9763,6 +9767,17 @@ main(int argc, char **argv) TestAlarmOn(); + /* + * Get the TestExpress level setting + */ + test_express_level_g = GetTestExpress(); + if ((test_express_level_g >= 1) && MAINPROCESS) { + printf("** Some tests will be skipped due to TestExpress setting.\n"); + printf("** Exhaustive tests will only be performed for the first available filter.\n"); + printf("** Set the HDF5TestExpress environment variable to 0 to perform exhaustive testing for all " + "available filters.\n\n"); + } + /* * Obtain and broadcast seed value since ranks * aren't guaranteed to arrive here at exactly @@ -9784,8 +9799,13 @@ main(int argc, char **argv) srand(seed); - if (MAINPROCESS) - printf("Using seed: %u\n\n", seed); + /* Print test settings */ + if (MAINPROCESS) { + printf("Test Info:\n"); + printf(" MPI size: %d\n", mpi_size); + printf(" Test express level: %d\n", test_express_level_g); + printf(" Using seed: %u\n\n", seed); + } num_filters = ARRAY_SIZE(filterIDs); @@ -9829,9 +9849,26 @@ main(int argc, char **argv) dcpl_id = H5Pcreate(H5P_DATASET_CREATE); VRFY((dcpl_id >= 0), "DCPL creation succeeded"); + /* Add a space after the HDF5_PARAPREFIX notice from h5_fixname */ + if (MAINPROCESS) + puts(""); + /* Run tests with all available filters */ for (cur_filter_idx = 0; cur_filter_idx < num_filters; cur_filter_idx++) { H5D_selection_io_mode_t sel_io_mode; + H5Z_filter_t cur_filter = filterIDs[cur_filter_idx]; + htri_t filter_avail; + + /* Make sure current filter is available before testing with it */ + filter_avail = H5Zfilter_avail(cur_filter); + VRFY((filter_avail >= 0), "H5Zfilter_avail succeeded"); + + if (!filter_avail) { + if (MAINPROCESS) + printf("== SKIPPED tests with filter '%s' - filter unavailable ==\n\n", + filterNames[cur_filter_idx]); + continue; + } /* Run tests with different selection I/O modes */ for (sel_io_mode = H5D_SELECTION_IO_MODE_DEFAULT; sel_io_mode <= H5D_SELECTION_IO_MODE_ON; @@ -9849,13 +9886,13 @@ main(int argc, char **argv) /* Run with each of the test modes (single dataset, multiple datasets, etc.) */ for (test_mode = USE_SINGLE_DATASET; test_mode < TEST_MODE_SENTINEL; test_mode++) { - H5Z_filter_t cur_filter = filterIDs[cur_filter_idx]; - const char *sel_io_str; - const char *alloc_time; - const char *mode; - unsigned filter_config; - htri_t filter_avail; - char group_name[512]; + const char *sel_io_str; + const char *alloc_time; + const char *mode; + unsigned filter_config; + double start_time = 0.0; + double end_time = 0.0; + char group_name[512]; switch (sel_io_mode) { case H5D_SELECTION_IO_MODE_DEFAULT: @@ -9902,7 +9939,24 @@ main(int argc, char **argv) mode = "unknown"; } - if (MAINPROCESS) + /* + * If expediting the remaining tests, just run with a single + * configuration that is interesting enough. In this case, + * run with: + * + * - A single dataset + * - Incremental file space allocation timing + * - Linked-chunk (single) I/O + * - The default setting for selection I/O + */ + if (expedite_testing) { + if (test_mode != USE_SINGLE_DATASET || space_alloc_time != H5D_ALLOC_TIME_INCR || + chunk_opt != H5FD_MPIO_CHUNK_ONE_IO || + sel_io_mode != H5D_SELECTION_IO_MODE_DEFAULT) + continue; + } + + if (MAINPROCESS) { printf("== Running tests in mode '%s' with filter '%s' using selection I/O mode " "'%s', '%s' and '%s' allocation time ==\n\n", test_mode_to_string(test_mode), filterNames[cur_filter_idx], sel_io_str, @@ -9910,15 +9964,7 @@ main(int argc, char **argv) : "Multi-Chunk I/O", alloc_time); - /* Make sure current filter is available before testing with it */ - filter_avail = H5Zfilter_avail(cur_filter); - VRFY((filter_avail >= 0), "H5Zfilter_avail succeeded"); - - if (!filter_avail) { - if (MAINPROCESS) - printf(" ** SKIPPED tests with filter '%s' - filter unavailable **\n\n", - filterNames[cur_filter_idx]); - continue; + start_time = MPI_Wtime(); } /* Get the current filter's info */ @@ -9983,10 +10029,23 @@ main(int argc, char **argv) if (MAINPROCESS) puts(""); + + if (MAINPROCESS) { + end_time = MPI_Wtime(); + total_test_time += end_time - start_time; + printf("Tests took %f seconds\n\n", end_time - start_time); + } } } } } + + /* + * If the TestExpress level setting isn't set for exhaustive + * testing, run smoke checks for the other filters + */ + if (!expedite_testing && (test_express_level_g >= 1)) + expedite_testing = true; } VRFY((H5Pclose(dcpl_id) >= 0), "DCPL close succeeded"); @@ -9999,7 +10058,7 @@ main(int argc, char **argv) goto exit; if (MAINPROCESS) - puts("All Parallel Filters tests passed\n"); + printf("All Parallel Filters tests passed - total test time was %f seconds\n", total_test_time); exit: if (nerrors) diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 70a76ecdb32..eff39d057e0 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -306,12 +306,14 @@ test_mpio_gb_file(char *filename) for (i = ntimes - 2; i <= ntimes; i++) { mpi_off = (i * mpi_size + mpi_rank) * (MPI_Offset)MB; if (VERBOSE_MED) - fprintf(stdout, "proc %d: write to mpi_off=%016llx, %lld\n", mpi_rank, mpi_off, mpi_off); + fprintf(stdout, "proc %d: write to mpi_off=%016llx, %lld\n", mpi_rank, (long long)mpi_off, + (long long)mpi_off); /* set data to some trivial pattern for easy verification */ for (j = 0; j < MB; j++) *(buf + j) = (int8_t)(i * mpi_size + mpi_rank); if (VERBOSE_MED) - fprintf(stdout, "proc %d: writing %d bytes at offset %lld\n", mpi_rank, MB, mpi_off); + fprintf(stdout, "proc %d: writing %d bytes at offset %lld\n", mpi_rank, MB, + (long long)mpi_off); mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); INFO((mrc == MPI_SUCCESS), "GB size file write"); if (mrc != MPI_SUCCESS) @@ -345,7 +347,8 @@ test_mpio_gb_file(char *filename) for (i = ntimes - 2; i <= ntimes; i++) { mpi_off = (i * mpi_size + (mpi_size - mpi_rank - 1)) * (MPI_Offset)MB; if (VERBOSE_MED) - fprintf(stdout, "proc %d: read from mpi_off=%016llx, %lld\n", mpi_rank, mpi_off, mpi_off); + fprintf(stdout, "proc %d: read from mpi_off=%016llx, %lld\n", mpi_rank, + (long long)mpi_off, (long long)mpi_off); mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); INFO((mrc == MPI_SUCCESS), "GB size file read"); expected = (int8_t)(i * mpi_size + (mpi_size - mpi_rank - 1)); diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index 0c64bf2927f..7c565997b3d 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -382,16 +382,20 @@ test_config_file(void) substr = strstr(config_buf, "hdf5_file"); VRFY(substr, "strstr succeeded"); + H5_GCC_CLANG_DIAG_OFF("format-nonliteral") snprintf(scan_format, sizeof(scan_format), "hdf5_file=%%%zus", (size_t)(PATH_MAX - 1)); VRFY((sscanf(substr, scan_format, tmp_buf) == 1), "sscanf succeeded"); + H5_GCC_CLANG_DIAG_ON("format-nonliteral") VRFY((strcmp(tmp_buf, resolved_path) == 0), "strcmp succeeded"); substr = strstr(config_buf, "subfile_dir"); VRFY(substr, "strstr succeeded"); + H5_GCC_CLANG_DIAG_OFF("format-nonliteral") snprintf(scan_format, sizeof(scan_format), "subfile_dir=%%%zus", (size_t)(PATH_MAX - 1)); VRFY((sscanf(substr, scan_format, tmp_buf) == 1), "sscanf succeeded"); + H5_GCC_CLANG_DIAG_ON("format-nonliteral") VRFY((strcmp(tmp_buf, subfile_dir) == 0), "strcmp succeeded"); @@ -886,7 +890,7 @@ test_selection_strategies(void) char criteria_buf[256]; char sel_criteria[128]; /* Use char buffer for criteria as we may support the "with config" strategy in the future */ - int expected_num_subfiles; + int expected_num_subfiles = -1; cfg.ioc_selection = strategy; cfg.stripe_size = H5FD_SUBFILING_DEFAULT_STRIPE_SIZE; diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index b64c8ad3204..7de9d1afe5c 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -179,7 +179,7 @@ main(void) " %6f = %f\n", (double)fok[0], (double)fptr[0], (double)fok[1], (double)fptr[1], (double)fnok[0], (double)fptr[2], (double)fnok[1], (double)fptr[3]); - puts("*FAILED - compound type alignnent problem*"); + puts("*FAILED - compound type alignment problem*"); } else { puts(" PASSED"); diff --git a/utils/subfiling_vfd/h5fuse.sh.in b/utils/subfiling_vfd/h5fuse.sh.in index c6d715fd0a9..82d497e3f1c 100755 --- a/utils/subfiling_vfd/h5fuse.sh.in +++ b/utils/subfiling_vfd/h5fuse.sh.in @@ -13,7 +13,6 @@ BLD='\033[1m' GRN='\033[0;32m' RED='\033[0;31m' -PUR='\033[0;35m' CYN='\033[0;36m' NC='\033[0m' # No Color @@ -58,6 +57,106 @@ EOL } +function fuse { + +# function for fusing the files + +mpi_rank=0 +mpi_size=1 +nstart=1 +nend=$nsubfiles + +if [ "$parallel" == "true" ]; then + + hex=$(hexdump -n 16 -v -e '/1 "%02X"' /dev/urandom) + c_exec="h5fuse_"${hex} + c_src=${c_exec}.c + + # Generate and compile an MPI program to get MPI rank and size + if [ ! -f "${c_src}" ]; then + gen_mpi + CC=@CC@ + ${CC} "${c_src}" -o "${c_exec}" + fi + wait + rank_size=$(./"${c_exec}") + read -r mpi_rank mpi_size <<<"$rank_size" + + rm -f "${c_src}" "${c_exec}" + + # Divide the subfiles among the ranks + iwork1=$(( nsubfiles / mpi_size )) + iwork2=$(( nsubfiles % mpi_size )) + min=$(( mpi_rank < iwork2 ? mpi_rank : iwork2 )) + nstart=$(( mpi_rank * iwork1 + 1 + min )) + nend=$(( nstart + iwork1 - 1 )) + if [ $iwork2 -gt "$mpi_rank" ]; then + nend=$(( nend + 1 )) + fi +fi + +############################################################ +# COMBINE SUBFILES INTO AN HDF5 FILE # +############################################################ +icnt=1 +skip=0 +seek=0 +seek_cnt=0 +for i in "${subfiles[@]}"; do + + subfile="${subfile_dir}/${i}" + + # bs=BYTES read and write up to BYTES bytes at a time; overrides ibs and obs + # ibs=BYTES read up to BYTES bytes at a time + # obs=BYTES write BYTES bytes at a time + # seek=N skip N obs-sized blocks at start of output + # skip=N skip N ibs-sized blocks at start of input + + status=1 + fsize=${subfiles_size[icnt-1]} + if [ "$fsize" -eq "0" ]; then + seek_cnt=$((seek_cnt+1)) + seek=$seek_cnt + if [ "$rm_subf" == "true" ]; then + if [ -f "${subfile}" ]; then + \rm -f "$subfile" + fi + fi + else + if [ $icnt -ge "$nstart" ] && [ $icnt -le "$nend" ]; then + records_left=$fsize + while [ "$status" -gt 0 ]; do + if [ $((skip*stripe_size)) -le "$fsize" ] && [ "$records_left" -gt 0 ]; then + EXEC="dd count=1 bs=$stripe_size if=$subfile of=$hdf5_file skip=$skip seek=$seek conv=notrunc" + if [ "$verbose" == "true" ]; then + echo -e "$GRN $EXEC $NC" + fi + err=$( $EXEC 2>&1 1>/dev/null ) + if [ $? -ne 0 ]; then + echo -e "$CYN ERR: dd Utility Failed $NC" + echo -e "$CYN MSG: $err $NC" + exit $FAILED + fi + records_left=$((records_left-stripe_size)) + skip=$((skip+1)) + seek=$((seek_cnt+skip*nsubfiles)) + else + status=0 + skip=0 + fi + done; wait + if [ "$rm_subf" == "true" ]; then + \rm -f "$subfile" + fi + fi + seek_cnt=$((seek_cnt+1)) + seek=$seek_cnt + fi + icnt=$(( icnt +1 )) +done; wait + +} + ############################################################ ############################################################ # Main program # @@ -166,104 +265,9 @@ for i in "${subfiles[@]}"; do fi done -START="$(date +%s%N)" - -mpi_rank=0 -mpi_size=1 -nstart=1 -nend=$nsubfiles - -if [ "$parallel" == "true" ]; then - - hex=$(hexdump -n 16 -v -e '/1 "%02X"' /dev/urandom) - c_exec="h5fuse_"${hex} - c_src=${c_exec}.c - - # Generate and compile an MPI program to get MPI rank and size - if [ ! -f "${c_src}" ]; then - gen_mpi - CC=@CC@ - ${CC} "${c_src}" -o "${c_exec}" - fi - wait - rank_size=$(./"${c_exec}") - read -r mpi_rank mpi_size <<<"$rank_size" - - rm -f "${c_src}" "${c_exec}" - - # Divide the subfiles among the ranks - iwork1=$(( nsubfiles / mpi_size )) - iwork2=$(( nsubfiles % mpi_size )) - min=$(( mpi_rank < iwork2 ? mpi_rank : iwork2 )) - nstart=$(( mpi_rank * iwork1 + 1 + min )) - nend=$(( nstart + iwork1 - 1 )) - if [ $iwork2 -gt "$mpi_rank" ]; then - nend=$(( nend + 1 )) - fi -fi - -############################################################ -# COMBINE SUBFILES INTO AN HDF5 FILE # -############################################################ -icnt=1 -skip=0 -seek=0 -seek_cnt=0 -for i in "${subfiles[@]}"; do - - subfile="${subfile_dir}/${i}" - - # bs=BYTES read and write up to BYTES bytes at a time; overrides ibs and obs - # ibs=BYTES read up to BYTES bytes at a time - # obs=BYTES write BYTES bytes at a time - # seek=N skip N obs-sized blocks at start of output - # skip=N skip N ibs-sized blocks at start of input - - status=1 - fsize=${subfiles_size[icnt-1]} - if [ "$fsize" -eq "0" ]; then - seek_cnt=$((seek_cnt+1)) - seek=$seek_cnt - if [ "$rm_subf" == "true" ]; then - if [ -f "${subfile}" ]; then - \rm -f "$subfile" - fi - fi - else - if [ $icnt -ge "$nstart" ] && [ $icnt -le "$nend" ]; then - records_left=$fsize - while [ "$status" -gt 0 ]; do - if [ $((skip*stripe_size)) -le "$fsize" ] && [ "$records_left" -gt 0 ]; then - EXEC="dd count=1 bs=$stripe_size if=$subfile of=$hdf5_file skip=$skip seek=$seek conv=notrunc" - if [ "$verbose" == "true" ]; then - echo -e "$GRN $EXEC $NC" - fi - err=$( $EXEC 2>&1 1>/dev/null ) - if [ $? -ne 0 ]; then - echo -e "$CYN ERR: dd Utility Failed $NC" - echo -e "$CYN MSG: $err $NC" - exit $FAILED - fi - records_left=$((records_left-stripe_size)) - skip=$((skip+1)) - seek=$((seek_cnt+skip*nsubfiles)) - else - status=0 - skip=0 - fi - done; wait - if [ "$rm_subf" == "true" ]; then - \rm -f "$subfile" - fi - fi - seek_cnt=$((seek_cnt+1)) - seek=$seek_cnt - fi - icnt=$(( icnt +1 )) -done; wait - -END=$(( $(date +%s%N) - START )) -DURATION_SEC=$(awk -vp="$END" -vq=0.000000001 'BEGIN{printf "%.4f" ,p * q}') if [ "$quiet" == "false" ]; then - echo -e "$PUR COMPLETION TIME = $DURATION_SEC s $NC" -fi \ No newline at end of file + TIMEFORMAT="COMPLETION TIME = %R s" + time fuse +else + fuse +fi