diff options
191 files changed, 5737 insertions, 2374 deletions
diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 71dabb1..5a89564 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -27,7 +27,15 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT set (TGZPATH ${HDF5_SOURCE_DIR}) endif () set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME}) + if (NOT EXISTS "${ZLIB_URL}") + set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE) + message (STATUS "Filter ZLIB file ${ZLIB_URL} not found") + endif () set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME}) + if (NOT EXISTS "${SZIP_URL}") + set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE) + message (STATUS "Filter SZIP file ${SZIP_URL} not found") + endif () else () set (ZLIB_USE_EXTERNAL 0) set (SZIP_USE_EXTERNAL 0) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 464477b..7a0746a 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -134,7 +134,7 @@ install ( ) #----------------------------------------------------------------------------- -# Configure the HDF518_Examples.cmake file and the examples +# Configure the HDF5_Examples.cmake file and the examples #----------------------------------------------------------------------------- option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF) if (HDF5_PACK_EXAMPLES) diff --git a/CMakeLists.txt b/CMakeLists.txt index a16cb08..b9cdf4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -482,6 +482,15 @@ if (HDF5_MEMORY_ALLOC_SANITY_CHECK) endif () #----------------------------------------------------------------------------- +# Option to enable/disable using pread/pwrite for VFDs +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON) +mark_as_advanced (HDF5_ENABLE_PREADWRITE) +if (HDF5_ENABLE_PREADWRITE AND H5_HAVE_PREAD AND H5_HAVE_PWRITE) + set (H5_HAVE_PREADWRITE 1) +endif () + +#----------------------------------------------------------------------------- # Option to use deprecated public API symbols #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON) @@ -749,6 +758,11 @@ if (BUILD_TESTING) "Timeout in seconds for each test (default 1200=20minutes)" ) + # Generate a list of timeouts based on DART_TESTING_TIMEOUT + math (EXPR CTEST_SHORT_TIMEOUT "${DART_TESTING_TIMEOUT} / 2") + math (EXPR CTEST_LONG_TIMEOUT "${DART_TESTING_TIMEOUT} * 2") + math (EXPR CTEST_VERY_LONG_TIMEOUT "${DART_TESTING_TIMEOUT} * 3") + option (HDF5_TEST_VFD "Execute tests with different VFDs" OFF) mark_as_advanced (HDF5_TEST_VFD) if (HDF5_TEST_VFD) @@ -826,9 +840,6 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) if (HDF5_BUILD_FORTRAN) - - option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON) - include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) message (STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}") @@ -841,10 +852,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake) set (LINK_Fortran_LIBS ${LINK_LIBS}) - if (HDF5_ENABLE_F2003) - if (NOT FORTRAN_HAVE_ISO_C_BINDING) - set (HDF5_ENABLE_F2003 OFF) - endif () + if (NOT H5_FORTRAN_HAVE_ISO_C_BINDING) + message (FATAL_ERROR " **** Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, disable HDF5_BUILD_FORTRAN **** ") endif () # Parallel IO usage requires MPI to be Linked and Included @@ -92,13 +92,20 @@ ./bin/timekeeper _DO_NOT_DISTRIBUTE_ ./bin/trace ./bin/yodconfigure -./bin/batch/knl_ctestP.sl -./bin/batch/knl_ctestS.sl -./bin/batch/knl_ctestSP.sl +./bin/batch/cori_ctestP.sl.in.cmake +./bin/batch/cori_ctestS.sl.in.cmake +./bin/batch/cori_knl_ctestP.sl.in.cmake +./bin/batch/cori_knl_ctestS.sl.in.cmake +./bin/batch/ctestP.lsf.in.cmake +./bin/batch/ctestP.sl.in.cmake +./bin/batch/ctestS.lsf.in.cmake +./bin/batch/ctestS.sl.in.cmake +./bin/batch/knl_ctestP.sl.in.cmake +./bin/batch/knl_ctestS.sl.in.cmake ./bin/batch/knl_H5detect.sl.in.cmake -./bin/batch/sbatch_ctestS.sl -./bin/batch/sbatch_ctestP.sl -./bin/batch/sbatch_ctestSP.sl +./bin/batch/ray_ctestP.lsf.in.cmake +./bin/batch/ray_ctestS.lsf.in.cmake +./bin/batch/raybsub ./bin/pkgscrpts/h5rmflags _DO_NOT_DISTRIBUTE_ ./bin/pkgscrpts/makeHDF5BinaryTarfiles.pl _DO_NOT_DISTRIBUTE_ ./bin/pkgscrpts/makeInternalREADME.pl _DO_NOT_DISTRIBUTE_ @@ -455,6 +462,7 @@ ./release_docs/INSTALL_Warnings.txt ./release_docs/INSTALL_Windows.txt ./release_docs/RELEASE.txt +./release_docs/README_HPC ./release_docs/USING_HDF5_CMake.txt ./release_docs/USING_HDF5_VS.txt @@ -968,6 +976,7 @@ ./test/cross_read.c ./test/dangle.c ./test/deflate.h5 +./test/del_many_dense_attrs.c ./test/direct_chunk.c ./test/dsets.c ./test/dt_arith.c @@ -1056,6 +1065,7 @@ ./test/le_extlink2.h5 ./test/lheap.c ./test/links.c +./test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 ./test/mergemsg.h5 ./test/mf.c ./test/mount.c @@ -1102,10 +1112,10 @@ ./test/tcheck_version.c ./test/tconfig.c ./test/tcoords.c +./test/testabort_fail.sh.in ./test/testcheck_version.sh.in ./test/testerror.sh.in ./test/testlinks_env.sh.in -./test/test_filenotclosed.sh.in ./test/test_filter_plugin.sh.in ./test/test_filters_le.h5 ./test/test_filters_be.h5 @@ -3193,6 +3203,7 @@ ./config/toolchain/crayle.cmake ./config/toolchain/GCC.cmake ./config/toolchain/intel.cmake +./config/toolchain/PGI.cmake ./config/cmake/cacheinit.cmake ./config/cmake/CMakeFindJavaCommon.cmake @@ -3250,7 +3261,6 @@ # CMake-specific Examples Files ./config/cmake/HDF5_Examples.cmake.in -./config/cmake/HDF518_Examples.cmake.in ./release_docs/USING_CMake_Examples.txt ./CMakeLists.txt @@ -3361,6 +3371,8 @@ ./config/cmake/scripts/CTestScript.cmake ./config/cmake/scripts/HDF5config.cmake ./config/cmake/scripts/HDF5options.cmake +./config/cmake/scripts/HPC/par-HDF5options.cmake +./config/cmake/scripts/HPC/ser-HDF5options.cmake # Files generated by autogen ./aclocal.m4 diff --git a/bin/batch/cori_ctestP.sl.in.cmake b/bin/batch/cori_ctestP.sl.in.cmake new file mode 100644 index 0000000..6aa4916 --- /dev/null +++ b/bin/batch/cori_ctestP.sl.in.cmake @@ -0,0 +1,17 @@ +#!/bin/bash + +#SBATCH -C haswell +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestP + +cd @HDF5_BINARY_DIR@ +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM|ph5example -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/bin/batch/knl_ctestS.sl b/bin/batch/cori_ctestS.sl.in.cmake index 5b77c5b..cf68826 100644 --- a/bin/batch/knl_ctestS.sl +++ b/bin/batch/cori_ctestS.sl.in.cmake @@ -1,6 +1,6 @@ #!/bin/bash -#SBATCH -p knl -C quad,flat +#SBATCH -C haswell #SBATCH --nodes=1 #SBATCH -t 00:30:00 #SBATCH --mail-type=BEGIN,END,FAIL @@ -8,10 +8,9 @@ #SBATCH --export=ALL #SBATCH --job-name=h5_ctestS -cd build -CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" +cd @HDF5_BINARY_DIR@ +CMD="ctest . -E TEST_PAR|PH5DIFF|PERFORM|ph5example -C Release -j 32 -T test" echo "Run $CMD. Test output will be in build/ctestS.out" $CMD >& ctestS.out echo "Done running $CMD" - diff --git a/bin/batch/cori_knl_ctestP.sl.in.cmake b/bin/batch/cori_knl_ctestP.sl.in.cmake new file mode 100644 index 0000000..90dd52a --- /dev/null +++ b/bin/batch/cori_knl_ctestP.sl.in.cmake @@ -0,0 +1,17 @@ +#!/bin/bash + +#SBATCH -C knl,quad,cache +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestP + +cd @HDF5_BINARY_DIR@ +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM|ph5example -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/bin/batch/cori_knl_ctestS.sl.in.cmake b/bin/batch/cori_knl_ctestS.sl.in.cmake new file mode 100644 index 0000000..7db4483 --- /dev/null +++ b/bin/batch/cori_knl_ctestS.sl.in.cmake @@ -0,0 +1,16 @@ +#!/bin/bash + +#SBATCH -C knl,quad, cache +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +cd @HDF5_BINARY_DIR@ +CMD="ctest . -E TEST_PAR|PH5DIFF|PERFORM|ph5example -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" diff --git a/bin/batch/ctestP.lsf.in.cmake b/bin/batch/ctestP.lsf.in.cmake new file mode 100644 index 0000000..2777f39 --- /dev/null +++ b/bin/batch/ctestP.lsf.in.cmake @@ -0,0 +1,19 @@ +#!/bin/tcsh +### LSF syntax +#BSUB -nnodes 1 #number of nodes +#BSUB -W 30 #walltime in minutes +#BSUB -G guests #account +#BSUB -e ctestPerrors.txt #stderr +#BSUB -o ctestPoutput.txt #stdout +#BSUB -J hdf5_ctestP #job +##BSUB -q pbatch #queue to use +#BSUB -q pdebug + +##date; hostname +##echo -n 'JobID is '; echo $LSB_JOBID + +cd @HDF5_BINARY_DIR@ +echo "Run parallel test command. Test output will be in build/ctestP.out" +ctest . -R 'TEST_PAR|PH5DIFF|PERFORM' -E t_cache_image -C Release -T test >& ctestP.out + +echo "Done running ctest parallel command." diff --git a/bin/batch/sbatch_ctestP.sl b/bin/batch/ctestP.sl.in.cmake index e967dce..9fed14d 100644 --- a/bin/batch/sbatch_ctestP.sl +++ b/bin/batch/ctestP.sl.in.cmake @@ -5,11 +5,10 @@ #SBATCH --mail-type=BEGIN,END,FAIL ##SBATCH --mail-user=<username>@sandia.gov #SBATCH --export=ALL -#SBATCH --job-name=h5_ctestS +#SBATCH --job-name=h5_ctestP - -cd build -CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" +cd @HDF5_BINARY_DIR@ +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM|ph5example -E t_cache_image -C Release -T test" echo "Run $CMD. Test output will be in build/ctestP.out" $CMD >& ctestP.out diff --git a/bin/batch/ctestS.lsf.in.cmake b/bin/batch/ctestS.lsf.in.cmake new file mode 100644 index 0000000..7ef5af5 --- /dev/null +++ b/bin/batch/ctestS.lsf.in.cmake @@ -0,0 +1,18 @@ +#!/bin/tcsh +### LSF syntax +#BSUB -nnodes 1 #number of nodes +#BSUB -W 29 #walltime in minutes +#BSUB -G guests #account +#BSUB -e ctestSerrors.txt #stderr +#BSUB -o ctestSoutput.txt #stdout +#BSUB -J hdf5_ctestS #job +##BSUB -q pbatch #queue to use +#BSUB -q pdebug + +cd @HDF5_BINARY_DIR@ +echo "Run command. Test output will be in build/ctestS.out" +ctest . -E 'TEST_PAR|PH5DIFF|PERFORM' -C Release -j 32 -T test >& ctestS.out + +##$CMD >& ctestS.out +echo "Done running command." + diff --git a/bin/batch/sbatch_ctestS.sl b/bin/batch/ctestS.sl.in.cmake index a103356..98c1bcd 100644 --- a/bin/batch/sbatch_ctestS.sl +++ b/bin/batch/ctestS.sl.in.cmake @@ -7,9 +7,8 @@ #SBATCH --export=ALL #SBATCH --job-name=h5_ctestS - -cd build -CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" +cd @HDF5_BINARY_DIR@ +CMD="ctest . -E TEST_PAR|PH5DIFF|PERFORM|ph5example -C Release -j 32 -T test" echo "Run $CMD. Test output will be in build/ctestS.out" $CMD >& ctestS.out diff --git a/bin/batch/knl_ctestP.sl b/bin/batch/knl_ctestP.sl.in.cmake index 3a03fe2..5c7c83f 100644 --- a/bin/batch/knl_ctestP.sl +++ b/bin/batch/knl_ctestP.sl.in.cmake @@ -1,6 +1,6 @@ #!/bin/bash -#SBATCH -p knl -C quad,flat +#SBATCH -p knl -C quad,cache #SBATCH --nodes=1 #SBATCH -t 00:30:00 #SBATCH --mail-type=BEGIN,END,FAIL @@ -8,9 +8,9 @@ #SBATCH --export=ALL #SBATCH --job-name=h5_ctestS -cd build +cd @HDF5_BINARY_DIR@ #run parallel tests except t_cache_image test -CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM|ph5example -E t_cache_image -C Release -T test" echo "Run $CMD. Test output will be in build/ctestP.out" $CMD >& ctestP.out diff --git a/bin/batch/knl_ctestS.sl.in.cmake b/bin/batch/knl_ctestS.sl.in.cmake new file mode 100644 index 0000000..0dae31f --- /dev/null +++ b/bin/batch/knl_ctestS.sl.in.cmake @@ -0,0 +1,17 @@ +#!/bin/bash + +#SBATCH -p knl -C quad,cache +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +cd @HDF5_BINARY_DIR@ +CMD="ctest . -E TEST_PAR|PH5DIFF|PERFORM|ph5example -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" + diff --git a/bin/batch/knl_ctestSP.sl b/bin/batch/knl_ctestSP.sl deleted file mode 100644 index 56da347..0000000 --- a/bin/batch/knl_ctestSP.sl +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -#SBATCH -p knl -C quad,flat -#SBATCH --nodes=1 -#SBATCH -t 01:00:00 -#SBATCH --mail-type=BEGIN,END,FAIL -##SBATCH --mail-user=<username>@sandia.gov -#SBATCH --export=ALL -#SBATCH --job-name=h5_ctestS - -module load cmake -module load craype-hugepages4M - -cd build -CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" - -echo "Run $CMD. Test output will be in build/ctestS.out" -$CMD >& ctestS.out -echo "Done running $CMD" - - -#run parallel tests except t_cache_image test -CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" - -echo "Run $CMD. Test output will be in build/ctestP.out" -$CMD >& ctestP.out -echo "Done running $CMD" - diff --git a/bin/batch/ray_ctestP.lsf.in.cmake b/bin/batch/ray_ctestP.lsf.in.cmake new file mode 100644 index 0000000..6b5316a --- /dev/null +++ b/bin/batch/ray_ctestP.lsf.in.cmake @@ -0,0 +1,20 @@ +#!/bin/tcsh +### LSF syntax +#BSUB -n 6 #number of nodes +#BSUB -R "span[ptile=6]" +#BSUB -W 30 #walltime in minutes +#BSUB -G guests #account +#BSUB -e ctestPerrors.txt #stderr +#BSUB -o ctestPoutput.txt #stdout +#BSUB -J hdf5_ctestP #job +##BSUB -q pbatch #queue to use +#BSUB -q pdebug + +##date; hostname +##echo -n 'JobID is '; echo $LSB_JOBID + +cd @HDF5_BINARY_DIR@ +echo "Run parallel test command. Test output will be in build/ctestP.out" +ctest . -R 'TEST_PAR|PH5DIFF|PERFORM|ph5example' -E t_cache_image -C Release -T test >& ctestP.out + +echo "Done running ctest parallel command." diff --git a/bin/batch/ray_ctestS.lsf.in.cmake b/bin/batch/ray_ctestS.lsf.in.cmake new file mode 100644 index 0000000..d23a513 --- /dev/null +++ b/bin/batch/ray_ctestS.lsf.in.cmake @@ -0,0 +1,18 @@ +#!/bin/tcsh +### LSF syntax +#BSUB -n 1 #number of nodes +#BSUB -W 29 #walltime in minutes +#BSUB -G guests #account +#BSUB -e ctestSerrors.txt #stderr +#BSUB -o ctestSoutput.txt #stdout +#BSUB -J hdf5_ctestS #job +##BSUB -q pbatch #queue to use +#BSUB -q pdebug + +cd @HDF5_BINARY_DIR@ +echo "Run command. Test output will be in build/ctestS.out" +ctest . -E 'TEST_PAR|PH5DIFF|PERFORM|ph5example' -C Release -j 32 -T test >& ctestS.out + +##$CMD >& ctestS.out +echo "Done running command." + diff --git a/bin/batch/raybsub b/bin/batch/raybsub new file mode 100755 index 0000000..19dceef --- /dev/null +++ b/bin/batch/raybsub @@ -0,0 +1,7 @@ +#!/bin/tcsh + +# ray.llnl.gov requires a '<' with bsub for submitting .lsf batch jobs. +# CMake is reluctant to pass the '<', so we put it in this script and use +# the script to submit the bsub command on ray. + +bsub < $1 diff --git a/bin/batch/sbatch_ctestSP.sl b/bin/batch/sbatch_ctestSP.sl deleted file mode 100644 index 5d79d9b..0000000 --- a/bin/batch/sbatch_ctestSP.sl +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -#SBATCH --nodes=1 -#SBATCH -t 01:00:00 -#SBATCH --mail-type=BEGIN,END,FAIL -##SBATCH --mail-user=<username>@sandia.gov -#SBATCH --export=ALL -#SBATCH --job-name=h5_ctestS - - -cd build -CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" - -echo "Run $CMD. Test output will be in build/ctestS.out" -$CMD >& ctestS.out -echo "Done running $CMD" - - -#run parallel tests except t_cache_image test -CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" - -echo "Run $CMD. Test output will be in build/ctestP.out" -$CMD >& ctestP.out -echo "Done running $CMD" - diff --git a/bin/release b/bin/release index e43be17..96c2e78 100755 --- a/bin/release +++ b/bin/release @@ -55,13 +55,21 @@ for compressing the resulting tar archive (if none are given then tar -- use tar and don't do any compressing. gzip -- use gzip with "-9" and append ".gz" to the output name. + bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name. + zip -- convert all text files to DOS style and form a zip file for Windows use. cmake-tgz -- create a tar file using the gzip default level with a build-unix.sh command file and all other CMake files needed to build HDF5 source using CMake on unix machines. - bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name. - zip -- convert all text files to DOS style and form a zip file for Windows use. cmake-zip -- convert all text files to DOS style and create a zip file inluding cmake scripts and .bat files to build HDF5 source using CMake on Windows. + hpc-cmake-tgz + -- create a tar file using the gzip default level with a build-unix.sh + command file and all other CMake files needed to build HDF5 source + using CMake on unix machines, with HDF5options.cmake files for serial + and parallel builds on machines requiring batch jobs to run tests. + The default is for parallel build, with serial only build by changing + the HDF5options.cmake symlink to ser-HDF5options.cmake. More + information is available in the README_HPC file. doc -- produce the latest doc tree in addition to the archive. An md5 checksum is produced for each archive created and stored in the md5 file. @@ -225,7 +233,7 @@ tar2cmakezip() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.10-Source.tar.gz $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.12.4-Source.zip $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmziptmpsubdir @@ -256,7 +264,7 @@ tar2cmakezip() } # Function name: tar2cmaketgz -# Convert the release tarball to a Windows zipball with files to run CMake build. +# Convert the release tarball to a gzipped tar file with files to run CMake build. # # Programmer: Larry Knox # Creation date: 2017-02-20 @@ -320,7 +328,7 @@ tar2cmaketgz() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.10-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.12.4-Source.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmgztmpsubdir @@ -330,6 +338,93 @@ tar2cmaketgz() rm -rf $cmgztmpdir } +# Function name: tar2hpccmaketgz +# Convert the release tarball to a gzipped tarfile with files to run CMake build +# and HDF5options.cmake files for parallel or serial only builds where build +# tests are run on compute nodes using batch scripts. +# +# Programmer: Larry Knox +# Creation date: 2019-01-28 +# +# Modifications +# +# Steps: +# 1. untar the tarball in a temporary directory; +# Note: do this in a temporary directory to avoid changing +# the original source directory which may be around. +# 2. add build-unix.sh script. +# 3. add SZIP.tar.gz, ZLib.tar.gz and cmake files to top level directory. +# 4. create gzipped tar file with these contents: +# build-unix.sh script +# hdf5-<version> source code directory extracted from tar file +# CTestScript.cmake cmake file copied from <hdf5 source code>/config/cmake/scripts +# HDF5config.cmake cmake file copied from <hdf5 source code>/config/cmake/scripts +# HDF5options.cmake cmake file copied from <hdf5 source code>/config/cmake/scripts +# SZip.tar.gz copied from /mnt/scr1/pre-release/hdf5/CMake +# ZLib.tar.gz copied from /mnt/scr1/pre-release/hdf5/CMake +# +# 5. For HPC-CMake tgz file the following are also needed in the top-level directory: +# README_HPC copied from release_docs +# ser-HDF5options.cmake copied from <hdf5 source code>/config/cmake/scripts/HPC +# par-HDF5options.cmake copied from <hdf5 source code>/config/cmake/scripts/HPC +# HDF5options.cmake symlink to par-HDF5options.cmake +# + +# Parameters: +# $1 version +# $2 release tarball +# $3 output zipball file name +# +# Returns 0 if successful; 1 otherwise +# + # need function to create another temporary directory, extract the + # $tmpdir/$HDF5_VERS.tar into it, create build-unix.sh, + # add CTestScript.cmake, HDF5config.cmake, SZIP.tar.gz + # ZLib.tar.gz, HDF5 examples, and then tar.gz it. +tar2hpccmaketgz() +{ + if [ $# -ne 3 ]; then + echo "usage: tar2hpccmaketgz <tarfilename> <tgzfilename>" + return 1 + fi + cmgztmpdir=/tmp/cmgztmpdir$$ + cmgztmpsubdir=$cmgztmpdir/HPC-CMake-$HDF5_VERS + mkdir -p $cmgztmpsubdir + version=$1 + tarfile=$2 + tgzfile=$3 + + # step 1: untar tarball in cmgztmpdir + (cd $cmgztmpsubdir; tar xf -) < $tarfile + # sanity check + if [ ! -d $cmgztmpsubdir/$version ]; then + echo "untar did not create $cmgztmpsubdir/$version source dir" + # cleanup + rm -rf $cmgztmpdir + return 1 + fi + + + # step 2: add build-unix.sh script + (cd $cmgztmpsubdir; echo "ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log" > build-unix.sh; chmod 755 build-unix.sh) + + # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files + cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.12.4-Source.tar.gz $cmgztmpsubdir + cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir + cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir + + cp $cmgztmpsubdir/$version/release_docs/README_HPC $cmgztmpsubdir + cp $cmgztmpsubdir/$version/config/cmake/scripts/HPC/ser-HDF5options.cmake $cmgztmpsubdir + cp $cmgztmpsubdir/$version/config/cmake/scripts/HPC/par-HDF5options.cmake $cmgztmpsubdir + (cd $cmgztmpsubdir; ln -s par-HDF5options.cmake HDF5options.cmake) + tar czf $DEST/HPC-CMake-$HDF5_VERS.tar.gz -C $cmgztmpdir . || exit 1 + + # cleanup + rm -rf $cmgztmpdir +} + # This command must be run at the top level of the hdf5 source directory. # Verify this requirement. if [ ! \( -f configure.ac -a -f bin/release \) ]; then @@ -514,6 +609,11 @@ for comp in $methods; do tar2cmaketgz $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/CMake-$HDF5_VERS.tar.gz 1>&2 (cd $DEST; md5sum CMake-$HDF5_VERS.tar.gz >> $MD5file) ;; + hpc-cmake-tgz) + test "$verbose" && echo " Creating HPC-CMake tar.gz file..." 1>&2 + tar2hpccmaketgz $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/HPC-CMake-$HDF5_VERS.tar.gz 1>&2 + (cd $DEST; md5sum HPC-CMake-$HDF5_VERS.tar.gz >> $MD5file) + ;; bzip2) test "$verbose" && echo " Running bzip2..." 1>&2 bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2 diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index 0da98a4..5e80408 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -53,8 +53,7 @@ * <br /> * \section install_sec Installation * - * The HDF5 C++ API is included with the HDF5 source code and can - * be obtained from + * The HDF5 C++ API is included with the HDF5 source code. * * Please refer to the release_docs/INSTALL file under the top directory * of the HDF5 source code for information about installing, building, diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index 996a20f..6a8ce2c 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -55,7 +55,7 @@ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects) - set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30) + set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) endif () endmacro () diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 33e6d4c..27eaa56 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -41,16 +41,20 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5TEST-err_compat #uses runTest.cmake H5TEST-links_env #uses runTest.cmake H5TEST-testlibinfo #uses grepTest.cmake - H5TEST-clear-testhdf5-objects + ######### H5TEST-clear-objects H5TEST-clear-cache-objects H5TEST-clear-cache_api-objects H5TEST-clear-cache_image-objects H5TEST-clear-cache_tagging-objects + H5TEST-clear-del_many_dense_attrs-objects H5TEST-clear-err_compat-objects H5TEST-clear-error_test-objects H5TEST-clear-filenotclosed-objects + H5TEST-clear-flush-objects H5TEST-clear-links_env-objects + H5TEST-clear-testflushrefresh-objects + H5TEST-clear-testhdf5-objects H5TEST-clear-ttsafe-objects PERFORM_h5perform-clear-objects HL_TOOLS-clear-objects @@ -307,6 +311,11 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5REPACK_VERIFY_LAYOUT_ALL-layout_short_switches #uses grepTest.cmake H5REPACK-plugin H5REPACK_CMP-plugin_zero + ######### + ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-latest_latest_invalid-clear-objects + H5REPACK_VERIFY_SUPERBLOCK-SB_IS_0-clear-objects + H5REPACK_VERIFY_SUPERBLOCK-SB_IS_2-clear-objects + H5REPACK_VERIFY_SUPERBLOCK-SB_IS_3-clear-objects ######### tools/h5stat ######### H5STAT-clearall-objects ######### tools/misc ######### diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 459346e..c1abeed 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -247,6 +247,11 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctl # H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") # ---------------------------------------------------------------------- +# Set the flag to indicate that the machine can accurately convert +# some long double values +# +H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV "Checking IF the cpu is power9 and cannot correctly converting long double values") +# ---------------------------------------------------------------------- # Check if pointer alignments are enforced # H5ConversionTests (${HDF_PREFIX}_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restrictions are strictly enforced") diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index c2748b2..6d597a0 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -287,3 +287,27 @@ main () #endif +#ifdef H5_DISABLE_SOME_LDOUBLE_CONV_TEST + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int HDF_NO_UBSAN main(void) +{ + FILE *fp; + char cpu[64]; + + fp = popen("uname -m", "r"); + + fgets(cpu, sizeof(cpu)-1, fp); + + pclose(fp); + + if(strncmp(cpu, "ppc64le", 7) == 0) + return 0; + + return 1; +} + +#endif diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index c42d93a..273adb5 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -267,6 +267,9 @@ /* Define if we have parallel support */ #cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +/* Define if both pread and pwrite exist. */ +#cmakedefine H5_HAVE_PREADWRITE @H5_HAVE_PREADWRITE@ + /* Define to 1 if you have the <pthread.h> header file. */ #cmakedefine H5_HAVE_PTHREAD_H @H5_HAVE_PTHREAD_H@ @@ -460,6 +463,9 @@ with special algorithm. */ #cmakedefine H5_LONG_TO_LDOUBLE_SPECIAL @H5_LONG_TO_LDOUBLE_SPECIAL@ +/* Define if your system is power6 and cannot convert some long double values. */ +#cmakedefine H5_DISABLE_SOME_LDOUBLE_CONV @H5_DISABLE_SOME_LDOUBLE_CONV@ + /* Define to the sub-directory where libtool stores uninstalled libraries. */ #cmakedefine H5_LT_OBJDIR @H5_LT_OBJDIR@ @@ -599,6 +605,9 @@ /* The size of `short', as computed by sizeof. */ #cmakedefine H5_SIZEOF_SHORT @H5_SIZEOF_SHORT@ +/* The size of `time_t', as computed by sizeof. */ +#cmakedefine H5_SIZEOF_TIME_T @H5_SIZEOF_TIME_T@ + /* The size of `uint16_t', as computed by sizeof. */ #cmakedefine H5_SIZEOF_UINT16_T @H5_SIZEOF_UINT16_T@ diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in deleted file mode 100644 index ba79ef2..0000000 --- a/config/cmake/HDF518_Examples.cmake.in +++ /dev/null @@ -1,106 +0,0 @@ -# -# 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://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -cmake_minimum_required (VERSION 3.10) -############################################################################################################### -# This script will build and run the examples from a folder -# Execute from a command line: -# ctest -S HDF518_Examples.cmake,OPTION=VALUE -C Release -VV -O test.log -############################################################################################################### - -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -if("@CMAKE_GENERATOR_TOOLSET@") - set(CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -endif() -set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) - -# handle input parameters to script. -#INSTALLDIR - HDF5-1.8 root folder -#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo -#CTEST_SOURCE_NAME - name of source folder; HDF5Examples -if(DEFINED CTEST_SCRIPT_ARG) - # transform ctest script arguments of the form - # script.ctest,var1=value1,var2=value2 - # to variables with the respective names set to the respective values - string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") - foreach(current_var ${script_args}) - if("${current_var}" MATCHES "^([^=]+)=(.+)$") - set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif() - endforeach() -endif() - -################################################################### -### Following Line is one of [Release, RelWithDebInfo, Debug] ##### -set(CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") -if(NOT DEFINED CTEST_CONFIGURATION_TYPE) - set(CTEST_CONFIGURATION_TYPE "Release") -endif() -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${CTEST_CONFIGURATION_TYPE}") -################################################################## - -if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") -endif() - -if(NOT DEFINED CTEST_SOURCE_NAME) - set(CTEST_SOURCE_NAME "HDF5Examples") -endif() - -if(NOT DEFINED HDF_LOCAL) - set(CDASH_LOCAL "NO") -else() - set(CDASH_LOCAL "YES") -endif() -if(NOT DEFINED CTEST_SITE) - set(CTEST_SITE "local") -endif() -if(NOT DEFINED CTEST_BUILD_NAME) - set(CTEST_BUILD_NAME "examples") -endif() -set(BUILD_OPTIONS "${BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") - -#TAR_SOURCE - name of tarfile -#if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.2.1-Source") -#endif() - -############################################################################################################### -if(WIN32) - set(SITE_OS_NAME "Windows") - set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") - set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) - set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") - set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else() - set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") - set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") - set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) - set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") - set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") -endif() -if(${CDASH_LOCAL}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON") -endif() -set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") - -############################################################################################################### -# For any comments please contact cdashhelp@hdfgroup.org -# -############################################################################################################### - -if(WIN32) - include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake) - include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) -else() - include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake) - include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) -endif() diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index 6c203e2..007bc29 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -15,6 +15,8 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage) # SOVERSION passed in ARGN when shared if (${libtype} MATCHES "SHARED") set (PACKAGE_SOVERSION ${HDF5_${libpackage}_PACKAGE_SOVERSION}) + set (PACKAGE_COMPATIBILITY ${H5_${libpackage}_SOVERS_INTERFACE}.0.0) + set (PACKAGE_CURRENT ${H5_${libpackage}_SOVERS_INTERFACE}.${H5_${libpackage}_SOVERS_MINOR}.0) if (WIN32) set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) else () @@ -26,6 +28,11 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage) else () set_target_properties (${libtarget} PROPERTIES SOVERSION ${LIBHDF_VERSION}) endif () + if (CMAKE_C_OSX_CURRENT_VERSION_FLAG) + set_property(TARGET ${libtarget} APPEND PROPERTY + LINK_FLAGS "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}${PACKAGE_CURRENT} ${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${PACKAGE_COMPATIBILITY}" + ) + endif () endif () HDF_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype}) @@ -33,9 +40,6 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage) if (APPLE) option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) if (HDF5_BUILD_WITH_INSTALL_NAME) - set_property(TARGET ${libtarget} APPEND PROPERTY - LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}" - ) set_target_properties (${libtarget} PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 157befd..6b77ca4 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -18,16 +18,6 @@ ENABLE_LANGUAGE (Fortran) set (HDF_PREFIX "H5") include (CheckFortranFunctionExists) -## Check for non-standard extenstion quadmath.h - -CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH) - -if (${C_HAVE_QUADMATH}) - set(${HDF_PREFIX}_HAVE_QUADMATH_H 1) -else () - set(${HDF_PREFIX}_HAVE_QUADMATH_H 0) -endif () - # The provided CMake Fortran macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- @@ -40,7 +30,7 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 - LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" + LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" ) if (${COMPILE_RESULT_VAR}) @@ -67,8 +57,8 @@ endmacro () # Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END" macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR) - file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_CODE) - string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_CODE}) + file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_MASTER) + string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_MASTER}) set (RETURN_VAR "${SOURCE_CODE}") endmacro () @@ -367,9 +357,9 @@ ENABLE_LANGUAGE (C) #----------------------------------------------------------------------------- macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) message (STATUS "Detecting C ${FUNCTION_NAME}") - if (CMAKE_REQUIRED_LIBRARIES) + if (HDF5_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}") else () set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) endif () diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index d30f2ab..bac174a 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -48,7 +48,11 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ ################################################################## if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") + if(WIN32) + set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") + else() + set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") + endif() endif() if(NOT DEFINED CTEST_SOURCE_NAME) @@ -70,7 +74,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.10-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.12.4-Source") #endif() ############################################################################################################### diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 93ebc3c..0a39568 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -9,16 +9,16 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED TRUE) message (STATUS "Warnings Configuration:") +set (CMAKE_C_FLAGS "${CMAKE_C99_STANDARD_COMPILE_OPTION} ${CMAKE_C_FLAGS}") #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") - if (NOT CYGWIN) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") - endif () if (${HDF_CFG_NAME} MATCHES "Debug") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 43aef22..23f297c 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -77,10 +77,10 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () if (NOT ERROR_APPEND) - # append error output to the stdout output file + # write back to original .err file file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") else () - # write back to original .err file + # append error output to the stdout output file file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") endif () endif () @@ -110,8 +110,8 @@ if (TEST_MASK_ERROR) endif () endif () -# if the return value is !=0 bail out -if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") +# if the return value is !=expected bail out +if (NOT TEST_RESULT EQUAL TEST_EXPECT) message (STATUS "ERROR OUTPUT: ${TEST_STREAM}") message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") endif () @@ -131,33 +131,33 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} RESULT_VARIABLE TEST_RESULT ) - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) list (LENGTH test_ref len_ref) - if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") + if (len_act GREATER 0 AND len_ref GREATER 0) math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") + if (NOT ${str_act} STREQUAL ${str_ref}) + if (NOT str_act STREQUAL "") set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () endforeach () else () - if ("${len_act}" STREQUAL "0") + if (len_act EQUAL 0) message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if ("${len_ref}" STREQUAL "0") + if (len_ref EQUAL 0) message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () endif () - if (NOT "${len_act}" STREQUAL "${len_ref}") + if (NOT len_act EQUAL len_ref) set (TEST_RESULT 1) endif () endif () @@ -165,7 +165,7 @@ if (NOT TEST_SKIP_COMPARE) message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () endif () @@ -182,34 +182,34 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} RESULT_VARIABLE TEST_RESULT ) - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") + if (len_act GREATER 0 AND len_ref GREATER 0) math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") + if (NOT ${str_act} STREQUAL ${str_ref}) + if (NOT ${str_act} STREQUAL "") set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () endforeach () else () - if ("${len_act}" STREQUAL "0") + if (len_act EQUAL 0) message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") endif () - if ("${len_ref}" STREQUAL "0") + if (len_ref EQUAL 0) message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () endif () - if (NOT "${len_act}" STREQUAL "${len_ref}") + if (NOT len_act EQUAL len_ref) set (TEST_RESULT 1) endif () endif () @@ -217,7 +217,7 @@ if (NOT TEST_SKIP_COMPARE) message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") endif () endif () @@ -230,15 +230,15 @@ if (TEST_GREP_COMPARE) # TEST_REFERENCE should always be matched string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) - if ("${TEST_RESULT}" STREQUAL "0") + if (NOT TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) - if ("${TEST_EXPECT}" STREQUAL "1") + if (TEST_EXPECT) # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif () endif () diff --git a/config/cmake/patch.xml b/config/cmake/patch.xml index 70571c5..1bdff3e 100644 --- a/config/cmake/patch.xml +++ b/config/cmake/patch.xml @@ -1,5 +1,5 @@ <CPackWiXPatch> - <CPackWiXFragment Id="CM_CP_libraries.bin.hdf5.dll"> + <CPackWiXFragment Id="CM_CP_libraries.bin.hdf5.dll"> <Environment Id="PATH" Name="PATH" Value="[CM_DP_libraries.bin]" @@ -7,5 +7,5 @@ Part="last" Action="set" System="yes"/> - </CPackWiXFragment> + </CPackWiXFragment> </CPackWiXPatch> diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 2b0ac81..0e2afc7 100644 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -254,6 +254,15 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") endif () + # On Cray XC40, configuring fails in the Fortran section when using the craype-mic-knl module. + # When the configure phase is done with the craype-haswell module and the build phase is done + # with the craype-mic-knl module, configure succeeds and tests pass on the knl compute nodes + # for Intel, Cray, GCC and Clang compilers. If the variables aren't set or if not + # cross compiling, the module switch will not occur. + if (CMAKE_CROSSCOMPILING AND COMPILENODE_HWCOMPILE_MODULE AND COMPUTENODE_HWCOMPILE_MODULE) + execute_process (COMMAND module switch ${COMPILENODE_HWCOMPILE_MODULE} ${COMPUTENODE_HWCOMPILE_MODULE}) + endif () + ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res NUMBER_ERRORS errval) if (LOCAL_SUBMIT) ctest_submit (PARTS Build) @@ -268,7 +277,11 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) else () file(STRINGS ${CTEST_BINARY_DIRECTORY}/Testing/TAG TAG_CONTENTS REGEX "^2([0-9]+)[-]([0-9]+)$") - execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_NAME}) + if ("${LOCAL_BATCH_SCRIPT_COMMAND}" STREQUAL "raybsub") + execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME}) + else () + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME}) + endif () message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) while(result) @@ -281,8 +294,13 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") endif () message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml for serial tests. Renaming to SerialTest.xml") file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/SerialTest.xml) + file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/Temporary/LastTest_${TAG_CONTENTS}.log ${CTEST_BINARY_DIRECTORY}/Testing/Temporary/LastTest_${TAG_CONTENTS}_Serial.log) unset(result CACHE) - execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) + if ("${LOCAL_BATCH_SCRIPT_COMMAND}" STREQUAL "raybsub") + execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) + else () + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) + endif () message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) while(result) diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index dd3b17c..1d8d501 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -43,6 +43,7 @@ set (CTEST_SOURCE_VERSEXT "") #INSTALLDIR - HDF5-1.10.0 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 +#MODEL - CDash group name if (DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 @@ -169,7 +170,10 @@ endif () ################################################################### ######### Following is for submission to CDash ############ ################################################################### -set (MODEL "Experimental") +if (NOT DEFINED MODEL) + set (MODEL "Experimental") +endif () + ################################################################### ################################################################### diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index d4cc996..45877d7 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -33,12 +33,8 @@ ############################################################################################# #### fortran enabled #### #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") - ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") #### fortran disabled #### set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") - ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN -set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF") ############################################################################################# #### java enabled #### @@ -69,7 +65,7 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### package examples #### -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.9-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.12.4-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# ### enable parallel builds diff --git a/config/cmake/scripts/HPC/par-HDF5options.cmake b/config/cmake/scripts/HPC/par-HDF5options.cmake new file mode 100644 index 0000000..c7b22b9 --- /dev/null +++ b/config/cmake/scripts/HPC/par-HDF5options.cmake @@ -0,0 +1,126 @@ +# +# 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://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +############################################################################################# +#### Change default configuration of options in config/cmake/cacheinit.cmake file ### +#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### +############################################################################################# + +### uncomment/comment and change the following lines for other configuration options + +############################################################################################# +#### maximum parallel processor count for build and test #### +set (MAX_PROC_COUNT 8) + +############################################################################################# +#### alternate toolsets #### +#set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") + +############################################################################################# +#### Only build static libraries #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") +#### Add PICC option on linux/mac #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + +############################################################################################# +#### fortran enabled #### +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") +#### fortran disabled #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + +############################################################################################# +#### java enabled #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON") +#### java disabled #### +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + +############################################################################################# +### change install prefix (default use INSTALLDIR value) +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") + +############################################################################################# +#### ext libraries #### + +### ext libs from tgz +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") +### ext libs from git +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") +### ext libs on system +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=NO") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") + +### disable using ext zlib +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") +### disable using ext szip +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") + +#### package examples #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.12.4-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") + +############################################################################################# +### enable parallel builds + +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") + +############################################################################################# +### enable thread-safety builds + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF") + +############################################################################################# +### disable test program builds + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") + +############################################################################################# +### disable packaging + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") +### Create install package with external libraries (szip, zlib) +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") + + +#options to run test scripts in batch commands +set (LOCAL_BATCH_SCRIPT_COMMAND "sbatch") +set (LOCAL_BATCH_TEST "TRUE") +set (LOCAL_BATCH_SCRIPT_NAME "ctestS.sl") +set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "ctestP.sl") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_TEST:BOOL=ON") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=ctestS.sl") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=ctestP.sl") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_EXECUTABLE:STRING=srun") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_NUMPROC_FLAG:STRING=-n") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_MAX_NUMPROCS:STRING=6") + + +############################################################################################# +### use a toolchain file + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/GCC.cmake") + +#some additions and alternatives to cross compile on haswell for knl +#set (COMPILENODE_HWCOMPILE_MODULE "craype-haswell") +#set (COMPUTENODE_HWCOMPILE_MODULE "craype-mic-knl") +#set (SITE_BUILDNAME_SUFFIX "knl-intel17-SHARED" +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=knl_ctestS.sl") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=knl_ctestP.sl") +############################################################################################# diff --git a/config/cmake/scripts/HPC/ser-HDF5options.cmake b/config/cmake/scripts/HPC/ser-HDF5options.cmake new file mode 100644 index 0000000..7f2e96f --- /dev/null +++ b/config/cmake/scripts/HPC/ser-HDF5options.cmake @@ -0,0 +1,119 @@ +# +# 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://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +############################################################################################# +#### Change default configuration of options in config/cmake/cacheinit.cmake file ### +#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### +############################################################################################# + +### uncomment/comment and change the following lines for other configuration options + +############################################################################################# +#### maximum parallel processor count for build and test #### +#set (MAX_PROC_COUNT 8) + +############################################################################################# +#### alternate toolsets #### +#set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") + +############################################################################################# +#### Only build static libraries #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") +#### Add PICC option on linux/mac #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + +############################################################################################# +#### fortran enabled #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") +#### fortran disabled #### +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + +############################################################################################# +#### java enabled #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON") +#### java disabled #### +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + +############################################################################################# +### change install prefix (default use INSTALLDIR value) +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") + +############################################################################################# +#### ext libraries #### + +### ext libs from tgz +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") +### ext libs from git +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") +### ext libs on system +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=NO") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") + +### disable using ext zlib +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") +### disable using ext szip +#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") + +#### package examples #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.12.4-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") + +############################################################################################# +### enable parallel builds + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") + +############################################################################################# +### enable thread-safety builds + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF") + +############################################################################################# +### disable test program builds + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") + +############################################################################################# +### disable packaging + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") +### Create install package with external libraries (szip, zlib) +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") + +#options to run test scripts in batch commands +set (LOCAL_BATCH_SCRIPT_COMMAND "sbatch") +set (LOCAL_BATCH_TEST "TRUE") +set (LOCAL_BATCH_SCRIPT_NAME "ctestS.sl") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_TEST:BOOL=ON") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=ctestS.sl") + +############################################################################################# +### use a toolchain file + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/GCC.cmake") + +#some additions and alternatives to cross compile on haswell for knl +#set (COMPILENODE_HWCOMPILE_MODULE "craype-haswell") +#set (COMPUTENODE_HWCOMPILE_MODULE "craype-mic-knl") +#set (SITE_BUILDNAME_SUFFIX "knl-intel17-SHARED" +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=knl_ctestS.sl") + +############################################################################################# diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 95a4c40..b616958 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -60,7 +60,7 @@ if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) endif () # if the return value is !=${TEST_EXPECT} bail out -if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") +if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM) diff --git a/config/cmake/volTest.cmake b/config/cmake/volTest.cmake index 27da8a5..d8c82a4 100644 --- a/config/cmake/volTest.cmake +++ b/config/cmake/volTest.cmake @@ -60,7 +60,7 @@ if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () # if the return value is !=${TEST_EXPECT} bail out -if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") +if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.out) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.out TEST_STREAM) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 40f1440..986280f 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -70,7 +70,7 @@ if (WIN32) set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") endif () set (${HDF_PREFIX}_HAVE_WIN32_API 1) - set (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") + set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") if (NOT UNIX AND NOT MINGW) set (WINDOWS 1) set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") @@ -109,6 +109,78 @@ endif () # END of WINDOWS Hard code Values # ---------------------------------------------------------------------- +if (NOT WINDOWS) + TEST_BIG_ENDIAN (${HDF_PREFIX}_WORDS_BIGENDIAN) +endif () + +#----------------------------------------------------------------------------- +# Check IF header file exists and add it to the list. +#----------------------------------------------------------------------------- +macro (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) + CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE}) + if (${VARIABLE}) + set (USE_INCLUDES ${USE_INCLUDES} ${FILE}) + endif () +endmacro () + +#----------------------------------------------------------------------------- +# Check for the existence of certain header files +#----------------------------------------------------------------------------- +CHECK_INCLUDE_FILE_CONCAT ("sys/file.h" ${HDF_PREFIX}_HAVE_SYS_FILE_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" ${HDF_PREFIX}_HAVE_SYS_IOCTL_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" ${HDF_PREFIX}_HAVE_SYS_RESOURCE_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" ${HDF_PREFIX}_HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" ${HDF_PREFIX}_HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) +CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) +CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H) +CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) +CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) +CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) + +# Darwin +CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H) + +# Windows +CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) +if (NOT CYGWIN) + CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) +endif () +CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" ${HDF_PREFIX}_HAVE_SYS_TIMEB_H) + +if (CMAKE_SYSTEM_NAME MATCHES "OSF") + CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H) + CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H) +else () + set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) + set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) +endif () + +CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) +CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) +CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) +CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" ${HDF_PREFIX}_HAVE_SRBCLIENT_H) +CHECK_INCLUDE_FILE_CONCAT ("string.h" ${HDF_PREFIX}_HAVE_STRING_H) +CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H) +CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H) +CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H) +CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H) +CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H) +CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H) +# _Bool type support +CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) + +## Check for non-standard extenstion quadmath.h + +CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH) +if (${C_HAVE_QUADMATH}) + set(${HDF_PREFIX}_HAVE_QUADMATH_H 1) +else () + set(${HDF_PREFIX}_HAVE_QUADMATH_H 0) +endif () + if (CYGWIN) set (${HDF_PREFIX}_HAVE_LSEEK64 0) endif () @@ -127,17 +199,13 @@ endif () CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname ${HDF_PREFIX}_HAVE_LIBUCB) # For other tests to use the same libraries -set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS}) +set (HDF5_REQUIRED_LIBRARIES ${HDF5_REQUIRED_LIBRARIES} ${LINK_LIBS}) set (USE_INCLUDES "") if (WINDOWS) set (USE_INCLUDES ${USE_INCLUDES} "windows.h") endif () -if (NOT WINDOWS) - TEST_BIG_ENDIAN (${HDF_PREFIX}_WORDS_BIGENDIAN) -endif () - # For other specific tests, use this MACRO. macro (HDF_FUNCTION_TEST OTHER_TEST) if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST}) @@ -165,7 +233,7 @@ macro (HDF_FUNCTION_TEST OTHER_TEST) ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}" - LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" + LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" OUTPUT_VARIABLE OUTPUT ) if (${OTHER_TEST}) @@ -188,63 +256,6 @@ endmacro () HDF_FUNCTION_TEST (STDC_HEADERS) #----------------------------------------------------------------------------- -# Check IF header file exists and add it to the list. -#----------------------------------------------------------------------------- -macro (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) - CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE}) - if (${VARIABLE}) - set (USE_INCLUDES ${USE_INCLUDES} ${FILE}) - endif () -endmacro () - -#----------------------------------------------------------------------------- -# Check for the existence of certain header files -#----------------------------------------------------------------------------- -CHECK_INCLUDE_FILE_CONCAT ("sys/file.h" ${HDF_PREFIX}_HAVE_SYS_FILE_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" ${HDF_PREFIX}_HAVE_SYS_IOCTL_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" ${HDF_PREFIX}_HAVE_SYS_RESOURCE_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" ${HDF_PREFIX}_HAVE_SYS_SOCKET_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" ${HDF_PREFIX}_HAVE_SYS_STAT_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H) -CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) -CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) -CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H) -CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) -CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) -CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) - -# Darwin -CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H) - -# Windows -CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) -if (NOT CYGWIN) - CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) -endif () -CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" ${HDF_PREFIX}_HAVE_SYS_TIMEB_H) - -if (CMAKE_SYSTEM_NAME MATCHES "OSF") - CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H) - CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H) -else () - set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) - set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) -endif () - -CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) -CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) -CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) -CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" ${HDF_PREFIX}_HAVE_SRBCLIENT_H) -CHECK_INCLUDE_FILE_CONCAT ("string.h" ${HDF_PREFIX}_HAVE_STRING_H) -CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H) -CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H) -CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H) -CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H) -CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H) -CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H) - -#----------------------------------------------------------------------------- # Check for large file support #----------------------------------------------------------------------------- @@ -263,10 +274,12 @@ if (NOT WINDOWS) # functionality so clock_gettime and CLOCK_MONOTONIC are defined # correctly. This was later updated to 200112L so that # posix_memalign() is visible for the direct VFD code on Linux - # systems. + # systems. Even later, this was changed to 200809L to support + # pread/pwrite in VFDs. + # # POSIX feature information can be found in the gcc manual at: # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html - set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200112L) + set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L) # Need to add this so that O_DIRECT is visible for the direct # VFD on Linux systems. @@ -402,13 +415,13 @@ HDF_CHECK_TYPE_SIZE (off64_t ${HDF_PREFIX}_SIZEOF_OFF64_T) if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) set (${HDF_PREFIX}_SIZEOF_OFF64_T 0) endif () +HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T) #----------------------------------------------------------------------------- # Extra C99 types #----------------------------------------------------------------------------- # _Bool type support -CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) if (HAVE_STDBOOL_H) set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h) HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL) @@ -495,6 +508,8 @@ CHECK_FUNCTION_EXISTS (lround ${HDF_PREFIX}_HAVE_LROUND) CHECK_FUNCTION_EXISTS (lroundf ${HDF_PREFIX}_HAVE_LROUNDF) CHECK_FUNCTION_EXISTS (lstat ${HDF_PREFIX}_HAVE_LSTAT) +CHECK_FUNCTION_EXISTS (pread ${HDF_PREFIX}_HAVE_PREAD) +CHECK_FUNCTION_EXISTS (pwrite ${HDF_PREFIX}_HAVE_PWRITE) CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R) CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM) CHECK_FUNCTION_EXISTS (round ${HDF_PREFIX}_HAVE_ROUND) @@ -580,7 +595,7 @@ if (WINDOWS) ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${MACRO_CHECK_FUNCTION_DEFINITIONS}" - LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" + LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" CMAKE_FLAGS "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}" COMPILE_OUTPUT_VARIABLE OUTPUT ) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 147ae2f..2f4ce52 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -14,7 +14,7 @@ macro (SET_HDF_BUILD_TYPE) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - set(HDF_CFG_NAME ${CTEST_CONFIGURATION_TYPE}) + set(HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) set(HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR}) set(HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) else() @@ -170,7 +170,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${CMAKE_BUILD_TYPE} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) @@ -273,7 +273,7 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017") - endif () + endif () else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") endif () diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake index f293ec5..efaa556 100644 --- a/config/cmake_ext_mod/HDFUseCXX.cmake +++ b/config/cmake_ext_mod/HDFUseCXX.cmake @@ -48,8 +48,8 @@ macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) if (NOT DEFINED ${OTHER_TEST}) set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") set (OTHER_TEST_ADD_LIBRARIES) - if (CMAKE_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + if (HDF5_REQUIRED_LIBRARIES) + set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}") endif () foreach (def diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index f8f3cea..c68c921 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -48,9 +48,9 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}") #----------------------------------------------------------------------------- macro (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) message (STATUS "Testing Fortran ${FUNCTION}") - if (CMAKE_REQUIRED_LIBRARIES) + if (HDF5_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}") else () set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index b812d73..1417204 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -57,15 +57,15 @@ file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) # TEST_REFERENCE should always be matched string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) -if ("${TEST_RESULT}" STREQUAL "0") +if (NOT TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) -if ("${TEST_EXPECT}" STREQUAL "1") - # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match +if (TEST_EXPECT) + # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif () endif () diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 026131b..48402a2 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -80,7 +80,7 @@ if (TEST_REGEX) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) string (REGEX MATCH "${TEST_REGEX}" REGEX_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${REGEX_MATCH}" "${TEST_MATCH}" REGEX_RESULT) - if ("${REGEX_RESULT}" STREQUAL "0") + if (NOT REGEX_RESULT) message (STATUS "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_MATCH}") endif () endif () @@ -111,7 +111,7 @@ if (TEST_APPEND) endif () # if the return value is !=${TEST_EXPECT} bail out -if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") +if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) @@ -126,7 +126,7 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) string (FIND TEST_STREAM "_pmi_alps" "${TEST_FIND_RESULT}") -if ("${TEST_FIND_RESULT}" GREATER "0") +if (TEST_FIND_RESULT GREATER 0) string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) endif () @@ -207,33 +207,33 @@ if (NOT TEST_SKIP_COMPARE) endif () endif () - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) list (LENGTH test_ref len_ref) - if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") + if (len_act GREATER 0 AND len_ref GREATER 0) math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") + if (NOT ${str_act} STREQUAL ${str_ref}) + if (NOT str_act STREQUAL "") set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () endforeach () else () - if ("${len_act}" STREQUAL "0") + if (len_act EQUAL 0) message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if ("${len_ref}" STREQUAL "0") + if (len_ref EQUAL 0) message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () endif () - if (NOT "${len_act}" STREQUAL "${len_ref}") + if (NOT len_act EQUAL len_ref) set (TEST_RESULT 1) endif () endif () @@ -241,7 +241,7 @@ if (NOT TEST_SKIP_COMPARE) message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () endif () @@ -258,34 +258,34 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} RESULT_VARIABLE TEST_RESULT ) - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") + if (len_act GREATER 0 AND len_ref GREATER 0) math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") + if (NOT ${str_act} STREQUAL ${str_ref}) + if (NOT ${str_act} STREQUAL "") set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () endforeach () else () - if ("${len_act}" STREQUAL "0") + if (len_act EQUAL 0) message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") endif () - if ("${len_ref}" STREQUAL "0") + if (len_ref EQUAL 0) message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () endif () - if (NOT "${len_act}" STREQUAL "${len_ref}") + if (NOT len_act EQUAL len_ref) set (TEST_RESULT 1) endif () endif () @@ -293,7 +293,7 @@ if (NOT TEST_SKIP_COMPARE) message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") endif () endif () @@ -306,15 +306,15 @@ if (TEST_GREP_COMPARE) # TEST_REFERENCE should always be matched string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) - if ("${TEST_RESULT}" STREQUAL "0") + if (NOT TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) - if ("${TEST_EXPECT}" STREQUAL "1") - # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match + if (TEST_EXPECT) + # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (NOT "${TEST_RESULT}" STREQUAL "0") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif () endif () diff --git a/config/toolchain/GCC.cmake b/config/toolchain/GCC.cmake index ddb1641..c41d0ca 100644 --- a/config/toolchain/GCC.cmake +++ b/config/toolchain/GCC.cmake @@ -1,5 +1,6 @@ -# Uncomment the following to use cross-compiling +# Uncomment the following line and the correct system name to use cross-compiling #set(CMAKE_SYSTEM_NAME Linux) + set(CMAKE_COMPILER_VENDOR "GCC") set(CMAKE_C_COMPILER cc) diff --git a/config/toolchain/PGI.cmake b/config/toolchain/PGI.cmake new file mode 100644 index 0000000..ec58cbb --- /dev/null +++ b/config/toolchain/PGI.cmake @@ -0,0 +1,11 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) + +set(CMAKE_COMPILER_VENDOR "PGI") + +set(CMAKE_C_COMPILER pgcc) +set(CMAKE_CXX_COMPILER pgc++) +set(CMAKE_Fortran_COMPILER pgf90) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/config/toolchain/crayle.cmake b/config/toolchain/crayle.cmake index a83147b..159f43a 100644 --- a/config/toolchain/crayle.cmake +++ b/config/toolchain/crayle.cmake @@ -1,5 +1,6 @@ -# Uncomment the following to use cross-compiling +# The following line will use cross-compiling set(CMAKE_SYSTEM_NAME Linux) + set(CMAKE_COMPILER_VENDOR "CrayLinuxEnvironment") set(CMAKE_C_COMPILER cc) @@ -14,7 +15,6 @@ set(HDF5_USE_PREGEN OFF) #set(HDF5_USE_PREGEN_DIR "/lscratch1/lknox/HDF5_1_10_4/CMake-hdf5-1.10.4") # option to generate H5Tinit.c by running H5detect on knl compute node during build -set(HDF5_BATCH_H5DETECT ON) -set(HDF5_BATCH_CMD "sbatch") -set(HDF5_BATCH_H5DETECT_SCRIPT "knl_H5detect.sl") -set(MPIEXEC_EXECUTABLE "srun") +#set(HDF5_BATCH_H5DETECT ON) +#set(HDF5_BATCH_CMD "sbatch") +#set(HDF5_BATCH_H5DETECT_SCRIPT "knl_H5detect.sl") diff --git a/config/toolchain/intel.cmake b/config/toolchain/intel.cmake index f1a5734..97f6a64 100644 --- a/config/toolchain/intel.cmake +++ b/config/toolchain/intel.cmake @@ -1,5 +1,6 @@ # Uncomment the following to use cross-compiling #set(CMAKE_SYSTEM_NAME Linux) + set(CMAKE_COMPILER_VENDOR "intel") set(CMAKE_C_COMPILER icc) diff --git a/configure.ac b/configure.ac index eb32435..30fe725 100644 --- a/configure.ac +++ b/configure.ac @@ -1130,11 +1130,12 @@ case "$host_cpu-$host_vendor-$host_os" in ## functionality so clock_gettime and CLOCK_MONOTONIC are defined ## correctly. This was later updated to 200112L so that ## posix_memalign() is visible for the direct VFD code on Linux - ## systems. + ## systems. Even later, this was changed to 200809L to support + ## pread/pwrite in VFDs. ## ## POSIX feature information can be found in the gcc manual at: ## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html - H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS" + H5_CPPFLAGS="-D_POSIX_C_SOURCE=200809L $H5_CPPFLAGS" ## Need to add this so that O_DIRECT is visible for the direct ## VFD on Linux systems. @@ -1210,6 +1211,15 @@ EOF AC_CHECK_SIZEOF([bool]) fi +AC_CHECK_SIZEOF(time_t, [], [ +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_TIME_H +#include <time.h> +#endif +]) + ## Checkpoint the cache AC_CACHE_SAVE @@ -2960,6 +2970,30 @@ else fi ## ---------------------------------------------------------------------- +## Set the flag to indicate that the machine is IBM ppc64le and cannot +## accurately convert some long double values. +## +AC_MSG_CHECKING([if the system is IBM ppc64le and cannot correctly convert some long double values]) + +TEST_SRC="`(echo \"#define H5_DISABLE_SOME_LDOUBLE_CONV_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" + +if test ${ac_cv_sizeof_long_double} = 0; then + hdf5_cv_disable_some_ldouble_conv=${hdf5_cv_disable_some_ldouble_conv=no} +else + AC_CACHE_VAL([hdf5_cv_disable_some_ldouble_conv], + [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], + [hdf5_cv_disable_some_ldouble_conv=yes], [hdf5_cv_disable_some_ldouble_conv=no],[])]) +fi + +if test ${hdf5_cv_disable_some_ldouble_conv} = "yes"; then + AC_DEFINE([DISABLE_SOME_LDOUBLE_CONV], [1], + [Define if your system is IBM ppc64le and cannot convert some long double values correctly.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +## ---------------------------------------------------------------------- ## Set some variables for general configuration information to be saved ## and installed with the libraries (used to generate libhdf5.settings). ## @@ -3233,6 +3267,47 @@ esac ## ---------------------------------------------------------------------- +## Enable use of pread/pwrite instead of read/write in certain VFDs. +## +AC_SUBST([PREADWRITE]) + +## Check these first to avoid interspersed output in the AC_ARG_ENABLE line +## below. (Probably overkill to check for both, but we'll be extra careful) +PREADWRITE_HAVE_BOTH=yes +AC_CHECK_FUNC([pread], [], [PREADWRITE_HAVE_BOTH=no]) +AC_CHECK_FUNC([pwrite], [], [PREADWRITE_HAVE_BOTH=no]) + +AC_MSG_CHECKING([whether to use pread/pwrite instead of read/write in certain VFDs]) +AC_ARG_ENABLE([preadwrite], + [AS_HELP_STRING([--enable-preadwrite], + [Enable using pread/pwrite instead of read/write in sec2/log/core VFDs. + [default=yes if pread/pwrite are present]])], + [PREADWRITE=$enableval]) + +## Set the default level. +if test "X-$PREADWRITE" = X- ; then + PREADWRITE=yes +fi + +case "X-$PREADWRITE" in + X-yes) + if test "X-$PREADWRITE_HAVE_BOTH" = "X-yes"; then + AC_DEFINE([HAVE_PREADWRITE], [1], [Define if both pread and pwrite exist.]) + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + X-no) + AC_MSG_RESULT([no]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $PREADWRITE]) + ;; +esac + + +## ---------------------------------------------------------------------- ## Enable embedded library information ## AC_MSG_CHECKING([whether to have library information embedded in the executables]) @@ -3399,6 +3474,7 @@ AC_CONFIG_FILES([src/libhdf5.settings src/Makefile test/Makefile test/H5srcdir_str.h + test/testabort_fail.sh test/testcheck_version.sh test/testerror.sh test/testflushrefresh.sh @@ -3406,7 +3482,6 @@ AC_CONFIG_FILES([src/libhdf5.settings test/testlinks_env.sh test/testswmr.sh test/testvdsswmr.sh - test/test_filenotclosed.sh test/test_filter_plugin.sh test/test_usecases.sh test/test_vol_plugin.sh diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 6b4504b..dd1e03b 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -181,17 +181,17 @@ ### Windows pops up a modal permission dialog on this test if (H5_HAVE_PARALLEL AND NOT WIN32) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES_PAR-ph5example COMMAND $<TARGET_FILE:ph5example>) + add_test (NAME EXAMPLES_PAR-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5example> ${MPIEXEC_POSTFLAGS}) else () add_test (NAME EXAMPLES_PAR-ph5example COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:ph5example>" + -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5example>;${MPIEXEC_POSTFLAGS}" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=ph5example.txt" - #-D "TEST_REFERENCE=ph5example.out" + -D "TEST_OUTPUT=ph5example.out" + -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors" + -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) endif () if (NOT "${last_test}" STREQUAL "") @@ -200,17 +200,17 @@ set (last_test "EXAMPLES_PAR-ph5example") if (BUILD_SHARED_LIBS) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES_PAR-shared-ph5example COMMAND $<TARGET_FILE:ph5example-shared>) + add_test (NAME EXAMPLES_PAR-shared-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5example-shared> ${MPIEXEC_POSTFLAGS}) else () add_test (NAME EXAMPLES_PAR-shared-ph5example COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:ph5example-shared>" + -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5example-shared>;${MPIEXEC_POSTFLAGS}" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=ph5example-shared.txt" - #-D "TEST_REFERENCE=ph5example-shared.out" + -D "TEST_OUTPUT=ph5example-shared.out" + -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors" + -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) endif () set_tests_properties (EXAMPLES_PAR-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index c3d94b4..323cf91 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -109,48 +109,46 @@ foreach (example ${examples}) endif () endforeach () -if (HDF5_ENABLE_F2003) - foreach (example ${F2003_examples}) +foreach (example ${F2003_examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f03_ex_${example} COMMAND $<TARGET_FILE:f03_ex_${example}>) + else () + add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f03_ex_${example}.txt" + #-D "TEST_REFERENCE=f03_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "f03_ex_${example}") + if (BUILD_SHARED_LIBS) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex_${example} COMMAND $<TARGET_FILE:f03_ex_${example}>) + add_test (NAME f03_ex-shared_${example} COMMAND $<TARGET_FILE:f03_ex_${example}-shared>) else () - add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}>" + add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}-shared>" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}.txt" - #-D "TEST_REFERENCE=f03_ex_${example}.out" + -D "TEST_OUTPUT=f03_ex_${example}-shared.txt" + #-D "TEST_REFERENCE=f03_ex_${example}-shared.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "f03_ex_${example}") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex-shared_${example} COMMAND $<TARGET_FILE:f03_ex_${example}-shared>) - else () - add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}-shared.txt" - #-D "TEST_REFERENCE=f03_ex_${example}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f03_ex-shared_${example}") - endif () - endforeach () -endif () + set (last_test "f03_ex-shared_${example}") + endif () +endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS}) diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in index da0c357..aa17f89 100644 --- a/fortran/examples/run-fortran-ex.sh.in +++ b/fortran/examples/run-fortran-ex.sh.in @@ -61,8 +61,6 @@ RunTest() ./$TEST_EXEC } -F2003_ENABLED=@HAVE_FORTRAN_2003@ - ################## MAIN ################## # Run tests @@ -97,17 +95,8 @@ then RunTest mountexample &&\ rm mountexample &&\ RunTest compound &&\ - rm compound); then - EXIT_VALUE=${EXIT_SUCCESS} - else - EXIT_VALUE=${EXIT_FAILURE} - fi -fi - -if [ $EXIT_VALUE -eq ${EXIT_SUCCESS} -a "$F2003_ENABLED" = "yes" ] -then -# Add attention tests for Fortran 2003 features - if (RunTest rwdset_fortran2003 &&\ + rm compound &&\ + RunTest rwdset_fortran2003 &&\ rm rwdset_fortran2003 &&\ RunTest nested_derived_type &&\ rm nested_derived_type &&\ @@ -120,12 +109,11 @@ then EXIT_VALUE=${EXIT_FAILURE} fi fi - # Cleanup rm *.o rm *.h5 echo -exit $EXIT_VALUE +exit $EXIT_VALUE diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 025fab5..f71e820 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -9,11 +9,7 @@ if (WIN32) if (NOT H5_HAVE_PARALLEL) set (H5_NOPAREXP ";") endif () - if (NOT HDF5_ENABLE_F2003) - set (H5_NOF03EXP ";") - else () - set (H5_F03EXP ";") - endif () + set (H5_F03EXP ";") configure_file (${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def.in ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def @ONLY) endif () endif () diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index 9c8b941..cc51f37 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -946,4 +946,97 @@ CONTAINS END SUBROUTINE h5fget_file_image_f +!****s* H5F (F03)/h5fget_dset_no_attrs_hint_f_F03 +! +! NAME +! h5fget_dset_no_attrs_hint_f +! +! PURPOSE +! Gets the value of the "minimize dataset headers" value which creates +! smaller dataset object headers when its set and no attributes are present. +! +! INPUTS +! file_id - Target file identifier. +! +! OUTPUTS +! minimize - Value of the setting. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! January 2019 +! +! Fortran2003 Interface: + SUBROUTINE h5fget_dset_no_attrs_hint_f(file_id, minimize, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: file_id + LOGICAL , INTENT(OUT) :: minimize + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_minimize + + INTERFACE + INTEGER FUNCTION h5fget_dset_no_attrs_hint_c(file_id, minimize) BIND(C, NAME='H5Fget_dset_no_attrs_hint') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: file_id + LOGICAL(C_BOOL), INTENT(OUT) :: minimize + END FUNCTION h5fget_dset_no_attrs_hint_c + END INTERFACE + + hdferr = INT(h5fget_dset_no_attrs_hint_c(file_id, c_minimize)) + + ! Transfer value of C C_BOOL type to Fortran LOGICAL + minimize = c_minimize + + END SUBROUTINE h5fget_dset_no_attrs_hint_f + +!****s* H5F (F03)/h5fset_dset_no_attrs_hint_f_F03 +! +! NAME +! h5fset_dset_no_attrs_hint_f +! +! PURPOSE +! Sets the value of the "minimize dataset headers" value which creates +! smaller dataset object headers when its set and no attributes are present. +! +! INPUTS +! file_id - Target file identifier. +! minimize - Value of the setting. +! +! OUTPUTS +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! January 2019 +! +! Fortran2003 Interface: + SUBROUTINE h5fset_dset_no_attrs_hint_f(file_id, minimize, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: file_id + LOGICAL , INTENT(IN) :: minimize + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_minimize + + INTERFACE + INTEGER FUNCTION h5fset_dset_no_attrs_hint_c(file_id, minimize) BIND(C, NAME='H5Fset_dset_no_attrs_hint') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: file_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: minimize + END FUNCTION h5fset_dset_no_attrs_hint_c + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C C_BOOL type + c_minimize = minimize + + hdferr = INT(h5fset_dset_no_attrs_hint_c(file_id, c_minimize)) + + END SUBROUTINE h5fset_dset_no_attrs_hint_f + END MODULE H5F + diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 45b7f09..08305ea 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -27,11 +27,15 @@ fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info); int_f fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { + /* This function does not used the field parameter because we want + * this function to fill the unfilled fields with C's default values. + */ + struct tm *ts; object_info->fileno = Oinfo.fileno; object_info->addr = (haddr_t_f)Oinfo.addr; - + object_info->type = (int_f)Oinfo.type; object_info->rc = (int_f)Oinfo.rc; @@ -96,6 +100,8 @@ fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; + object_info->meta_size.attr.index_size = (hsize_t_f)Oinfo.meta_size.attr.index_size; + object_info->meta_size.attr.heap_size = (hsize_t_f)Oinfo.meta_size.attr.heap_size; return 0; @@ -138,7 +144,7 @@ h5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen * Call H5Olink function. */ if((hid_t_f)H5Olink((hid_t)*object_id, (hid_t)*new_loc_id, c_name, - (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0) + (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); done: @@ -229,6 +235,7 @@ h5oclose_c ( hid_t_f *object_id ) * idx - Iteration position at which to start * op - Callback function passing data regarding the link to the calling application * op_data - User-defined pointer to data required by the application for its processing of the link + * fields - Flags specifying the fields to include in object_info. * * OUTPUTS * idx - Position at which an interrupted iteration may be restarted @@ -241,7 +248,7 @@ h5oclose_c ( hid_t_f *object_id ) * SOURCE */ int_f -h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data ) +h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data, int_f *fields ) /******/ { int_f ret_value = -1; /* Return value */ @@ -250,7 +257,8 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, /* * Call H5Ovisit2 */ - func_ret_value = H5Ovisit2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, H5O_INFO_ALL); + + func_ret_value = H5Ovisit2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)*fields); ret_value = (int_f)func_ret_value; @@ -302,6 +310,7 @@ h5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) * name - Name of group, relative to loc_id. * namelen - Name length. * lapl_id - Link access property list. + * fields - Flags specifying the fields to include in object_info. * OUTPUTS * object_info - Buffer in which to return object information. * @@ -314,7 +323,7 @@ h5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) */ int_f h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, - H5O_info_t_f *object_info) + H5O_info_t_f *object_info, int_f *fields) /******/ { char *c_name = NULL; /* Buffer to hold C string */ @@ -331,10 +340,10 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l * Call H5Oinfo_by_name function. */ if(H5Oget_info_by_name2((hid_t)*loc_id, c_name, - &Oinfo, H5O_INFO_ALL, (hid_t)*lapl_id) < 0) + &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); - ret_value = fill_h5o_info_t_f(Oinfo,object_info); + ret_value = fill_h5o_info_t_f(Oinfo, object_info); done: if(c_name) @@ -354,6 +363,7 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l * lapl_id - Link access property list. * OUTPUTS * object_info - Buffer in which to return object information. + * fields - Flags specifying the fields to include in object_info. * * RETURNS * 0 on success, -1 on failure @@ -364,7 +374,7 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l */ int_f h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, - int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info) + int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields) /******/ { char *c_group_name = NULL; /* Buffer to hold C string */ @@ -386,7 +396,7 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, * Call H5Oinfo_by_idx function. */ if(H5Oget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, - &Oinfo, H5O_INFO_ALL, (hid_t)*lapl_id) < 0) + &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -404,6 +414,7 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, * Calls H5Oget_info * INPUTS * object_id - Identifier for target object. + * fields - Flags specifying the fields to include in object_info. * OUTPUTS * object_info - Buffer in which to return object information. * @@ -415,7 +426,7 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, * SOURCE */ int_f -h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) +h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields) /******/ { int_f ret_value = 0; /* Return value */ @@ -424,7 +435,7 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info2((hid_t)*object_id, &Oinfo, H5O_INFO_ALL) < 0) + if(H5Oget_info2((hid_t)*object_id, &Oinfo, (unsigned)*fields) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -457,8 +468,8 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) */ int_f h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, - hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len, - hid_t_f *ocpypl_id, hid_t_f *lcpl_id ) + hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len, + hid_t_f *ocpypl_id, hid_t_f *lcpl_id ) /******/ { char *c_src_name = NULL; /* Buffer to hold C string */ @@ -478,7 +489,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, * Call H5Ocopy function. */ if(H5Ocopy( (hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, - (hid_t)*ocpypl_id, (hid_t)*lcpl_id) < 0) + (hid_t)*ocpypl_id, (hid_t)*lcpl_id) < 0) HGOTO_DONE(FAIL); done: @@ -503,6 +514,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, * idx - Iteration position at which to start * op - Callback function passing data regarding the link to the calling application * op_data - User-defined pointer to data required by the application for its processing of the link + * fields - Flags specifying the fields to include in object_info. * * OUTPUTS * idx - Position at which an interrupted iteration may be restarted @@ -516,7 +528,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, */ int_f h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, - H5O_iterate_t op, void *op_data, hid_t_f *lapl_id ) + H5O_iterate_t op, void *op_data, hid_t_f *lapl_id, int_f *fields ) /******/ { int_f ret_value = -1; /* Return value */ @@ -533,7 +545,7 @@ h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f * Call H5Ovisit */ func_ret_value = H5Ovisit_by_name2( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, - op, op_data, H5O_INFO_ALL, (hid_t)*lapl_id); + op, op_data, (unsigned)*fields, (hid_t)*lapl_id); ret_value = (int_f)func_ret_value; done: @@ -763,7 +775,7 @@ h5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fc */ int_f h5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, - int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id) + int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id) /******/ { char *c_group_name = NULL; /* Buffer to hold C string */ @@ -868,7 +880,7 @@ h5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssi */ int_f h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, - _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id) + _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id) /******/ { char *c_comment = NULL; /* Buffer to hold C string */ diff --git a/fortran/src/H5Off.F90 b/fortran/src/H5Off.F90 index 243ec29..8c77230 100644 --- a/fortran/src/H5Off.F90 +++ b/fortran/src/H5Off.F90 @@ -69,6 +69,15 @@ MODULE H5O TYPE(mesg_t) :: mesg END TYPE hdr_t + TYPE, BIND(C) :: c_hdr_t + INTEGER(C_INT) :: version ! Version number of header format in file + INTEGER(C_INT) :: nmesgs ! Number of object header messages + INTEGER(C_INT) :: nchunks ! Number of object header chunks + INTEGER(C_INT) :: flags ! Object header status flags + TYPE(space_t) :: space + TYPE(mesg_t) :: mesg + END TYPE c_hdr_t + ! Extra metadata storage for obj & attributes TYPE, BIND(C) :: H5_ih_info_t INTEGER(hsize_t) :: index_size ! btree and/or list @@ -83,7 +92,7 @@ MODULE H5O TYPE, BIND(C) :: h5o_info_t INTEGER(C_LONG) :: fileno ! File number that object is located in INTEGER(haddr_t) :: addr ! Object address in file - INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) + INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) INTEGER :: rc ! Reference count of object INTEGER, DIMENSION(8) :: atime ! Access time ! -- NOTE -- @@ -98,6 +107,28 @@ MODULE H5O TYPE(meta_size_t) :: meta_size END TYPE h5o_info_t +! C interoperable structure for h5o_info_t. The Fortran derived type returns the time +! values as an integer array as specified in the Fortran intrinsic DATE_AND_TIME(VALUES). +! Whereas, this derived type does not. + + TYPE, BIND(C) :: c_h5o_info_t + INTEGER(C_LONG) :: fileno ! File number that object is located in + INTEGER(haddr_t) :: addr ! Object address in file + INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) + INTEGER(C_INT) :: rc ! Reference count of object + + INTEGER(KIND=TIME_T) :: atime ! Access time + INTEGER(KIND=TIME_T) :: mtime ! modify time + INTEGER(KIND=TIME_T) :: ctime ! create time + INTEGER(KIND=TIME_T) :: btime ! Access time + + INTEGER(hsize_t) :: num_attrs ! # of attributes attached to object + + TYPE(c_hdr_t) :: hdr + + TYPE(meta_size_t) :: meta_size + END TYPE c_h5o_info_t + !***** CONTAINS @@ -834,12 +865,16 @@ CONTAINS ! return_value - returns the return value of the first operator that returns a positive value, or ! zero if all members were processed with no operator returning non-zero. ! hdferr - Returns 0 if successful and -1 if fails +! +! Optional parameters: +! fields - Flags specifying the fields to include in object_info. +! ! AUTHOR ! M. Scot Breitenfeld ! November 19, 2008 ! ! Fortran2003 Interface: - SUBROUTINE h5ovisit_f(object_id, index_type, order, op, op_data, return_value, hdferr) + SUBROUTINE h5ovisit_f(object_id, index_type, order, op, op_data, return_value, hdferr, fields) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: object_id INTEGER, INTENT(IN) :: index_type @@ -849,10 +884,12 @@ CONTAINS TYPE(C_PTR) :: op_data INTEGER, INTENT(OUT) :: return_value INTEGER, INTENT(OUT) :: hdferr + INTEGER, INTENT(IN), OPTIONAL :: fields !***** + INTEGER :: fields_c INTERFACE - INTEGER FUNCTION h5ovisit_c(object_id, index_type, order, op, op_data) & + INTEGER FUNCTION h5ovisit_c(object_id, index_type, order, op, op_data, fields) & BIND(C, NAME='h5ovisit_c') IMPORT :: C_FUNPTR, C_PTR IMPORT :: HID_T @@ -862,10 +899,14 @@ CONTAINS INTEGER, INTENT(IN) :: order TYPE(C_FUNPTR), VALUE :: op TYPE(C_PTR), VALUE :: op_data + INTEGER, INTENT(IN) :: fields END FUNCTION h5ovisit_c END INTERFACE - return_value = h5ovisit_c(object_id, index_type, order, op, op_data) + fields_c = H5O_INFO_ALL_F + IF(PRESENT(fields)) fields_c = fields + + return_value = h5ovisit_c(object_id, index_type, order, op, op_data, fields_c) IF(return_value.GE.0)THEN hdferr = 0 @@ -894,26 +935,29 @@ CONTAINS ! ! Optional parameters: ! lapl_id - Link access property list. +! fields - Flags specifying the fields to include in object_info. ! ! AUTHOR ! M. Scot Breitenfeld ! December 1, 2008 ! ! Fortran2003 Interface: - SUBROUTINE h5oget_info_by_name_f(loc_id, name, object_info, hdferr, lapl_id) + SUBROUTINE h5oget_info_by_name_f(loc_id, name, object_info, hdferr, lapl_id, fields) IMPLICIT NONE INTEGER(HID_T) , INTENT(IN) :: loc_id CHARACTER(LEN=*), INTENT(IN) :: name TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info INTEGER , INTENT(OUT) :: hdferr INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id + INTEGER , INTENT(IN) , OPTIONAL :: fields !***** INTEGER(SIZE_T) :: namelen INTEGER(HID_T) :: lapl_id_default TYPE(C_PTR) :: ptr + INTEGER :: fields_c INTERFACE - INTEGER FUNCTION h5oget_info_by_name_c(loc_id, name, namelen, lapl_id_default, object_info) & + INTEGER FUNCTION h5oget_info_by_name_c(loc_id, name, namelen, lapl_id_default, object_info, fields) & BIND(C, NAME='h5oget_info_by_name_c') IMPORT :: c_char, c_ptr IMPORT :: HID_T, SIZE_T @@ -923,10 +967,13 @@ CONTAINS INTEGER(SIZE_T) , INTENT(IN) :: namelen INTEGER(HID_T) , INTENT(IN) :: lapl_id_default TYPE(C_PTR),VALUE :: object_info - + INTEGER , INTENT(IN) :: fields END FUNCTION h5oget_info_by_name_c END INTERFACE + fields_c = H5O_INFO_ALL_F + IF(PRESENT(fields)) fields_c = fields + namelen = LEN(name) lapl_id_default = H5P_DEFAULT_F @@ -934,7 +981,7 @@ CONTAINS ptr = C_LOC(object_info) - hdferr = H5Oget_info_by_name_c(loc_id, name, namelen, lapl_id_default, ptr) + hdferr = H5Oget_info_by_name_c(loc_id, name, namelen, lapl_id_default, ptr, fields_c) END SUBROUTINE H5Oget_info_by_name_f @@ -953,34 +1000,43 @@ CONTAINS ! object_info - Buffer in which to return object information. ! hdferr - Returns 0 if successful and -1 if fails. ! +! Optional parameters: +! fields - Flags specifying the fields to include in object_info. +! ! AUTHOR ! M. Scot Breitenfeld ! May 11, 2012 ! ! Fortran2003 Interface: - SUBROUTINE h5oget_info_f(object_id, object_info, hdferr) + SUBROUTINE h5oget_info_f(object_id, object_info, hdferr, fields) USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE INTEGER(HID_T) , INTENT(IN) :: object_id TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info INTEGER , INTENT(OUT) :: hdferr + INTEGER , INTENT(IN), OPTIONAL :: fields !***** TYPE(C_PTR) :: ptr - + INTEGER :: fields_c + INTERFACE - INTEGER FUNCTION h5oget_info_c(object_id, object_info) & + INTEGER FUNCTION h5oget_info_c(object_id, object_info, fields) & BIND(C, NAME='h5oget_info_c') IMPORT :: C_PTR IMPORT :: HID_T IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: object_id TYPE(C_PTR), VALUE :: object_info + INTEGER, INTENT(IN) :: fields END FUNCTION h5oget_info_c END INTERFACE + fields_c = H5O_INFO_ALL_F + IF(PRESENT(fields)) fields_c = fields + ptr = C_LOC(object_info) - hdferr = H5Oget_info_c(object_id, ptr) + hdferr = H5Oget_info_c(object_id, ptr, fields_c) END SUBROUTINE H5Oget_info_f @@ -1006,6 +1062,7 @@ CONTAINS ! ! Optional parameters: ! lapl_id - Link access property list. (Not currently used.) +! fields - Flags specifying the fields to include in object_info. ! ! AUTHOR ! M. Scot Breitenfeld @@ -1013,7 +1070,7 @@ CONTAINS ! ! Fortran2003 Interface: SUBROUTINE h5oget_info_by_idx_f(loc_id, group_name, index_field, order, n, & - object_info, hdferr, lapl_id) + object_info, hdferr, lapl_id, fields) USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE @@ -1025,14 +1082,16 @@ CONTAINS TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info INTEGER , INTENT(OUT) :: hdferr INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id + INTEGER , INTENT(IN) , OPTIONAL :: fields !***** INTEGER(SIZE_T) :: namelen INTEGER(HID_T) :: lapl_id_default TYPE(C_PTR) :: ptr + INTEGER :: fields_c INTERFACE INTEGER FUNCTION h5oget_info_by_idx_c(loc_id, group_name, namelen, & - index_field, order, n, lapl_id_default, object_info) BIND(C, NAME='h5oget_info_by_idx_c') + index_field, order, n, lapl_id_default, object_info, fields) BIND(C, NAME='h5oget_info_by_idx_c') IMPORT :: c_char, c_ptr, c_funptr IMPORT :: HID_T, SIZE_T, HSIZE_T INTEGER(HID_T) , INTENT(IN) :: loc_id @@ -1043,17 +1102,20 @@ CONTAINS INTEGER(HSIZE_T), INTENT(IN) :: n INTEGER(HID_T) , INTENT(IN) :: lapl_id_default TYPE(C_PTR), VALUE :: object_info - + INTEGER, INTENT(IN) :: fields END FUNCTION h5oget_info_by_idx_c END INTERFACE + fields_c = H5O_INFO_ALL_F + IF(PRESENT(fields)) fields_c = fields + namelen = LEN(group_name) lapl_id_default = H5P_DEFAULT_F IF(PRESENT(lapl_id)) lapl_id_default = lapl_id ptr = C_LOC(object_info) - hdferr = H5Oget_info_by_idx_c(loc_id, group_name, namelen, index_field, order, n, lapl_id_default, ptr) + hdferr = H5Oget_info_by_idx_c(loc_id, group_name, namelen, index_field, order, n, lapl_id_default, ptr, fields_c) END SUBROUTINE H5Oget_info_by_idx_f @@ -1086,6 +1148,7 @@ CONTAINS ! ! Optional parameters: ! lapl_id - Link access property list identifier. +! fields - Flags specifying the fields to include in object_info. ! ! AUTHOR ! M. Scot Breitenfeld @@ -1093,7 +1156,7 @@ CONTAINS ! ! Fortran2003 Interface: SUBROUTINE h5ovisit_by_name_f(loc_id, object_name, index_type, order, op, op_data, & - return_value, hdferr, lapl_id) + return_value, hdferr, lapl_id, fields) IMPLICIT NONE INTEGER(HID_T) , INTENT(IN) :: loc_id CHARACTER(LEN=*), INTENT(IN) :: object_name @@ -1105,14 +1168,16 @@ CONTAINS INTEGER , INTENT(OUT) :: return_value INTEGER , INTENT(OUT) :: hdferr INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id + INTEGER , INTENT(IN) , OPTIONAL :: fields !***** INTEGER(SIZE_T) :: namelen INTEGER(HID_T) :: lapl_id_default + INTEGER :: fields_c INTERFACE INTEGER FUNCTION h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, & - op, op_data, lapl_id) BIND(C, NAME='h5ovisit_by_name_c') + op, op_data, lapl_id, fields) BIND(C, NAME='h5ovisit_by_name_c') IMPORT :: C_CHAR, C_PTR, C_FUNPTR IMPORT :: HID_T, SIZE_T IMPLICIT NONE @@ -1124,16 +1189,20 @@ CONTAINS TYPE(C_FUNPTR) , VALUE :: op TYPE(C_PTR) , VALUE :: op_data INTEGER(HID_T) , INTENT(IN) :: lapl_id + INTEGER , INTENT(IN) :: fields END FUNCTION h5ovisit_by_name_c END INTERFACE + fields_c = H5O_INFO_ALL_F + IF(PRESENT(fields)) fields_c = fields + namelen = LEN(object_name) lapl_id_default = H5P_DEFAULT_F IF(PRESENT(lapl_id)) lapl_id_default = lapl_id return_value = h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, & - op, op_data, lapl_id_default) + op, op_data, lapl_id_default, fields_c) IF(return_value.GE.0)THEN hdferr = 0 diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 455c72e..13a2953 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -8023,8 +8023,97 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) END SUBROUTINE h5pget_virtual_dsetname_f +!****s* H5P (F03)/h5pget_dset_no_attrs_hint_f_F03 +! +! NAME +! h5pget_dset_no_attrs_hint_f +! +! PURPOSE +! Gets the value of the "minimize dataset headers" value which creates +! smaller dataset object headers when its set and no attributes are present. +! +! INPUTS +! dcpl_id - Target dataset creation property list identifier. +! +! OUTPUTS +! minimize - Value of the setting. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! January 2019 +! +! Fortran2003 Interface: + SUBROUTINE h5pget_dset_no_attrs_hint_f(dcpl_id, minimize, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + LOGICAL , INTENT(OUT) :: minimize + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_minimize -END MODULE H5P + INTERFACE + INTEGER FUNCTION h5pget_dset_no_attrs_hint_c(dcpl_id, minimize) BIND(C, NAME='H5Pget_dset_no_attrs_hint') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dcpl_id + LOGICAL(C_BOOL), INTENT(OUT) :: minimize + END FUNCTION h5pget_dset_no_attrs_hint_c + END INTERFACE + + hdferr = INT(h5pget_dset_no_attrs_hint_c(dcpl_id, c_minimize)) + ! Transfer value of C C_BOOL type to Fortran LOGICAL + minimize = c_minimize + END SUBROUTINE h5pget_dset_no_attrs_hint_f + +!****s* H5P (F03)/h5pset_dset_no_attrs_hint_f_F03 +! +! NAME +! h5pset_dset_no_attrs_hint_f +! +! PURPOSE +! Sets the value of the "minimize dataset headers" value which creates +! smaller dataset object headers when its set and no attributes are present. +! +! INPUTS +! dcpl_id - Target dataset creation property list identifier. +! minimize - Value of the setting. +! +! OUTPUTS +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! January 2019 +! +! Fortran2003 Interface: + SUBROUTINE h5pset_dset_no_attrs_hint_f(dcpl_id, minimize, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + LOGICAL , INTENT(IN) :: minimize + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_minimize + + INTERFACE + INTEGER FUNCTION h5pset_dset_no_attrs_hint_c(dcpl_id, minimize) BIND(C, NAME='H5Pset_dset_no_attrs_hint') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dcpl_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: minimize + END FUNCTION h5pset_dset_no_attrs_hint_c + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C C_BOOL type + c_minimize = minimize + + hdferr = INT(h5pset_dset_no_attrs_hint_c(dcpl_id, c_minimize)) + + END SUBROUTINE h5pset_dset_no_attrs_hint_f + +END MODULE H5P diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 352ffab..69ba8b3 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -556,6 +556,17 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5o_flags[24] = (int_f)H5O_TYPE_DATASET; /* Object is a dataset */ h5o_flags[25] = (int_f)H5O_TYPE_NAMED_DATATYPE; /* Object is a named data type */ h5o_flags[26] = (int_f)H5O_TYPE_NTYPES; /* Number of different object types */ + +/* Flags for H5Oget_info. + * These flags determine which fields will be filled in in the H5O_info_t + * struct. + */ + h5o_flags[27] = (int_f)H5O_INFO_ALL; /* (H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ + h5o_flags[28] = (int_f)H5O_INFO_BASIC; /* Fill in the fileno, addr, type, and rc fields */ + h5o_flags[29] = (int_f)H5O_INFO_TIME; /* Fill in the atime, mtime, ctime, and btime fields */ + h5o_flags[30] = (int_f)H5O_INFO_NUM_ATTRS; /* Fill in the num_attrs field */ + h5o_flags[31] = (int_f)H5O_INFO_HDR; /* Fill in the hdr field */ + h5o_flags[32] = (int_f)H5O_INFO_META_SIZE; /* Fill in the meta_size field */ /* * H5P flags */ diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index f63e734..84529e4 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -98,8 +98,8 @@ MODULE H5LIB ! ! H5O flags declaration ! - INTEGER, PARAMETER :: H5O_FLAGS_LEN = 27 - INTEGER, DIMENSION(1:H5O_FLAGS_LEN) :: H5o_flags + INTEGER, PARAMETER :: H5O_FLAGS_LEN = 33 + INTEGER, DIMENSION(1:H5O_FLAGS_LEN) :: H5O_flags ! ! H5P flags declaration ! @@ -139,8 +139,8 @@ MODULE H5LIB ! INTEGER, PARAMETER :: H5LIB_FLAGS_LEN = 2 INTEGER, DIMENSION(1:H5LIB_FLAGS_LEN) :: H5LIB_flags - - PUBLIC :: h5open_f, h5close_f, h5get_libversion_f, h5dont_atexit_f, h5kind_to_type, h5offsetof + + PUBLIC :: h5open_f, h5close_f, h5get_libversion_f, h5dont_atexit_f, h5kind_to_type, h5offsetof, h5gmtime PUBLIC :: h5garbage_collect_f, h5check_version_f CONTAINS @@ -488,7 +488,13 @@ CONTAINS H5O_TYPE_GROUP_F = h5o_flags(24) H5O_TYPE_DATASET_F = h5o_flags(25) H5O_TYPE_NAMED_DATATYPE_F = h5o_flags(26) - H5O_TYPE_NTYPES_F = h5o_flags(27) + H5O_TYPE_NTYPES_F = h5o_flags(27) + H5O_INFO_ALL_F = h5o_flags(28) + H5O_INFO_BASIC_F = h5o_flags(29) + H5O_INFO_TIME_F = h5o_flags(30) + H5O_INFO_NUM_ATTRS_F = h5o_flags(31) + H5O_INFO_HDR_F = h5o_flags(32) + H5O_INFO_META_SIZE_F = h5o_flags(33) ! ! H5P flags ! @@ -898,4 +904,62 @@ CONTAINS END FUNCTION h5offsetof +!****f* H5LIB_PROVISIONAL/h5gmtime +! +! NAME +! h5gmtime +! +! PURPOSE +! Convert time_t structure (C) to Fortran DATE AND TIME storage format. +! +! Inputs: +! stdtime_t - Object of type time_t that contains a time value +! +! Outputs: +! datetime - A date/time array using Fortran conventions: +! datetime(1) = year +! datetime(2) = month +! datetime(3) = day +! datetime(4) = 0 ! time is expressed as UTC (or GMT timezone) */ +! datetime(5) = hour +! datetime(6) = minute +! datetime(7) = second +! datetime(8) = millisecond -- not available, assigned - HUGE(0) +! +! AUTHOR +! M. Scot Breitenfeld +! January, 2019 +! +! Fortran Interface: + FUNCTION h5gmtime(stdtime_t) + IMPLICIT NONE + INTEGER(KIND=TIME_T), INTENT(IN) :: stdtime_t + INTEGER, DIMENSION(1:8) :: h5gmtime +!***** + TYPE(C_PTR) :: cptr + INTEGER(C_INT), DIMENSION(:), POINTER :: c_time + + INTERFACE + FUNCTION gmtime(stdtime_t) BIND(C, NAME='gmtime') + IMPORT :: TIME_T, C_PTR + IMPLICIT NONE + INTEGER(KIND=TIME_T) :: stdtime_t + TYPE(C_PTR) :: gmtime + END FUNCTION gmtime + END INTERFACE + + cptr = gmtime(stdtime_t) + CALL C_F_POINTER(cptr, c_time, [9]) + + h5gmtime(1) = INT(c_time(6)+1900) ! year starts at 1900 + h5gmtime(2) = INT(c_time(5)+1) ! month starts at 0 in C + h5gmtime(3) = INT(c_time(4)) ! day + h5gmtime(4) = 0 ! time is expressed as UTC (or GMT timezone) + h5gmtime(5) = INT(c_time(3)) ! hour + h5gmtime(6) = INT(c_time(2)) ! minute + h5gmtime(7) = INT(c_time(1)) ! second + h5gmtime(8) = -32767 ! millisecond is not available, assign it -HUGE(0) + + END FUNCTION h5gmtime + END MODULE H5LIB diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 078778a..b705cc1 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -493,6 +493,13 @@ MODULE H5GLOBAL !DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_DATASET_F !DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_NAMED_DATATYPE_F !DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_NTYPES_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_ALL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_BASIC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_TIME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_NUM_ATTRS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_HDR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_META_SIZE_F + ! !DEC$endif INTEGER :: H5O_COPY_SHALLOW_HIERARCHY_F ! *** THESE VARIABLES DO @@ -522,6 +529,12 @@ MODULE H5GLOBAL INTEGER :: H5O_TYPE_DATASET_F INTEGER :: H5O_TYPE_NAMED_DATATYPE_F INTEGER :: H5O_TYPE_NTYPES_F + INTEGER :: H5O_INFO_ALL_F + INTEGER :: H5O_INFO_BASIC_F + INTEGER :: H5O_INFO_TIME_F + INTEGER :: H5O_INFO_NUM_ATTRS_F + INTEGER :: H5O_INFO_HDR_F + INTEGER :: H5O_INFO_META_SIZE_F ! ! H5P flags declaration ! diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 0884eb6..56b7f22 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -314,14 +314,14 @@ H5_FCDLL int_f h5oclose_c(hid_t_f *object_id ); H5_FCDLL int_f h5oopen_by_addr_c(hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id); H5_FCDLL int_f h5olink_c(hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id); -H5_FCDLL int_f h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data); +H5_FCDLL int_f h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data, int_f *fields); H5_FCDLL int_f h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, - H5O_iterate_t op, void *op_data, hid_t_f *lapl_id ); -H5_FCDLL int_f h5oget_info_c(hid_t_f *object_id, H5O_info_t_f *object_info); + H5O_iterate_t op, void *op_data, hid_t_f *lapl_id, int_f *fields ); +H5_FCDLL int_f h5oget_info_c(hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields); H5_FCDLL int_f h5oget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, - int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info); + int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields); H5_FCDLL int_f h5oget_info_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, - H5O_info_t_f *object_info); + H5O_info_t_f *object_info, int_f *fields); H5_FCDLL int_f h5ocopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len, hid_t_f *ocpypl_id, hid_t_f *lcpl_id ); diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 7e0b7e8..57f7dda 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -191,6 +191,8 @@ int main(void) } if(sizeof(size_t) == IntKinds_SizeOf[i]) writeTypedef("size_t", "size_t", IntKinds[i]); + if(sizeof(time_t) == IntKinds_SizeOf[i]) + writeTypedef("time_t", "time_t", IntKinds[i]); if(sizeof(hsize_t) == IntKinds_SizeOf[i]) writeTypedef("hsize_t", "hsize_t", IntKinds[i]); } @@ -306,6 +308,17 @@ int main(void) return -1; } + /* time_t */ + for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { + if(IntKinds_SizeOf[i] == H5_SIZEOF_TIME_T) { + writeToFiles("time_t","TIME_T", "time_t_f", IntKinds[i]); + break; + } + if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) + /* Error: couldn't find a size for time_t */ + return -1; + } + /* int */ writeToFiles("int","Fortran_INTEGER", "int_f", H5_FORTRAN_NATIVE_INTEGER_KIND); diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 2edba5a..a99efad 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -8,6 +8,7 @@ H5LIB_mp_H5GARBAGE_COLLECT_F H5LIB_mp_H5DONT_ATEXIT_F H5LIB_mp_H5KIND_TO_TYPE H5LIB_mp_H5OFFSETOF +H5LIB_mp_H5GMTIME ; H5A H5A_mp_H5AWRITE_CHAR_SCALAR H5A_mp_H5AREAD_CHAR_SCALAR @@ -99,6 +100,8 @@ H5F_mp_H5FIS_HDF5_F H5F_mp_H5FGET_NAME_F H5F_mp_H5FGET_FILESIZE_F H5F_mp_H5FGET_FILE_IMAGE_F +H5F_mp_H5FGET_DSET_NO_ATTRS_HINT_F +H5F_mp_H5FSET_DSET_NO_ATTRS_HINT_F ; H5G H5G_mp_H5GOPEN_F H5G_mp_H5GCREATE_F @@ -329,6 +332,8 @@ H5P_mp_H5PGET_VIRTUAL_VSPACE_F H5P_mp_H5PGET_VIRTUAL_SRCSPACE_F H5P_mp_H5PGET_VIRTUAL_FILENAME_F H5P_mp_H5PGET_VIRTUAL_DSETNAME_F +H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F +H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 4d06359..2824ef7 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -103,26 +103,24 @@ endif () set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran) #-- Adding test for fortranlib_test_F03 -if (HDF5_ENABLE_F2003) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $<TARGET_FILE:fortranlib_test_F03>) - else () - add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=fortranlib_test_F03.txt" - #-D "TEST_REFERENCE=fortranlib_test_F03.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $<TARGET_FILE:fortranlib_test_F03>) +else () + add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=fortranlib_test_F03.txt" + #-D "TEST_REFERENCE=fortranlib_test_F03.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () # set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) -endif () #-- Adding test for fflush1 add_test (NAME FORTRAN_fflush1 COMMAND $<TARGET_FILE:fflush1>) @@ -215,26 +213,24 @@ if (BUILD_SHARED_LIBS) set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) #-- Adding test for fortranlib_test_F03 - if (HDF5_ENABLE_F2003) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $<TARGET_FILE:fortranlib_test_F03-shared>) - else () - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=fortranlib_test_F03.txt" - #-D "TEST_REFERENCE=fortranlib_test_F03.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $<TARGET_FILE:fortranlib_test_F03-shared>) + else () + add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03-shared>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=fortranlib_test_F03.txt" + #-D "TEST_REFERENCE=fortranlib_test_F03.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) endif () +# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) #-- Adding test for fflush1 add_test (NAME FORTRAN_fflush1-shared COMMAND $<TARGET_FILE:fflush1-shared>) diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index d51803b..2501996 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -858,5 +858,4 @@ CONTAINS END SUBROUTINE file_space - END MODULE TH5F diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index 44c4bff..d1a9ddb 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -58,21 +58,224 @@ MODULE visit_cb TYPE, bind(c) :: ovisit_ud_t INTEGER :: idx ! Index in object visit structure TYPE(obj_visit_t), DIMENSION(1:info_size) :: info ! Pointer to the object visit structure to use + INTEGER :: field END TYPE ovisit_ud_t CONTAINS - INTEGER FUNCTION visit_obj_cb( group_id, name, oinfo, op_data) bind(C) +! Compares the field values of a C h5O_info_t and a Fortran H5O_info_t. + + INTEGER FUNCTION compare_h5o_info_t( oinfo_f, oinfo_c, field, full_f_field ) RESULT(status) + + IMPLICIT NONE + TYPE(h5o_info_t) :: oinfo_f + TYPE(c_h5o_info_t) :: oinfo_c + INTEGER :: field + LOGICAL :: full_f_field ! All the fields of Fortran H5O_info_t where filled +! local + INTEGER(C_INT), DIMENSION(1:8) :: atime, btime, ctime, mtime + INTEGER :: i + + status = 0 + + IF( (field .EQ. H5O_INFO_BASIC_F).OR.(field .EQ. H5O_INFO_ALL_F) )THEN + IF( (oinfo_f%fileno.LE.0) .OR. (oinfo_c%fileno .NE. oinfo_f%fileno) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%addr.LE.0) .OR. (oinfo_c%addr .NE. oinfo_f%addr) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%type.LT.0) .OR. (oinfo_c%type .NE. oinfo_f%type) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%rc.LT.0) .OR. (oinfo_c%rc .NE. oinfo_f%rc) )THEN + status = -1 + RETURN + ENDIF + + ENDIF + + IF((field .EQ. H5O_INFO_TIME_F).OR.(field .EQ. H5O_INFO_ALL_F))THEN + + atime(1:8) = h5gmtime(oinfo_c%atime) + btime(1:8) = h5gmtime(oinfo_c%btime) + ctime(1:8) = h5gmtime(oinfo_c%ctime) + mtime(1:8) = h5gmtime(oinfo_c%mtime) + + DO i = 1, 8 + IF( (atime(i) .NE. oinfo_f%atime(i)) )THEN + status = -1 + RETURN + ENDIF + + IF( (btime(i) .NE. oinfo_f%btime(i)) )THEN + status = -1 + RETURN + ENDIF + + IF( (ctime(i) .NE. oinfo_f%ctime(i)) )THEN + status = -1 + RETURN + ENDIF + + IF( (mtime(i) .NE. oinfo_f%mtime(i)) )THEN + status = -1 + RETURN + ENDIF + ENDDO + + ELSE IF(field .EQ. H5O_INFO_TIME_F.AND. full_f_field)THEN + ! check other field values are not filled (using only a small subset to check) + status = 0 + IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1 + IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1 + IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1 + IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1 + IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled. + status = -1 + RETURN + ENDIF + status = 0 ! reset + ENDIF + + IF((field .EQ. H5O_INFO_NUM_ATTRS_F).OR.(field .EQ. H5O_INFO_ALL_F))THEN + IF( (oinfo_f%num_attrs.LT.0) .OR. (oinfo_c%num_attrs .NE. oinfo_f%num_attrs) )THEN + status = -1 + RETURN + ENDIF + ELSE IF( field .EQ. H5O_INFO_ALL_F.AND.full_f_field)THEN + ! check other field values are not filled (using only a small subset to check) + status = 0 + IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1 + IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1 + IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1 + IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1 + IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled. + status = -1 + RETURN + ENDIF + status = 0 ! reset + + ENDIF + + IF((field).EQ.H5O_INFO_HDR_F.OR.(field .EQ. H5O_INFO_ALL_F))THEN + IF( (oinfo_f%hdr%version.LT.0) .OR. (oinfo_c%hdr%version .NE. oinfo_f%hdr%version) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%nmesgs.LT.0) .OR. (oinfo_c%hdr%nmesgs .NE. oinfo_f%hdr%nmesgs) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%nchunks.LT.0) .OR. (oinfo_c%hdr%nchunks .NE. oinfo_f%hdr%nchunks) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%flags.LT.0) .OR. (oinfo_c%hdr%flags .NE. oinfo_f%hdr%flags) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%space%total.LT.0) .OR. (oinfo_c%hdr%space%total .NE. oinfo_f%hdr%space%total) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%space%meta.LT.0) .OR. (oinfo_c%hdr%space%meta .NE. oinfo_f%hdr%space%meta) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%space%mesg.LT.0) .OR. (oinfo_c%hdr%space%mesg .NE. oinfo_f%hdr%space%mesg) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%space%free.LT.0) .OR. (oinfo_c%hdr%space%free .NE. oinfo_f%hdr%space%free) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%mesg%present.LT.0) .OR. (oinfo_c%hdr%mesg%present .NE. oinfo_f%hdr%mesg%present) )THEN + status = -1 + RETURN + ENDIF + IF( (oinfo_f%hdr%mesg%shared.LT.0) .OR. (oinfo_c%hdr%mesg%shared .NE. oinfo_f%hdr%mesg%shared) )THEN + status = -1 + RETURN + ENDIF + ELSE IF( field .EQ. H5O_INFO_HDR_F.AND.full_f_field)THEN + ! check other field values are not filled (using only a small subset to check) + status = 0 + IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1 + IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1 + IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1 + IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1 + IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled. + status = -1 + RETURN + ENDIF + status = 0 ! reset + ENDIF + IF((field).EQ.H5O_INFO_META_SIZE_F.OR.(field .EQ. H5O_INFO_ALL_F))THEN + IF((oinfo_f%meta_size%obj%index_size.LT.0).OR.(oinfo_c%meta_size%obj%index_size.NE.oinfo_f%meta_size%obj%index_size))THEN + status = -1 + RETURN + ENDIF + IF((oinfo_f%meta_size%obj%heap_size.LT.0).OR.(oinfo_c%meta_size%obj%heap_size.NE.oinfo_f%meta_size%obj%heap_size))THEN + status = -1 + RETURN + ENDIF + IF((oinfo_f%meta_size%attr%index_size.LT.0).OR.(oinfo_c%meta_size%attr%index_size.NE.oinfo_f%meta_size%attr%index_size))THEN + status = -1 + RETURN + ENDIF + IF((oinfo_f%meta_size%attr%heap_size.LT.0).OR.(oinfo_c%meta_size%attr%heap_size.NE.oinfo_f%meta_size%attr%heap_size))THEN + status = -1 + RETURN + ENDIF + ELSE IF( field .EQ. H5O_INFO_META_SIZE_F.AND.full_f_field)THEN + ! check other field values are not filled (using only a small subset to check) + status = 0 + IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1 + IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1 + IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1 + IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1 + IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled. + status = -1 + RETURN + ENDIF + status = 0 ! reset + ENDIF + + END FUNCTION compare_h5o_info_t + + INTEGER FUNCTION visit_obj_cb( group_id, name, oinfo_c, op_data) bind(C) IMPLICIT NONE INTEGER(HID_T), VALUE :: group_id CHARACTER(LEN=1), DIMENSION(1:180) :: name - TYPE(h5o_info_t) :: oinfo + CHARACTER(LEN=180) :: name2 + TYPE(c_h5o_info_t) :: oinfo_c TYPE(ovisit_ud_t) :: op_data - + TYPE(h5o_info_t) :: oinfo_f +! +! MEMBER | TYPE | MEANING | RANGE +! A(1) = tm_sec int seconds after the minute 0-61* +! A(2) = tm_min int minutes after the hour 0-59 +! A(3) = tm_hour int hours since midnight 0-23 +! A(4) = tm_mday int day of the month 1-31 +! A(5) = tm_mon int months since January 0-11 +! A(6) = tm_year int years since 1900 +! A(7) = tm_wday int days since Sunday 0-6 +! A(8) = tm_yday int days since January 1 0-365 +! A(9) = tm_isdst int Daylight Saving Time flag +! + INTEGER(C_INT), DIMENSION(:), POINTER :: c_atime, c_btime, c_ctime, c_mtime + INTEGER(C_INT), DIMENSION(1:8) :: atime, btime, ctime, mtime INTEGER :: len, i INTEGER :: idx + INTEGER :: ierr + TYPE(C_PTR) :: cptr visit_obj_cb = 0 @@ -87,21 +290,53 @@ CONTAINS len = len - 1 ! Check for correct object information + name2(1:180) = "" + DO i = 1, len + name2(i:i) = name(i)(1:1) + ENDDO - idx = op_data%idx + IF(op_data%field .EQ. H5O_INFO_ALL_F)THEN - DO i = 1, len - IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN - visit_obj_cb = -1 - RETURN - ENDIF - - IF(op_data%info(idx)%type_obj .NE. oinfo%type)THEN - visit_obj_cb = -1 - RETURN - ENDIF + idx = op_data%idx + + DO i = 1, len + IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN + visit_obj_cb = -1 + RETURN + ENDIF + + IF(op_data%info(idx)%type_obj .NE. oinfo_c%type)THEN + visit_obj_cb = -1 + RETURN + ENDIF + ENDDO - ENDDO + ENDIF + + ! Check H5Oget_info_by_name_f; if partial field values where filled correctly + CALL H5Oget_info_by_name_f(group_id, name2, oinfo_f, ierr); + visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .TRUE. ) + IF(visit_obj_cb.EQ.-1) RETURN + + ! Check H5Oget_info_by_name_f, only check field values + CALL H5Oget_info_by_name_f(group_id, name2, oinfo_f, ierr, fields = op_data%field); + visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .FALSE. ) + IF(visit_obj_cb.EQ.-1) RETURN + + + IF(op_data%idx.EQ.1)THEN + + ! Check H5Oget_info_f, only check field values + CALL H5Oget_info_f(group_id, oinfo_f, ierr, fields = op_data%field); + visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .FALSE. ) + IF(visit_obj_cb.EQ.-1) RETURN + + ! Check H5Oget_info_f; if partial field values where filled correctly + CALL H5Oget_info_f(group_id, oinfo_f, ierr); + visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .TRUE. ) + IF(visit_obj_cb.EQ.-1) RETURN + + ENDIF ! Advance to next location in expected output op_data%idx = op_data%idx + 1 @@ -110,7 +345,6 @@ CONTAINS END MODULE visit_cb - MODULE TH5O_F03 CONTAINS @@ -310,29 +544,110 @@ SUBROUTINE obj_visit(total_error) udata%info(9)%type_obj = H5O_TYPE_NAMED_DATATYPE_F ! Visit all the objects reachable from the root group (with file ID) - udata%idx = 1 fun_ptr = C_FUNLOC(visit_obj_cb) f_ptr = C_LOC(udata) ! Test h5ovisit_f + udata%field = H5O_INFO_ALL_F + udata%idx = 1 CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error) CALL check("h5ovisit_f", error, total_error) IF(ret_val.LT.0)THEN CALL check("h5ovisit_f", -1, total_error) ENDIF - ! Test h5ovisit_by_name_f + ! Test fields option + udata%field = H5O_INFO_ALL_F + udata%idx = 1 + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + udata%field = H5O_INFO_BASIC_F + udata%idx = 1 + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + udata%field = H5O_INFO_TIME_F + udata%idx = 1 + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + udata%field = H5O_INFO_NUM_ATTRS_F + udata%idx = 1 + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + udata%field = H5O_INFO_HDR_F + udata%idx = 1 + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + udata%field = H5O_INFO_META_SIZE_F + udata%idx = 1 + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + ! Test h5ovisit_by_name_f object_name = "/" udata%idx = 1 - - CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error) + udata%field = H5O_INFO_ALL_F + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) CALL check("h5ovisit_by_name_f", error, total_error) IF(ret_val.LT.0)THEN CALL check("h5ovisit_by_name_f", -1, total_error) ENDIF + ! Test fields option + udata%idx = 1 + udata%field = H5O_INFO_BASIC_F + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_by_name_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_by_name_f", -1, total_error) + ENDIF + udata%idx = 1 + udata%field = H5O_INFO_TIME_F + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_by_name_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_by_name_f", -1, total_error) + ENDIF + udata%idx = 1 + udata%field = H5O_INFO_NUM_ATTRS_F + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_by_name_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_by_name_f", -1, total_error) + ENDIF + udata%idx = 1 + udata%field = H5O_INFO_HDR_F + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_by_name_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_by_name_f", -1, total_error) + ENDIF + udata%idx = 1 + udata%field = H5O_INFO_META_SIZE_F + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) + CALL check("h5ovisit_by_name_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_by_name_f", -1, total_error) + ENDIF + CALL h5fclose_f(fid, error) CALL check("h5fclose_f",error, total_error) @@ -450,11 +765,32 @@ SUBROUTINE obj_info(total_error) IF(oinfo%rc.NE.1)THEN CALL check("h5oget_info_by_idx_f", -1, total_error) ENDIF + IF(oinfo%type.NE.H5O_TYPE_DATASET_F)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + ! Check partial fields + CALL h5oget_info_by_idx_f(gid, ".", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, oinfo, error, fields=H5O_INFO_BASIC_F ) + CALL check("h5oget_info_by_idx_f", error, total_error) + + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF IF(oinfo%type.NE.H5O_TYPE_DATASET_F)THEN CALL check("h5oget_info_by_idx_f", -1, total_error) ENDIF + CALL h5oget_info_by_idx_f(gid, ".", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, oinfo, error, fields=H5O_INFO_TIME_F ) + CALL check("h5oget_info_by_idx_f", error, total_error) + ! These field values should not be filled + IF(oinfo%rc.EQ.1)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + IF(oinfo%type.EQ.H5O_TYPE_DATASET_F)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + + ! Close objects CALL h5dclose_f(did, error) CALL check("h5dclose_f", error, total_error) @@ -483,11 +819,12 @@ SUBROUTINE build_visit_file(fid) USE TH5_MISC IMPLICIT NONE - INTEGER(hid_t) :: fid ! File ID - INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs + INTEGER(hid_t) :: fid ! File ID + INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs INTEGER(hid_t) :: sid = -1 ! Dataspace ID INTEGER(hid_t) :: did = -1 ! Dataset ID INTEGER(hid_t) :: tid = -1 ! Datatype ID + INTEGER(hid_t) :: aid = -1, aid2 = -1, aid3 = -1 ! Attribute ID CHARACTER(LEN=20) :: filename = 'visit.h5' INTEGER :: error @@ -500,6 +837,15 @@ SUBROUTINE build_visit_file(fid) ! Create nested group CALL H5Gcreate_f(gid, "Group2", gid2, error) + CALL H5Screate_f(H5S_SCALAR_F, sid, error) + CALL H5Acreate_f(gid2, "Attr1", H5T_NATIVE_INTEGER, sid, aid, error) + CALL H5Acreate_f(gid2, "Attr2", H5T_NATIVE_INTEGER, sid, aid2, error) + CALL H5Acreate_f(gid2, "Attr3", H5T_NATIVE_INTEGER, sid, aid3, error) + CALL H5Aclose_f(aid,error) + CALL H5Aclose_f(aid2,error) + CALL H5Aclose_f(aid3,error) + CALL H5Sclose_f(sid,error) + ! Close groups CALL h5gclose_f(gid2, error) CALL h5gclose_f(gid, error) diff --git a/fortran/test/tH5P.F90 b/fortran/test/tH5P.F90 index 563926b..c42dd7e 100644 --- a/fortran/test/tH5P.F90 +++ b/fortran/test/tH5P.F90 @@ -444,6 +444,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) INTEGER(size_t) rdcc_nelmts INTEGER(size_t) rdcc_nbytes REAL :: rdcc_w0 + LOGICAL :: minimize ! Flag for minimized headers CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) IF (error .NE. 0) THEN @@ -648,6 +649,57 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL verify("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error) CALL verify("H5Pget_chunk_cache_f", w0_3, w0_4, total_error) + ! Check that the dataset object header minimization hint + ! can be set and retrieved. + + ! H5P version + ! Check the default value + minimize = .TRUE. + CALL h5pget_dset_no_attrs_hint_f(dcpl, minimize, error) + CALL check("h5pget_dset_no_attrs_hint_f",error,total_error) + if(minimize .neqv. .FALSE.) then + total_error = total_error + 1 + write(*,*) "Default dataset minimize flag was incorrect (H5P)" + endif + + ! Check setter + minimize = .TRUE. + CALL h5pset_dset_no_attrs_hint_f(dcpl, minimize, error) + CALL check("h5pset_dset_no_attrs_hint_f",error,total_error) + + ! Check getter + minimize = .FALSE. + CALL h5pget_dset_no_attrs_hint_f(dcpl, minimize, error) + CALL check("h5pget_dset_no_attrs_hint_f",error,total_error) + if(minimize .neqv. .TRUE.) then + total_error = total_error + 1 + write(*,*) "Unable to get correct dataset minimize flag (H5P)" + endif + + ! H5F version + ! Check the default value + minimize = .TRUE. + CALL h5fget_dset_no_attrs_hint_f(fid, minimize, error) + CALL check("h5fget_dset_no_attrs_hint_f",error,total_error) + if(minimize .neqv. .FALSE.) then + total_error = total_error + 1 + write(*,*) "Default dataset minimize flag was incorrect (H5F)" + endif + + ! Check setter + minimize = .TRUE. + CALL h5fset_dset_no_attrs_hint_f(fid, minimize, error) + CALL check("h5fset_dset_no_attrs_hint_f",error,total_error) + + ! Check getter + minimize = .FALSE. + CALL h5fget_dset_no_attrs_hint_f(fid, minimize, error) + CALL check("h5fget_dset_no_attrs_hint_f",error,total_error) + if(minimize .neqv. .TRUE.) then + total_error = total_error + 1 + write(*,*) "Unable to get correct dataset minimize flag (H5F)" + endif + ! Close CALL H5Dclose_f(dsid, error) diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index a495e220..37e074c 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -50,6 +50,21 @@ libhdf5hl_fortran_la_SOURCES=H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ # HDF5 HL Fortran library depends on HDF5 Library. libhdf5hl_fortran_la_LIBADD=$(LIBH5_HL) $(LIBH5F) +# The name of the lib file doesn't follow the same pattern as the other hl lib +# files, namely libhdf5_hl_*. Add a symlink with the compliant name to the +# actual lib file. +install-exec-hook: + cd $(DESTDIR)$(libdir) && \ + if test -f libhdf5hl_fortran.a -a \ + ! -f libhdf5_hl_fortran.a; then \ + $(LN_S) libhdf5hl_fortran.a libhdf5_hl_fortran.a; \ + fi; \ + if test -f libhdf5hl_fortran.so -a \ + ! -f libhdf5_hl_fortran.so; then \ + $(LN_S) libhdf5hl_fortran.so libhdf5_hl_fortran.so; \ + fi; + + # Fortran module files can have different extensions and different names # (e.g., different capitalizations) on different platforms. Write rules # for them explicitly rather than trying to teach automake about them. @@ -72,6 +87,7 @@ uninstall-local: set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \ fi; \ fi + $(RM) $(DESTDIR)$(libdir)/libhdf5_hl_fortran* # These are the helper programs we need to build. noinst_PROGRAMS = H5HL_buildiface diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index e354207..19ca83b 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -70,8 +70,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF * Reference Manual. * - * <center> - * <table border=2 cellpadding=2> + * <table border=1> * <caption><b>HDF-5 C types to Java types</b> </caption> * <tr> * <td><b>HDF-5</b></td> @@ -107,8 +106,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * <td>Special -- see HDFArray</td> * </tr> * </table> - * </center> - * <center> <b>General Rules for Passing Arguments and Results</b> </center> + * <b>General Rules for Passing Arguments and Results</b> * <p> * In general, arguments passed <b>IN</b> to Java are the analogous basic types, as above. The exception is for arrays, * which are discussed below. @@ -143,7 +141,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * <p> * All the routines where this convention is used will have specific documentation of the details, given below. * <p> - * <a NAME="ARRAYS"> <b>Arrays</b> </a> + * <b>Arrays</b> * <p> * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, @@ -176,7 +174,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * and the parameter <i>data</i> can be any multi-dimensional array of numbers, such as float[][], or int[][][], or * Double[][]. * <p> - * <a NAME="CONSTANTS"> <b>HDF-5 Constants</b></a> + * <b>HDF-5 Constants</b> * <p> * The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs * via the class <a href="./hdf.hdf5lib.HDF5Constants.html"> <b>HDF5Constants</b></a>. For example, the parameters for @@ -196,7 +194,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * The Java application uses both types of constants the same way, the only difference is that the * <b><i>HDF5CDataTypes</i></b> may have different values on different platforms. * <p> - * <a NAME="ERRORS"> <b>Error handling and Exceptions</b></a> + * <b>Error handling and Exceptions</b> * <p> * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted from the * JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural @@ -3229,13 +3227,56 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Fget_mdc_logging_status(long file_id, boolean[] mdc_logging_status) throws HDF5LibraryException, NullPointerException; + /** + * H5Fget_dset_no_attrs_hint gets the file-level setting to create minimized dataset object headers. + * + * @param file_id + * IN: Identifier of the target file. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Fget_dset_no_attrs_hint(long file_id) + throws HDF5LibraryException; + + + /** + * H5Fset_dset_no_attrs_hint sets the file-level setting to create minimized dataset object headers. + * + * @param file_id + * IN: Identifier of the target file. + * @param minimize + * the minimize hint setting + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Fset_dset_no_attrs_hint(long file_id, boolean minimize) + throws HDF5LibraryException; + + + /** + * H5Fset_libver_bounds sets a different low and high bounds while a file is open. + * + * @param file_id + * IN: Identifier of the target file. + * @param low + * IN: The earliest version of the library that will be used for writing objects + * @param high + * IN: The latest version of the library that will be used for writing objects. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Fset_libver_bounds(long file_id, int low, int high) + throws HDF5LibraryException; + // /////// unimplemented //////// // herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); // herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); // ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len); // herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info); // ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/); - // herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high); // herr_t H5Fformat_convert(hid_t fid); // herr_t H5Freset_page_buffering_stats(hid_t file_id); // herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], @@ -6922,8 +6963,6 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException, NullPointerException; - // /////// Dataset creation property list (DCPL) routines /////// - /** * H5Pset_chunk_opts Sets the edge chunk option in a dataset creation property list. * @@ -6952,6 +6991,36 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native int H5Pget_chunk_opts(long dcpl_id) throws HDF5LibraryException; + /** + * H5Pget_dset_no_attrs_hint accesses the flag for whether or not datasets created by the given dcpl + * will be created with a "minimized" object header. + * + * @param dcpl_id + * IN: Dataset creation property list + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Pget_dset_no_attrs_hint(long dcpl_id) + throws HDF5LibraryException; + + + /** + * H5Pset_dset_no_attrs_hint sets the dcpl to minimize (or explicitly to not minimized) dataset object + * headers upon creation. + * + * @param dcpl_id + * IN: Dataset creation property list + * + * @param minimize + * the minimize hint setting + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Pset_dset_no_attrs_hint(long dcpl_id, boolean minimize) + throws HDF5LibraryException; + // /////// Dataset access property list (DAPL) routines /////// /** @@ -7658,34 +7727,6 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options) throws HDF5LibraryException; - // /////// Other/Older property list routines /////// - - /** - * H5Pget_version retrieves the version information of various objects for a file creation property list. - * - * @param plist - * IN: Identifier of the file creation property list. - * @param version_info - * OUT: version information. - * - * <pre> - * version_info[0] = boot // boot block version number - * version_info[1] = freelist // global freelist version - * version_info[2] = stab // symbol tabl version number - * version_info[3] = shhdr // shared object header version - * </pre> - * @return a non-negative value, with the values of version_info initialized, if successful - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * @exception NullPointerException - * - version_info is null. - * @exception IllegalArgumentException - * - version_info is illegal. - **/ - public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException; - // /////// file drivers property list routines /////// public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store) diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index edb1b76..e3a032b 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -90,8 +90,7 @@ like this: The <i><b>H5</b> </i>class automatically loads the native method implementations and the HDF5 library. -<h3> -<a NAME="DOWNLOAD"></a>To Obtain</h3> +<h3>To Obtain</h3> The JHI5 is included with the <a href="https://portal.hdfgroup.org/display/support/Downloads">HDF5</a> library. </body> diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 248e654..80adffb 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -149,6 +149,9 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5 (JNIEnv *env, jclass clss, jstring name) { htri_t bval = JNI_FALSE; +#ifdef H5_NO_DEPRECATED_SYMBOLS + h5unimplemented(env, "H5Fis_hdf5: not implemented"); +#else const char *fileName; PIN_JAVA_STRING(name, fileName); @@ -162,7 +165,7 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5 else if (bval < 0) h5libraryError(env); } - +#endif return (jboolean)bval; } /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */ @@ -636,6 +639,66 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status } /* end else */ } /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fset_dset_no_attrs_hint + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint +(JNIEnv *env, jclass clss, jlong file_id, jboolean minimize) +{ + herr_t retVal = -1; + hbool_t minimize_val; + + if (minimize == JNI_TRUE) + minimize_val = TRUE; + else + minimize_val = FALSE; + + retVal = H5Fset_dset_no_attrs_hint((hid_t)file_id, (hbool_t)minimize_val); + if (retVal < 0) + h5libraryError(env); +} + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_dset_no_attrs_hint + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint +(JNIEnv *env, jclass clss, jlong file_id) +{ + hbool_t minimize = FALSE; + jboolean bval = JNI_FALSE; + + if (H5Fget_dset_no_attrs_hint((hid_t)file_id, (hbool_t *)&minimize) < 0) { + h5libraryError(env); + } + else { + if (minimize == TRUE) + bval = JNI_TRUE; + } /* end else */ + + return bval; +} + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fset_libver_bounds + * Signature: (JII)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds + (JNIEnv *env, jclass clss, jlong file_id, jint low, jint high) +{ + herr_t retVal = -1; + + retVal = H5Fset_libver_bounds((hid_t)file_id, (H5F_libver_t)low, (H5F_libver_t)high); + if(retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds */ #ifdef __cplusplus diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h index af0fa1d..fe253f9 100644 --- a/java/src/jni/h5fImp.h +++ b/java/src/jni/h5fImp.h @@ -255,6 +255,33 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status (JNIEnv *, jclass, jlong, jbooleanArray); +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fset_dset_no_attrs_hint + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint + (JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_dset_no_attrs_hint + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fset_libver_bounds + * Signature: (JII)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds +(JNIEnv *, jclass, jlong, jint, jint); + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index 52008ce..ac21d1d 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -134,45 +134,6 @@ Java_hdf_hdf5lib_H5__1H5Pcopy /* * Class: hdf_hdf5lib_H5 - * Method: H5Pget_version - * Signature: (J[I)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1version - (JNIEnv *env, jclass clss, jlong plist, jintArray version_info) -{ - herr_t status = -1; - jint *theArray; - jboolean isCopy; - - if (version_info == NULL) { - h5nullArgument(env, "H5Pget_version: version_info input array is NULL"); - } /* end if */ - else if (ENVPTR->GetArrayLength(ENVPAR version_info) < 4) { - h5badArgument(env, "H5Pget_version: version_info input array < 4"); - } /* end else if */ - else { - theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR version_info, &isCopy); - if (theArray == NULL) { - h5JNIFatalError(env, "H5Pget_version: version_info not pinned"); - } /* end if */ - else { - status = H5Pget_version((hid_t)plist, (unsigned *)&(theArray[0]), - (unsigned *)&(theArray[1]), (unsigned *)&(theArray[2]), (unsigned *)&(theArray[3])); - if (status < 0) { - ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, JNI_ABORT); - h5libraryError(env); - } /* end if */ - else - ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, 0); - } /* end else */ - } /* end else */ - - return (jint)status; -} /* end Java_hdf_hdf5lib_H5_H5Pget_1version */ - -/* - * Class: hdf_hdf5lib_H5 * Method: H5Pset_userblock * Signature: (JJ)I */ @@ -5946,6 +5907,51 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts return (jint)opts; } /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_dset_no_attrs_hint + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint +(JNIEnv *env, jclass clss, jlong dcpl_id, jboolean minimize) +{ + herr_t retVal = -1; + hbool_t minimize_val; + + if (minimize == JNI_TRUE) + minimize_val = TRUE; + else + minimize_val = FALSE; + + retVal = H5Pset_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t)minimize_val); + if (retVal < 0) + h5libraryError(env); +} + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_dset_no_attrs_hint + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint +(JNIEnv *env, jclass clss, jlong dcpl_id) +{ + hbool_t minimize = FALSE; + jboolean bval = JNI_FALSE; + + if (H5Pget_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t *)&minimize) < 0) { + h5libraryError(env); + } + else { + if (minimize == TRUE) + bval = JNI_TRUE; + } /* end else */ + + return bval; +} + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index 1d12e3d..056c569 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -59,15 +59,6 @@ Java_hdf_hdf5lib_H5__1H5Pcopy /* * Class: hdf_hdf5lib_H5 - * Method: H5Pget_version - * Signature: (J[I)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1version -(JNIEnv *, jclass, jlong, jintArray); - -/* - * Class: hdf_hdf5lib_H5 * Method: H5Pset_userblock * Signature: (JJ)I */ @@ -1614,6 +1605,24 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts (JNIEnv *, jclass, jlong); +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_dset_no_attrs_hint + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint + (JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_dset_no_attrs_hint + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint + (JNIEnv *, jclass, jlong); + #ifdef __cplusplus } /* end extern "C" */ diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java index 406a1d3..1b5acfa 100644 --- a/java/test/TestH5Dplist.java +++ b/java/test/TestH5Dplist.java @@ -13,6 +13,7 @@ package test; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -211,4 +212,23 @@ public class TestH5Dplist { assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99); } + @Test + public void testH5P_dset_no_attrs_hint() { + boolean ret_val_id = true; + + _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE); + + try { + ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id); + assertFalse("H5P_dset_no_attrs_hint", ret_val_id); + H5.H5Pset_dset_no_attrs_hint(H5dcpl_id, true); + ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id); + assertTrue("H5P_dset_no_attrs_hint", ret_val_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_dset_no_attrs_hint: " + err); + } + } + } diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java index a5afb6e..72a3c23 100644 --- a/java/test/TestH5Fbasic.java +++ b/java/test/TestH5Fbasic.java @@ -14,6 +14,7 @@ package test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -69,19 +70,6 @@ public class TestH5Fbasic { } @Test - public void testH5Fis_hdf5() { - boolean isH5 = false; - - try { - isH5 = H5.H5Fis_hdf5(H5_FILE); - } - catch (Throwable err) { - fail("H5.H5Fis_hdf5 failed on " + H5_FILE + ": " + err); - } - assertTrue(isH5 == true); - } - - @Test public void testH5Fis_accessible() { boolean isH5 = false; @@ -328,4 +316,20 @@ public class TestH5Fbasic { fail("H5.H5Freset_mdc_hit_rate_stats: " + err); } } + + @Test + public void testH5F_dset_no_attrs_hint() { + boolean ret_val_id = true; + try { + ret_val_id = H5.H5Fget_dset_no_attrs_hint(H5fid); + assertFalse("H5F_dset_no_attrs_hint", ret_val_id); + H5.H5Fset_dset_no_attrs_hint(H5fid, true); + ret_val_id = H5.H5Fget_dset_no_attrs_hint(H5fid); + assertTrue("H5F_dset_no_attrs_hint", ret_val_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5F_dset_no_attrs_hint: " + err); + } + } } diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java index 3d64aa9..40cbe4b 100644 --- a/java/test/TestH5Fparams.java +++ b/java/test/TestH5Fparams.java @@ -22,10 +22,12 @@ import java.io.File; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; import hdf.hdf5lib.structs.H5F_info2_t; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -55,11 +57,6 @@ public class TestH5Fparams { } @Test(expected = NullPointerException.class) - public void testH5Fis_hdf5_null() throws Throwable { - H5.H5Fis_hdf5(null); - } - - @Test(expected = NullPointerException.class) public void testH5Fis_accessible_null() throws Throwable { H5.H5Fis_accessible(null, -1); } @@ -74,7 +71,7 @@ public class TestH5Fparams { H5.H5Funmount(-1, null); } - @Test + @Ignore public void testH5Fis_hdf5_text() { File txtFile = null; boolean isH5 = false; @@ -195,7 +192,7 @@ public class TestH5Fparams { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - fail("H5.H5Fopen: " + err); + fail("H5.H5Fcreate: " + err); } try { @@ -215,4 +212,42 @@ public class TestH5Fparams { try {H5.H5Fclose(fid);} catch (Exception ex) {} } } + + @Ignore//(expected = HDF5FunctionArgumentException.class) + public void testH5Fset_libver_bounds_invalidlow() throws Throwable { + long fid = -1; + + try { + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fcreate: " + err); + } + H5.H5Fset_libver_bounds(fid, 5, HDF5Constants.H5F_LIBVER_LATEST); + } + finally { + try {H5.H5Fclose(fid);} catch (Exception ex) {} + } + } + + @Ignore//(expected = HDF5FunctionArgumentException.class) + public void testH5Fset_libver_bounds_invalidhigh() throws Throwable { + long fid = -1; + + try { + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fcreate: " + err); + } + H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1); + } + finally { + try {H5.H5Fclose(fid);} catch (Exception ex) {} + } + } } diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index e6105d9..981f34e 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -25,6 +25,7 @@ import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5F_info2_t; import org.junit.After; import org.junit.Before; @@ -887,37 +888,12 @@ public class TestH5P { } @Test(expected = NullPointerException.class) - public void testH5Pget_version_null() throws Throwable { - H5.H5Pget_version(fcpl_id, null); - } - - @Test - public void testH5Pget_version() { - int[] version_info = {255,255,255,255}; - - try { - _createH5File(fcpl_id, fapl_id); - H5.H5Pget_version(fcpl_id, version_info); - deleteH5file(); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5Pget_version: " + err); - } - assertTrue("super block version: "+version_info[0], version_info[0] == 0); - assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); - assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); - assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); - } - - @Test(expected = NullPointerException.class) public void testH5Pget_userblock_null() throws Throwable { H5.H5Pget_userblock(fcpl_id, null); } @Test public void testH5P_userblock() { - int[] version_info = {255,255,255,255}; long[] size = {0}; try { @@ -931,7 +907,10 @@ public class TestH5P { fcpl_id = H5.H5Fget_create_plist(H5fid); /* Get the file's version information */ - H5.H5Pget_version(fcpl_id, version_info); + H5F_info2_t finfo = H5.H5Fget_info(H5fid); + assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0); + assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0); + assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_userblock(fcpl_id, size); deleteH5file(); } @@ -939,10 +918,6 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_userblock: " + err); } - assertTrue("super block version: "+version_info[0], version_info[0] == 0); - assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); - assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); - assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); assertTrue("user block size: "+size[0], size[0] == 1024); } @@ -953,7 +928,6 @@ public class TestH5P { @Test public void testH5P_sizes() { - int[] version_info = {255,255,255,255}; long[] size = {0,0}; try { @@ -967,7 +941,10 @@ public class TestH5P { fcpl_id = H5.H5Fget_create_plist(H5fid); /* Get the file's version information */ - H5.H5Pget_version(fcpl_id, version_info); + H5F_info2_t finfo = H5.H5Fget_info(H5fid); + assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0); + assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0); + assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_sizes(fcpl_id, size); deleteH5file(); } @@ -975,10 +952,6 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_sizes: " + err); } - assertTrue("super block version: "+version_info[0], version_info[0] == 0); - assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); - assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); - assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); assertTrue("sizeof_addr size: "+size[0], size[0] == 4); assertTrue("sizeof_size size: "+size[1], size[1] == 8); } @@ -990,7 +963,6 @@ public class TestH5P { @Test public void testH5P_sym_k() { - int[] version_info = {255,255,255,255}; int[] size = {0,0}; try { @@ -1004,7 +976,10 @@ public class TestH5P { fcpl_id = H5.H5Fget_create_plist(H5fid); /* Get the file's version information */ - H5.H5Pget_version(fcpl_id, version_info); + H5F_info2_t finfo = H5.H5Fget_info(H5fid); + assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0); + assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0); + assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_sym_k(fcpl_id, size); deleteH5file(); } @@ -1012,10 +987,6 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_sym_k: " + err); } - assertTrue("super block version: "+version_info[0], version_info[0] == 0); - assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); - assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); - assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); assertTrue("symbol table tree rank: "+size[0], size[0] == 32); assertTrue("symbol table node size: "+size[1], size[1] == 8); } @@ -1027,7 +998,6 @@ public class TestH5P { @Test public void testH5P_istore_k() { - int[] version_info = {255,255,255,255}; int[] size = {0}; try { @@ -1041,7 +1011,10 @@ public class TestH5P { fcpl_id = H5.H5Fget_create_plist(H5fid); /* Get the file's version information */ - H5.H5Pget_version(fcpl_id, version_info); + H5F_info2_t finfo = H5.H5Fget_info(H5fid); + assertTrue("super block version: "+finfo.super_version, finfo.super_version == 1); + assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0); + assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_istore_k(fcpl_id, size); deleteH5file(); } @@ -1049,10 +1022,6 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_sym_k: " + err); } - assertTrue("super block version: "+version_info[0], version_info[0] == 1); - assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); - assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); - assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); assertTrue("chunked storage b-tree 1/2-rank: "+size[0], size[0] == 64); } diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index add1af4..7fb1bae 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -325,7 +325,7 @@ TESTING JUnit-TestH5 # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5.ext > JUnit-TestH5.out @@ -346,7 +346,7 @@ TESTING JUnit-TestH5Eparams # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Eparams.ext > JUnit-TestH5Eparams.out @@ -367,7 +367,7 @@ TESTING JUnit-TestH5Eregister # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Eregister.ext > JUnit-TestH5Eregister.out @@ -388,7 +388,7 @@ TESTING JUnit-TestH5Fparams # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Fparams.ext > JUnit-TestH5Fparams.out @@ -409,7 +409,7 @@ TESTING JUnit-TestH5Fbasic # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Fbasic.ext > JUnit-TestH5Fbasic.out @@ -430,7 +430,7 @@ TESTING JUnit-TestH5F # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5F.ext > JUnit-TestH5F.out @@ -451,7 +451,7 @@ TESTING JUnit-TestH5Fswmr # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Fswmr.ext > JUnit-TestH5Fswmr.out @@ -472,7 +472,7 @@ TESTING JUnit-TestH5Gbasic # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Gbasic.ext > JUnit-TestH5Gbasic.out @@ -493,7 +493,7 @@ TESTING JUnit-TestH5G # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5G.ext > JUnit-TestH5G.out @@ -514,7 +514,7 @@ TESTING JUnit-TestH5Sbasic # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Sbasic.ext > JUnit-TestH5Sbasic.out @@ -535,7 +535,7 @@ TESTING JUnit-TestH5S # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5S.ext > JUnit-TestH5S.out @@ -556,7 +556,7 @@ TESTING JUnit-TestH5Tparams # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Tparams.ext > JUnit-TestH5Tparams.out @@ -577,7 +577,7 @@ TESTING JUnit-TestH5Tbasic # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Tbasic.ext > JUnit-TestH5Tbasic.out @@ -598,7 +598,7 @@ TESTING JUnit-TestH5T # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5T.ext > JUnit-TestH5T.out @@ -619,7 +619,7 @@ TESTING JUnit-TestH5Dparams # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Dparams.ext > JUnit-TestH5Dparams.out @@ -640,7 +640,7 @@ TESTING JUnit-TestH5D # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5D.ext > JUnit-TestH5D.out @@ -661,7 +661,7 @@ TESTING JUnit-TestH5Dplist # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Dplist.ext > JUnit-TestH5Dplist.out @@ -682,7 +682,7 @@ TESTING JUnit-TestH5Lparams # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Lparams.ext > JUnit-TestH5Lparams.out @@ -703,7 +703,7 @@ TESTING JUnit-TestH5Lbasic # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Lbasic.ext > JUnit-TestH5Lbasic.out @@ -724,7 +724,7 @@ TESTING JUnit-TestH5Lcreate # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Lcreate.ext > JUnit-TestH5Lcreate.out @@ -745,7 +745,7 @@ TESTING JUnit-TestH5R # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5R.ext > JUnit-TestH5R.out @@ -766,7 +766,7 @@ TESTING JUnit-TestH5P # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5P.ext > JUnit-TestH5P.out @@ -787,7 +787,7 @@ TESTING JUnit-TestH5PData # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5PData.ext > JUnit-TestH5PData.out @@ -808,7 +808,7 @@ TESTING JUnit-TestH5Pfapl # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Pfapl.ext > JUnit-TestH5Pfapl.out @@ -829,7 +829,7 @@ TESTING JUnit-TestH5Pvirtual # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Pvirtual.ext > JUnit-TestH5Pvirtual.out @@ -850,7 +850,7 @@ TESTING JUnit-TestH5Plist # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Plist.ext > JUnit-TestH5Plist.out @@ -871,7 +871,7 @@ TESTING JUnit-TestH5A # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5A.ext > JUnit-TestH5A.out @@ -892,7 +892,7 @@ TESTING JUnit-TestH5Oparams # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Oparams.ext > JUnit-TestH5Oparams.out @@ -913,7 +913,7 @@ TESTING JUnit-TestH5Obasic # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Obasic.ext > JUnit-TestH5Obasic.out @@ -934,7 +934,7 @@ TESTING JUnit-TestH5Ocreate # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Ocreate.ext > JUnit-TestH5Ocreate.out @@ -955,7 +955,7 @@ TESTING JUnit-TestH5Ocopy # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Ocopy.ext > JUnit-TestH5Ocopy.out @@ -976,7 +976,7 @@ TESTING JUnit-TestH5PL # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5PL.ext > JUnit-TestH5PL.out @@ -997,7 +997,7 @@ TESTING JUnit-TestH5VL # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5VL.ext > JUnit-TestH5VL.out @@ -1018,7 +1018,7 @@ TESTING JUnit-TestH5Z # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Z.ext > JUnit-TestH5Z.out @@ -1039,7 +1039,7 @@ TESTING JUnit-TestH5E # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5E.ext > JUnit-TestH5E.out @@ -1060,7 +1060,7 @@ TESTING JUnit-TestH5Edefault # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out @@ -1082,7 +1082,7 @@ if test $USE_FILTER_SZIP = "yes"; then # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Giterate.ext > JUnit-TestH5Giterate.out diff --git a/java/test/testfiles/JUnit-TestH5Dplist.txt b/java/test/testfiles/JUnit-TestH5Dplist.txt index 1dfbed1..64e924a 100644 --- a/java/test/testfiles/JUnit-TestH5Dplist.txt +++ b/java/test/testfiles/JUnit-TestH5Dplist.txt @@ -1,7 +1,8 @@ JUnit version 4.11 +.testH5P_dset_no_attrs_hint .testH5Dset_extent Time: XXXX -OK (1 test) +OK (2 tests) diff --git a/java/test/testfiles/JUnit-TestH5Fbasic.txt b/java/test/testfiles/JUnit-TestH5Fbasic.txt index 2654624..cd4e282 100644 --- a/java/test/testfiles/JUnit-TestH5Fbasic.txt +++ b/java/test/testfiles/JUnit-TestH5Fbasic.txt @@ -1,7 +1,7 @@ JUnit version 4.11 .testH5Fget_mdc_size .testH5Fget_mdc_hit_rate -.testH5Fis_hdf5 +.testH5F_dset_no_attrs_hint .testH5Fget_freespace .testH5Fclose .testH5Fget_filesize diff --git a/java/test/testfiles/JUnit-TestH5Fparams.txt b/java/test/testfiles/JUnit-TestH5Fparams.txt index e91cbdc..91a8435 100644 --- a/java/test/testfiles/JUnit-TestH5Fparams.txt +++ b/java/test/testfiles/JUnit-TestH5Fparams.txt @@ -9,10 +9,8 @@ JUnit version 4.11 .testH5Funmount_null .testH5Fclose_negative .testH5Fopen_null -.testH5Fis_hdf5_null -.testH5Fis_hdf5_text Time: XXXX -OK (12 tests) +OK (10 tests) diff --git a/java/test/testfiles/JUnit-TestH5P.txt b/java/test/testfiles/JUnit-TestH5P.txt index c937ae2..01acadd 100644 --- a/java/test/testfiles/JUnit-TestH5P.txt +++ b/java/test/testfiles/JUnit-TestH5P.txt @@ -48,7 +48,6 @@ JUnit version 4.11 .testH5Pset_link_creation_order_invalidvalue .testH5P_sym_k .testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist -.testH5Pget_version_null .testH5Pset_scaleoffset_Invalidscale_factor .testH5Pget_elink_prefix_null .testH5Pget_data_transform_IllegalSize @@ -74,7 +73,6 @@ JUnit version 4.11 .testH5Pget_shared_mesg_index .testH5Pset_link_phase_change .testH5Pget_shared_mesg_nindexes -.testH5Pget_version .testH5Pset_elink_acc_flags_InvalidFlag1 .testH5Pset_elink_acc_flags_InvalidFlag2 .testH5Pget_link_phase_change_EqualsSet @@ -87,5 +85,5 @@ JUnit version 4.11 Time: XXXX -OK (85 tests) +OK (83 tests) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 26cf3ce..233c2cc 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -635,6 +635,7 @@ HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF +HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON HDF5_ENABLE_TRACE "Enable API tracing capability" OFF HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON diff --git a/release_docs/README_HPC b/release_docs/README_HPC new file mode 100644 index 0000000..bdeab67 --- /dev/null +++ b/release_docs/README_HPC @@ -0,0 +1,79 @@ +HDF5 version 1.11.4 currently under development + +HDF5 source tar files with the HPC prefix are intended for use on clusters where +configuration and build steps will be done on a login node and executable and +lib files that are built will be run on compute nodes. + +Note these differences from the regular CMake tar and zip files: + - Test programs produced by this tar file will be run using batch scripts. + - Serial and parallel HDF5options.cmake files, using parallel options by default. + +Note also that options are now available in HDF5 source to facilitate use of +toolchain files for using cross compilers available on login nodes to compile +HDF5 for compute nodes. + +Instructions to configure build and test HDF5 using CMake: + +1. The cmake version must be 3.10 or later (cmake --version). +2. Load or switch modules and set CC, FC, CXX for compilers desired. +3. run build-unix.sh to configure, build, test and package HDF5 with CMake. + +Contents: + +build-unix.sh Simple script for running CMake to configure, build, + test, and package HDF5. +CTestScript.cmake CMake script to configure, build, test and package + HDF5. +hdf5-<version> HDF5 source for <version>. +HDF5config.cmake CMake script to configure, build, test and package + HDF5. +HDF5Examples Source for HDF5 Examples. +HDF5options.cmake symlink to parallel or serial HDF5options.cmake files. + Default is parallel file, which builds and tests both + serial and parallel C and Fortran wrappers. + To build serial only, C Fortran and C++ wrappers, delete + The HDF5options.cmake link and run + 'ln -s ser-HDF5options.cmake HDF5options.cmake' to switch. +par-HDF5options.cmake Options file for HDF5 serial and parallel build and test. +ser-HDF5options.cmake Options file for HDF5 serial only build and test. +SZip.tar.gz Source for building SZip. +ZLib.tar.gz Source for buildng Zlib. + + +To cross compile with this HPC-CMake tar.gz HDF5 source file: +On Cray XC40 haswell login node for knl compute nodes using CMake and Cray modules: + 1. Uncomment line in HDF5options.txt to use a toolchain file - line 106 for + config/toolchain/crayle.cmake. + 2. Uncomment lines 110, 111, and 115 - 122 of HDF5options.cmake. + Line 110 allows configuring to complete on the haswell node. + Line 111 switches the compiler to build files for knl nodes. + Lines 115 - 122 set up test files to use sbatch to run build tests + in batch jobs on a knl compute node with 6 processes. + 3. Compiler module may be the default PrgEnv-intel/6.0.4 to use + intel/18.0.2 or other intel, PrgEnv-cray/6.0.4 to use cce/8.7.4, + or PrgEnv-gnu/6.0.4 for GCC compilers. PrgEnv-pgi/6.0.4 is also + available but has not been tested with this tar file. + 4. These CMake options are set in config/toolchain/crayle.cmake: + set(CMAKE_SYSTEM_NAME Linux) + set(CMAKE_COMPILER_VENDOR "CrayLinuxEnvironment") + set(CMAKE_C_COMPILER cc) + set(CMAKE_CXX_COMPILER c++) + set(CMAKE_Fortran_COMPILER ftn) + set(CMAKE_CROSSCOMPILING_EMULATOR "") + + 5. Settings for two other cross-compiling options are also in the + config/toolchain files which do not seem to be necessary with the + Cray PrgEnv-* modules + a. HDF5_USE_PREGEN. This option, along with the HDF5_USE_PREGEN_DIR + CMake variable would allow the use of an appropriate H5Tinit.c + file with type information generated on a compute node to be used + when cross compiling for those compute nodes. The use of the + variables in lines 110 and 111 of HDF5options.cmake file seem to + preclude needing this option with the available Cray modules and + CMake options. + b. HDF5_BATCH_H5DETECT and associated CMake variables. This option + when properly configured will run H5detect in a batch job on a + compute node at the beginning of the CMake build process. It + was also found to be unnecessary with the available Cray modules + and CMake options. +- diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8ee13ef..f9b2362 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.4 currently under development + version 1.11.4 currently under development ================================================================================ @@ -151,11 +151,32 @@ New Features (HDFFV-10287, RAW, 2018/07/18) - - + - Changed the default behavior in parallel when reading the same dataset in its entirely + (i.e. H5S_ALL dataset selection) which is being read by all the processes collectively. + The dataset mush be contiguous, less than 2GB, and of an atomic datatype. + The new behavior is the HDF5 library will use an MPI_Bcast to pass the data read from + the disk by the root process to the remain processes in the MPI communicator associated + with the HDF5 file. + + (MSB - 2019/01/02, HDFFV-10652) Fortran Library: ---------------- - - + - Added new Fortran derived type, c_h5o_info_t, which is interoperable with + C's h5o_info_t. This is needed for callback functions which + pass C's h5o_info_t data type definition. + + (MSB, 2019/01/08, HDFFV-10443) + + - Added new Fortran API, H5gmtime, which converts (C) 'time_t' structure + to Fortran DATE AND TIME storage format. + + (MSB, 2019/01/08, HDFFV-10443) + + - Added new Fortran 'fields' optional parameter to: h5ovisit_f, h5oget_info_by_name_f, + h5oget_info, h5oget_info_by_idx and h5ovisit_by_name_f. + + (MSB, 2019/01/08, HDFFV-10443) C++ Library: ------------ @@ -256,6 +277,35 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - Performance issue when closing an object + + The slow down is due to the search of the "tag_list" to find + out the "corked" status of an object and "uncork" it if so. + + Improve porformance by skipping the search of the "tag_list" + if there are no "corked" objects when closing an object. + + (VC - 2019/2/6) + + - Fixed a potential invalid memory access and failure that could occur when + decoding an unknown object header message (from a future version of the + library). + + (NAF - 2019/01/07) + + - Deleting attributes in dense storage + + The library aborts with "infinite loop closing library" after + attributes in dense storage are created and then deleted. + + When deleting the attribute nodes from the name index v2 B-tree, + if an attribute is found in the intermediate B-tree nodes, + which may be merged/redistributed in the process, we need to + free the dynamically allocated spaces for the intermediate + decoded attribute. + + (VC - 2018/12/26, HDFFV-10659) + - Allow H5detect and H5make_libsettings to take a file as an argument. Rather than only writing to stdout, add a command argument to name @@ -327,12 +377,27 @@ Bug Fixes since HDF5-1.10.3 release Fortran -------- + - Added symbolic links libhdf5_hl_fortran.so to libhdf5hl_fortran.so and + libhdf5_hl_fortran.a to libhdf5hl_fortran.a in hdf5/lib directory for + autotools installs. These were added to match the name of the files + installed by cmake and the general pattern of hl lib files. We will + change the names of the installed lib files to the matching name in + the next major release. + + (LRK - 2019/01/04, HDFFV-10596) + - Made Fortran specific subroutines PRIVATE in generic procedures. Effected generic procedures were functions in H5A, H5D, H5P, H5R and H5T. (MSB, 2018/12/04, HDFFV-10511) + - Fixed issue with Fortran not returning h5o_info_t field values + meta_size%attr%index_size and meta_size%attr%heap_size. + + (MSB, 2018/1/8, HDFFV-10443) + + Tools ----- - @@ -359,6 +424,11 @@ Bug Fixes since HDF5-1.10.3 release Testing ------- + - Fixed a test failure in testpar/t_dset.c caused by + the test trying to use the parallel filters feature + on MPI-2 implementations. + + (JTH, 2019/2/7) Bug Fixes since HDF5-1.10.2 release ================================== @@ -601,6 +671,15 @@ Bug Fixes since HDF5-1.10.2 release Testing ------- + - The dt_arith test failed on IBM Power8 and Power9 machines when testing + conversions from or to long double types, especially when special values + such as infinity or NAN were involved. In some cases the results differed + by extremely small amounts from those on other machines, while some other + tests resulted in segmentation faults. These conversion tests with long + double types have been disabled for ppc64 machines until the problems are + better understood and can be properly addressed. + + (SRL - 2019/01/07, TRILAB-98) Supported Platforms =================== diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 40b64f5..6b105a9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -943,6 +943,27 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") endif () +if (LOCAL_BATCH_TEST) + if ("${LOCAL_BATCH_SCRIPT_COMMAND}" STREQUAL "raybsub") + configure_file ( + ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_COMMAND} + ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_COMMAND} ESCAPE_QUOTES @ONLY + ) + endif () + if (LOCAL_BATCH_SCRIPT_NAME) + configure_file ( + ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_NAME}.in.cmake + ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_NAME} ESCAPE_QUOTES @ONLY + ) + endif () + if (LOCAL_BATCH_SCRIPT_PARALLEL_NAME) + configure_file ( + ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}.in.cmake + ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME} ESCAPE_QUOTES @ONLY + ) + endif () +endif () + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") @@ -951,6 +951,8 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name && size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name cannot be NULL if size is non-zero") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -1612,7 +1612,7 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, done: /* If currently logging, generate a message */ if(f->shared->cache->log_info->logging) - if(H5C_log_write_unprotect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, ret_value) < 0) + if(H5C_log_write_unprotect_entry_msg(f->shared->cache, addr, type->id, flags, ret_value) < 0) HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) @@ -2403,8 +2403,18 @@ H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked) HDassert(H5F_addr_defined(obj_addr)); HDassert(action == H5AC__SET_CORK || action == H5AC__UNCORK || action == H5AC__GET_CORKED); - if(action == H5AC__GET_CORKED) - HDassert(corked); + /* Skip the search on "tag_list" when there are no "corked" objects. + * This is done to mitigate the slow down when closing objects. + * Re-visit this optimization when we optimize tag info management + * in the future. + */ + if(action == H5AC__GET_CORKED) { + HDassert(corked); + if(H5C_get_num_objs_corked(f->shared->cache) == 0) { + *corked = FALSE; + HGOTO_DONE(SUCCEED) + } + } if(H5C_cork(f->shared->cache, obj_addr, action, corked) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Cannot perform the cork action") diff --git a/src/H5Adense.c b/src/H5Adense.c index 5bed82d..021fa76 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -300,18 +300,49 @@ static herr_t H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) { H5A_t const **user_attr = (H5A_t const **)_user_attr; /* User data from v2 B-tree attribute lookup */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_STATIC /* Check arguments */ HDassert(attr); HDassert(user_attr); + HDassert(took_ownership); + /* + * If there is an attribute already stored in "user_attr", + * we need to free the dynamially allocated spaces for the + * attribute, otherwise we got infinite loop closing library due to + * outstanding allocation. (HDFFV-10659) + * + * This callback is used by H5A__dense_remove() to close/free the + * attribute stored in "user_attr" (via H5O__msg_free_real()) after + * the attribute node is deleted from the name index v2 B-tree. + * The issue is: + * When deleting the attribute node from the B-tree, + * if the attribute is found in the intermediate B-tree nodes, + * which may be merged/redistributed, we need to free the dynamically + * allocated spaces for the intermediate decoded attribute. + */ + if(*user_attr != NULL) { + H5A_t *old_attr = *user_attr; + if(old_attr->shared) { + /* Free any dynamically allocated items */ + if(H5A__free(old_attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") + + /* Destroy shared attribute struct */ + old_attr->shared = H5FL_FREE(H5A_shared_t, old_attr->shared); + } /* end if */ + + old_attr = H5FL_FREE(H5A_t, old_attr); + } /* end if */ /* Take over attribute ownership */ *user_attr = attr; *took_ownership = TRUE; - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_fnd_cb() */ @@ -327,6 +327,7 @@ H5C_create(size_t max_cache_size, /* Tagging Field Initializations */ cache_ptr->ignore_tags = FALSE; + cache_ptr->num_objs_corked = 0; cache_ptr->slist_changed = FALSE; cache_ptr->slist_len = 0; @@ -7729,6 +7730,8 @@ H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked) /* Set the corked status for the entire object */ tag_info->corked = TRUE; + cache_ptr->num_objs_corked++; + } /* end if */ else { /* Sanity check */ @@ -7740,6 +7743,7 @@ H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked) /* Set the corked status for the entire object */ tag_info->corked = FALSE; + cache_ptr->num_objs_corked--; /* Remove the tag info from the tag list, if there's no more entries with this tag */ if(0 == tag_info->entry_cnt) { @@ -201,6 +201,7 @@ typedef struct H5CX_t { /* Internal: File open settings (not inherently related to parallel but currently only used in parallel) */ hbool_t disable_file_locking; + hbool_t rank0_bcast; /* Whether a dataset meets read-with-rank0-and-bcast requirements */ #endif /* H5_HAVE_PARALLEL */ /* Cached DXPL properties */ @@ -264,6 +265,8 @@ typedef struct H5CX_t { hbool_t mpio_coll_chunk_multi_ratio_coll_set; /* Whether instrumented "collective chunk multi ratio coll" value is set */ int mpio_coll_chunk_multi_ratio_ind; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */ hbool_t mpio_coll_chunk_multi_ratio_ind_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */ + hbool_t mpio_coll_rank0_bcast; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */ + hbool_t mpio_coll_rank0_bcast_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */ #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ #endif /* H5_HAVE_PARALLEL */ @@ -271,9 +274,11 @@ typedef struct H5CX_t { size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ - /* Cached VOL properties */ - void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */ - hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */ + /* Cached VOL settings */ + H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */ + hbool_t vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */ + void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */ + hbool_t vol_wrap_ctx_valid; /* Whether VOL connector's "wrap context" for creating IDs is valid */ } H5CX_t; /* Typedef for nodes on the API context stack */ @@ -959,6 +964,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_set_vol_connector_prop + * + * Purpose: Sets the VOL connector ID & info for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * January 3, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + HDmemcpy(&(*head)->ctx.vol_connector_prop, vol_connector_prop, sizeof(H5VL_connector_prop_t)); + + /* Mark the value as valid */ + (*head)->ctx.vol_connector_prop_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_vol_connector_prop() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_dxpl * * Purpose: Retrieves the DXPL ID for the current API call context. @@ -1047,6 +1086,42 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_get_vol_connector_prop + * + * Purpose: Retrieves the VOL connector ID & info for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * January 3, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_connector_prop); + HDassert(head && *head); + + /* Check for value that was set */ + if((*head)->ctx.vol_connector_prop_valid) + /* Get the value */ + HDmemcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t)); + else + HDmemset(vol_connector_prop, 0, sizeof(H5VL_connector_prop_t)); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vol_connector_prop() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_tag * * Purpose: Retrieves the object tag for the current API call context. @@ -1211,6 +1286,32 @@ H5CX_get_disable_file_locking(void) FUNC_LEAVE_NOAPI((*head)->ctx.disable_file_locking) } /* end H5CX_get_disable_file_locking() */ + + +/*------------------------------------------------------------------------- + * Function: H5CX_get_mpio_rank0_bcast + * + * Purpose: Retrieves if the dataset meets read-with-rank0-and-bcast requirements for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: M. Breitenfeld + * December 31, 2018 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5CX_get_mpio_rank0_bcast(void) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(head && *head); + + FUNC_LEAVE_NOAPI((*head)->ctx.rank0_bcast) +} /* end H5CX_get_mpio_rank0_bcast() */ #endif /* H5_HAVE_PARALLEL */ @@ -2170,6 +2271,34 @@ H5CX_set_disable_file_locking(hbool_t disable_file_locking) FUNC_LEAVE_NOAPI_VOID } /* end H5CX_set_disable_file_locking() */ + + +/*------------------------------------------------------------------------- + * Function: H5CX_set_mpio_rank0_bcast + * + * Purpose: Sets the "dataset meets read-with-rank0-and-bcast requirements" flag for the current API call context. + * + * Return: <none> + * + * Programmer: M. Breitenfeld + * December 31, 2018 + * + *------------------------------------------------------------------------- + */ +void +H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity checks */ + HDassert(head && *head); + + (*head)->ctx.rank0_bcast = rank0_bcast; + + FUNC_LEAVE_NOAPI_VOID +} /* end H5CX_set_mpio_rank0_bcast() */ #endif /* H5_HAVE_PARALLEL */ @@ -2581,6 +2710,40 @@ H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_in done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_test_set_mpio_coll_chunk_multi_ratio_ind() */ + + +/*------------------------------------------------------------------------- + * Function: H5CX_test_set_mpio_coll_rank0_bcast + * + * Purpose: Sets the instrumented "read-with-rank0-bcast" flag for the current API call context. + * + * Note: Only sets value if property set in DXPL + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * January 2, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity checks */ + HDassert(head && *head); + HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || + (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + + H5CX_TEST_SET_PROP(H5D_XFER_COLL_RANK0_BCAST_NAME, mpio_coll_rank0_bcast) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_test_set_mpio_coll_rank0_bcast() */ #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ #endif /* H5_HAVE_PARALLEL */ @@ -2625,6 +2788,7 @@ H5CX__pop_common(void) H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, mpio_coll_chunk_link_num_false) H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, mpio_coll_chunk_multi_ratio_coll) H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, mpio_coll_chunk_multi_ratio_ind) + H5CX_SET_PROP(H5D_XFER_COLL_RANK0_BCAST_NAME, mpio_coll_rank0_bcast) #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index f2e391e..04c6f55 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -64,11 +64,13 @@ H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t loc_id, hbool_t is_collective); H5_DLL herr_t H5CX_set_loc(hid_t loc_id); H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx); +H5_DLL herr_t H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop); /* "Getter" routines for API context info */ H5_DLL hid_t H5CX_get_dxpl(void); H5_DLL hid_t H5CX_get_lapl(void); H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx); +H5_DLL herr_t H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop); H5_DLL haddr_t H5CX_get_tag(void); H5_DLL H5AC_ring_t H5CX_get_ring(void); #ifdef H5_HAVE_PARALLEL @@ -76,6 +78,7 @@ H5_DLL hbool_t H5CX_get_coll_metadata_read(void); H5_DLL herr_t H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype); H5_DLL hbool_t H5CX_get_mpi_file_flushing(void); H5_DLL hbool_t H5CX_get_disable_file_locking(void); +H5_DLL hbool_t H5CX_get_mpio_rank0_bcast(void); #endif /* H5_HAVE_PARALLEL */ /* "Getter" routines for DXPL properties cached in API context */ @@ -112,6 +115,7 @@ H5_DLL herr_t H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype H5_DLL herr_t H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt); H5_DLL void H5CX_set_mpi_file_flushing(hbool_t flushing); H5_DLL void H5CX_set_disable_file_locking(hbool_t disable_file_locking); +H5_DLL void H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast); #endif /* H5_HAVE_PARALLEL */ /* "Setter" routines for DXPL properties cached in API context */ @@ -137,6 +141,7 @@ H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_link_num_true(int mpio_coll_chunk_li H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_link_num_false(int mpio_coll_chunk_link_num_false); H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(int mpio_coll_chunk_multi_ratio_coll); H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_ind); +H5_DLL herr_t H5CX_test_set_mpio_coll_rank0_bcast(hbool_t rank0_bcast); #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Clog.c b/src/H5Clog.c index 0ae7f13..cf9b7e8 100644 --- a/src/H5Clog.c +++ b/src/H5Clog.c @@ -887,7 +887,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_log_write_unprotect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, +H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value) { herr_t ret_value = SUCCEED; @@ -898,9 +898,8 @@ H5C_log_write_unprotect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, HDassert(cache); /* Write a log message */ - HDassert(entry); if(cache->log_info->cls->write_unprotect_entry_log_msg) - if(cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, entry, type_id, flags, fxn_ret_value) < 0) + if(cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, address, type_id, flags, fxn_ret_value) < 0) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unprotect entry call failed") done: diff --git a/src/H5Clog.h b/src/H5Clog.h index 9ba6786..0235c4a 100644 --- a/src/H5Clog.h +++ b/src/H5Clog.h @@ -59,7 +59,7 @@ typedef struct H5C_log_class_t { herr_t (*write_resize_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value); herr_t (*write_unpin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); herr_t (*write_destroy_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); - herr_t (*write_unprotect_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); + herr_t (*write_unprotect_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value); herr_t (*write_set_cache_config_log_msg)(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value); herr_t (*write_remove_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); @@ -102,7 +102,7 @@ H5_DLL herr_t H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entr H5_DLL herr_t H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value); H5_DLL herr_t H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); H5_DLL herr_t H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); -H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value); H5_DLL herr_t H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config, herr_t fxn_ret_value); H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index ccfa222..dd9e9b2 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -41,7 +41,7 @@ /****************/ /* Max log message size */ -#define H5C_MAX_JSON_LOG_MSG_SIZE 128 +#define H5C_MAX_JSON_LOG_MSG_SIZE 1024 /******************/ @@ -87,7 +87,7 @@ static herr_t H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache static herr_t H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value); static herr_t H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); static herr_t H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); -static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value); static herr_t H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value); static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); @@ -1232,7 +1232,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, +H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value) { H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); @@ -1243,7 +1243,6 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *en /* Sanity checks */ HDassert(json_udata); HDassert(json_udata->message); - HDassert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, @@ -1257,7 +1256,7 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *en \"returned\":%d\ },\n\ " - , (long long)HDtime(NULL), (unsigned long)entry->addr, + , (long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)fxn_ret_value); /* Write the log message to the file */ diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index f7d6889..7c1305c 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -82,7 +82,7 @@ static herr_t H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cach static herr_t H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value); static herr_t H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); static herr_t H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); -static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value); static herr_t H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value); static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); @@ -872,7 +872,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C__trace_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, +H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value) { H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); @@ -883,11 +883,10 @@ H5C__trace_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *e /* Sanity checks */ HDassert(trace_udata); HDassert(trace_udata->message); - HDassert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n", - (unsigned long)(entry->addr), type_id, flags, (int)fxn_ret_value); + (unsigned long)(address), type_id, flags, (int)fxn_ret_value); /* Write the log message to the file */ if(H5C__trace_write_log_message(trace_udata) < 0) diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 9201afb..9156c0d 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -3823,6 +3823,13 @@ typedef struct H5C_tag_info_t { * * ignore_tags: Boolean flag to disable tag validation during entry insertion. * + * num_objs_corked: Unsigned integer field containing the number of objects + * that are "corked". The "corked" status of an object is + * found by searching the "tag_list". This field is added + * for optimization so that the skip list search on "tag_list" + * can be skipped if this field is zero, i.e. no "corked" + * objects. + * * When a cache entry is protected, it must be removed from the LRU * list(s) as it cannot be either flushed or evicted until it is unprotected. * The following fields are used to implement the protected list (pl). @@ -4693,6 +4700,7 @@ struct H5C_t { /* Fields for maintaining list of tagged entries */ H5SL_t * tag_list; hbool_t ignore_tags; + uint32_t num_objs_corked; /* Fields for tracking protected entries */ uint32_t pl_len; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index c39c1df..d4ed6fc 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -2301,6 +2301,7 @@ H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests); H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr); H5_DLL hbool_t H5C_get_ignore_tags(const H5C_t *cache_ptr); +H5_DLL uint32_t H5C_get_num_objs_corked(const H5C_t *cache_ptr); H5_DLL herr_t H5C_retag_entries(H5C_t * cache_ptr, haddr_t src_tag, haddr_t dest_tag); H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked); H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring); diff --git a/src/H5Ctag.c b/src/H5Ctag.c index 0f08ede..807e68d 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -175,6 +175,32 @@ H5C_get_ignore_tags(const H5C_t *cache_ptr) /*------------------------------------------------------------------------- * + * Function: H5C_get_num_objs_corked + * + * Purpose: Retrieve the 'num_objs_corked' field for the cache + * + * Return: 'num_objs_corked' value (can't fail) + * + * Programmer: Vailin Choi; Feb 2019 + * + *------------------------------------------------------------------------- + */ +uint32_t +H5C_get_num_objs_corked(const H5C_t *cache_ptr) +{ + FUNC_ENTER_NOAPI_NOERR + + /* Sanity checks */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + + /* Return value for num_objs_corked */ + FUNC_LEAVE_NOAPI(cache_ptr->num_objs_corked) +} /* H5C_get_num_objs_corked */ + + +/*------------------------------------------------------------------------- + * * Function: H5C__tag_entry * * Purpose: Tags an entry with the provided tag (contained in the API context). diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 91f3b91..e165569 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1493,6 +1493,9 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t /* Set chunk location & hyperslab size */ for(u = 0; u < fm->f_ndims; u++) { + /* Validate this chunk dimension */ + if(fm->layout->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) HDassert(sel_start[u] == sel_end[u]); chunk_info->scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u]; coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u]; @@ -1580,6 +1583,9 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t /* Set initial chunk location & hyperslab size */ for(u = 0; u < fm->f_ndims; u++) { + /* Validate this chunk dimension */ + if(fm->layout->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) scaled[u] = start_scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u]; coords[u] = start_coords[u] = scaled[u] * fm->layout->u.chunk.dim[u]; end[u] = (coords[u] + fm->chunk_dim[u]) - 1; @@ -1992,13 +1998,13 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u */ /* Get the chunk node from the skip list */ if(NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index))) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list") + HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, H5_ITER_ERROR, "can't locate chunk in skip list") /* Check if the chunk already has a memory space */ if(NULL == chunk_info->mspace) { /* Copy the template memory chunk dataspace */ if(NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy file space") } /* end else */ /* Update the "last chunk seen" information */ @@ -2008,21 +2014,21 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u /* Get coordinates of selection iterator for memory */ if(H5S_SELECT_ITER_COORDS(&fm->mem_iter, coords_in_mem) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, H5_ITER_ERROR, "unable to get iterator coordinates") /* Add point to memory selection for chunk */ if(fm->msel_type == H5S_SEL_POINTS) { if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element") } /* end if */ else { if(H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element") } /* end else */ /* Move memory selection iterator to next element in selection */ if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, H5_ITER_ERROR, "unable to move to next iterator location") done: FUNC_LEAVE_NOAPI(ret_value) @@ -4043,6 +4049,9 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ * assume here that all elements of space_dim are > 0. This is checked at * the top of this function. */ for(op_dim=0; op_dim<space_ndims; op_dim++) { + /* Validate this chunk dimension */ + if(chunk_dim[op_dim] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim) min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim]; max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim]; @@ -4484,13 +4493,17 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) /* Start off with this dimension marked as not needing to be modified */ new_full_dim[op_dim] = FALSE; + /* Validate this chunk dimension */ + if(chunk_dim[op_dim] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim) + /* Calculate offset of first previously incomplete chunk in this * dimension */ - old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]); + old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]); /* Calculate the largest offset of chunks that might need to be * modified in this dimension */ - max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim], + max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim], MAX((space_dim[op_dim] / chunk_dim[op_dim]), 1) - 1); /* Check for old_dim aligned with chunk boundary in this dimension, if @@ -4626,6 +4639,8 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size") /* Distribute evenly the number of blocks between processes. */ + if(mpi_size == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero") num_blocks = chunk_info->num_io / mpi_size; /* value should be the same on all procs */ /* after evenly distributing the blocks between processes, are @@ -5066,6 +5081,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) HDmemset(min_mod_chunk_sc, 0, sizeof(min_mod_chunk_sc)); HDmemset(max_mod_chunk_sc, 0, sizeof(max_mod_chunk_sc)); for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { + /* Validate this chunk dimension */ + if(chunk_dim[op_dim] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim) + /* Calculate the largest offset of chunks that might need to be * modified in this dimension */ max_mod_chunk_sc[op_dim] = (old_dim[op_dim] - 1) / chunk_dim[op_dim]; @@ -5721,9 +5740,12 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* (background buffer has already been zeroed out, if not expanding) */ if(udata->cpy_info->expand_ref) { size_t ref_count; + size_t dt_size; /* Determine # of reference elements to copy */ - ref_count = nbytes / H5T_get_size(udata->dt_src); + if((dt_size = H5T_get_size(udata->dt_src)) == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "size must not be 0") + ref_count = nbytes / dt_size; /* Copy the reference elements */ if(H5O_copy_expand_ref(udata->file_src, buf, udata->idx_info_dst->f, bkg, ref_count, H5T_get_ref_type(udata->dt_src), udata->cpy_info) < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index fe85d23..2f87e38 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -657,22 +657,12 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Various MPI based checks */ #ifdef H5_HAVE_PARALLEL - if H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI) { - /* If MPI based VFD is used, no VL datatype support yet. */ + if(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI)) { + /* If MPI based VFD is used, no VL or region reference datatype support yet. */ /* This is because they use the global heap in the file and we don't */ /* support parallel access of that yet */ - if(H5T_detect_class(type_info.mem_type, H5T_VLEN, FALSE) > 0) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet") - - /* If MPI based VFD is used, no VL datatype support yet. */ - /* This is because they use the global heap in the file and we don't */ - /* support parallel access of that yet */ - /* We should really use H5T_detect_class() here, but it will be difficult - * to detect the type of the reference if it is nested... -QAK - */ - if(H5T_get_class(type_info.mem_type, TRUE) == H5T_REFERENCE && - H5T_get_ref_type(type_info.mem_type) == H5R_DATASET_REGION) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet") + if(H5T_is_vl_storage(type_info.mem_type) > 0) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL or region reference datatypes yet") } /* end if */ else { H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */ @@ -1041,16 +1031,13 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, if(type_info->request_nelmts == 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small") - /* - * Get a temporary buffer for type conversion unless the app has already + /* Get a temporary buffer for type conversion unless the app has already * supplied one through the xfer properties. Instead of allocating a - * buffer which is the exact size, we allocate the target size. The - * malloc() is usually less resource-intensive if we allocate/free the - * same size over and over. + * buffer which is the exact size, we allocate the target size. */ if(NULL == (type_info->tconv_buf = (uint8_t *)tconv_buf)) { /* Allocate temporary buffer */ - if(NULL == (type_info->tconv_buf = H5FL_BLK_MALLOC(type_conv, target_size))) + if(NULL == (type_info->tconv_buf = H5FL_BLK_CALLOC(type_conv, target_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") type_info->tconv_buf_allocated = TRUE; } /* end if */ @@ -1153,15 +1140,19 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, hbool_t local_error_message_previously_written = FALSE; hbool_t global_error_message_previously_written = FALSE; size_t index; - char local_no_collective_cause_string[256] = ""; - char global_no_collective_cause_string[256] = ""; + size_t cause_strings_len; + char local_no_collective_cause_string[512] = ""; + char global_no_collective_cause_string[512] = ""; const char *cause_strings[] = { "independent I/O was requested", "datatype conversions were required", "data transforms needed to be applied", "optimized MPI types flag wasn't set", "one of the dataspaces was neither simple nor scalar", "dataset was not contiguous or chunked", - "parallel writes to filtered datasets are disabled" }; + "parallel writes to filtered datasets are disabled", + "an error occurred while checking if collective I/O was possible" }; + + cause_strings_len = sizeof(cause_strings) / sizeof(cause_strings[0]); if(H5CX_get_mpio_local_no_coll_cause(&local_no_collective_cause) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get local no collective cause value") @@ -1170,7 +1161,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, /* Append each of the "reason for breaking collective I/O" error messages to the * local and global no collective cause strings */ - for (cause = 1, index = 0; cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE; cause <<= 1, index++) { + for (cause = 1, index = 0; (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (index < cause_strings_len); cause <<= 1, index++) { size_t cause_strlen = HDstrlen(cause_strings[index]); if (cause & local_no_collective_cause) { diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 2c06800..f5da33d 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -37,7 +37,6 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ -#include "H5FDmpi.h" /* MPI-based file drivers */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ @@ -89,10 +88,20 @@ /******************/ /* Combine chunk address and chunk info into a struct for better performance. */ typedef struct H5D_chunk_addr_info_t { - haddr_t chunk_addr; - H5D_chunk_info_t chunk_info; + haddr_t chunk_addr; + H5D_chunk_info_t chunk_info; } H5D_chunk_addr_info_t; +/* Rank 0 Bcast values */ +typedef enum H5D_mpio_no_rank0_bcast_cause_t { + H5D_MPIO_RANK0_BCAST = 0x00, + H5D_MPIO_RANK0_NOT_H5S_ALL = 0x01, + H5D_MPIO_RANK0_NOT_CONTIGUOUS = 0x02, + H5D_MPIO_RANK0_NOT_FIXED_SIZE = 0x04, + H5D_MPIO_RANK0_GREATER_THAN_2GB = 0x08 +} H5D_mpio_no_rank0_bcast_cause_t; + + /* * Information about a single chunk when performing collective filtered I/O. All * of the fields of one of these structs are initialized at the start of collective @@ -281,8 +290,10 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, const H5S_t *mem_space, const H5D_type_info_t *type_info) { H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */ - unsigned local_cause = 0; /* Local reason(s) for breaking collective mode */ - unsigned global_cause = 0; /* Global reason(s) for breaking collective mode */ + unsigned local_cause[2] = {0,0}; /* [0] Local reason(s) for breaking collective mode */ + /* [1] Flag if dataset is both: H5S_ALL and small */ + unsigned global_cause[2] = {0,0}; /* Global reason(s) for breaking collective mode */ + htri_t is_vl_storage; /* Whether the dataset's datatype is stored in a variable-length form */ htri_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -296,36 +307,37 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, /* For independent I/O, get out quickly and don't try to form consensus */ if(H5CX_get_io_xfer_mode(&io_xfer_mode) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + /* Set error flag, but keep going */ + local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE; if(io_xfer_mode == H5FD_MPIO_INDEPENDENT) - local_cause |= H5D_MPIO_SET_INDEPENDENT; + local_cause[0] |= H5D_MPIO_SET_INDEPENDENT; /* Optimized MPI types flag must be set */ /* (based on 'HDF5_MPI_OPT_TYPES' environment variable) */ if(!H5FD_mpi_opt_types_g) - local_cause |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED; + local_cause[0] |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED; /* Don't allow collective operations if datatype conversions need to happen */ if(!type_info->is_conv_noop) - local_cause |= H5D_MPIO_DATATYPE_CONVERSION; + local_cause[0] |= H5D_MPIO_DATATYPE_CONVERSION; /* Don't allow collective operations if data transform operations should occur */ if(!type_info->is_xform_noop) - local_cause |= H5D_MPIO_DATA_TRANSFORMS; + local_cause[0] |= H5D_MPIO_DATA_TRANSFORMS; /* Check whether these are both simple or scalar dataspaces */ if(!((H5S_SIMPLE == H5S_GET_EXTENT_TYPE(mem_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(mem_space)) && (H5S_SIMPLE == H5S_GET_EXTENT_TYPE(file_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(file_space)))) - local_cause |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; + local_cause[0] |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; /* Dataset storage must be contiguous or chunked */ if(!(io_info->dset->shared->layout.type == H5D_CONTIGUOUS || io_info->dset->shared->layout.type == H5D_CHUNKED)) - local_cause |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; + local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; /* check if external-file storage is used */ if(io_info->dset->shared->dcpl_cache.efl.nused > 0) - local_cause |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; + local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; /* The handling of memory space is different for chunking and contiguous * storage. For contiguous storage, mem_space and file_space won't change @@ -340,31 +352,84 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, * is less than 3. The functions needed (MPI_Mprobe and MPI_Imrecv) will * not be available. */ - if (io_info->op_type == H5D_IO_OP_WRITE && - io_info->dset->shared->layout.type == H5D_CHUNKED && - io_info->dset->shared->dcpl_cache.pline.nused > 0) - local_cause |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED; + if(io_info->op_type == H5D_IO_OP_WRITE && + io_info->dset->shared->layout.type == H5D_CHUNKED && + io_info->dset->shared->dcpl_cache.pline.nused > 0) + local_cause[0] |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED; #endif + /* Check if we are able to do a MPI_Bcast of the data from one rank + * instead of having all the processes involved in the collective I/O call. + */ + + /* Check to see if the process is reading the entire dataset */ + if(H5S_GET_SELECT_TYPE(file_space) != H5S_SEL_ALL) + local_cause[1] |= H5D_MPIO_RANK0_NOT_H5S_ALL; + /* Only perform this optimization for contigous datasets, currently */ + else if(H5D_CONTIGUOUS != io_info->dset->shared->layout.type) + /* Flag to do a MPI_Bcast of the data from one proc instead of + * having all the processes involved in the collective I/O. + */ + local_cause[1] |= H5D_MPIO_RANK0_NOT_CONTIGUOUS; + else if((is_vl_storage = H5T_is_vl_storage(type_info->dset_type)) < 0) + local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE; + else if(is_vl_storage) + local_cause[1] |= H5D_MPIO_RANK0_NOT_FIXED_SIZE; + else { + size_t type_size; /* Size of dataset's datatype */ + + /* Retrieve the size of the dataset's datatype */ + if(0 == (type_size = H5T_GET_SIZE(type_info->dset_type))) + local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE; + else { + hssize_t snelmts; /* [Signed] # of elements in dataset's dataspace */ + + /* Retrieve the size of the dataset's datatype */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0) + local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE; + else { + hsize_t dset_size; + + /* Determine dataset size */ + dset_size = ((hsize_t)snelmts) * type_size; + + /* If the size of the dataset is less than 2GB then do an MPI_Bcast + * of the data from one process instead of having all the processes + * involved in the collective I/O. + */ + if(dset_size > ((hsize_t)(2.0F * H5_GB) - 1)) + local_cause[1] |= H5D_MPIO_RANK0_GREATER_THAN_2GB; + } /* end else */ + } /* end else */ + } /* end else */ + /* Check for independent I/O */ - if(local_cause & H5D_MPIO_SET_INDEPENDENT) - global_cause = local_cause; + if(local_cause[0] & H5D_MPIO_SET_INDEPENDENT) + global_cause[0] = local_cause[0]; else { int mpi_code; /* MPI error code */ /* Form consensus opinion among all processes about whether to perform * collective I/O */ - if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 1, MPI_UNSIGNED, MPI_BOR, io_info->comm))) + if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code) } /* end else */ /* Set the local & global values of no-collective-cause in the API context */ - H5CX_set_mpio_local_no_coll_cause(local_cause); - H5CX_set_mpio_global_no_coll_cause(global_cause); + H5CX_set_mpio_local_no_coll_cause(local_cause[0]); + H5CX_set_mpio_global_no_coll_cause(global_cause[0]); + + /* Set read-with-rank0-and-bcast flag if possible */ + if(global_cause[0] == 0 && global_cause[1] == 0) { + H5CX_set_mpio_rank0_bcast(TRUE); +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + H5CX_test_set_mpio_coll_rank0_bcast(TRUE); +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + } /* end if */ /* Set the return value, based on the global cause */ - ret_value = global_cause > 0 ? FALSE : TRUE; + ret_value = global_cause[0] > 0 ? FALSE : TRUE; done: FUNC_LEAVE_NOAPI(ret_value) @@ -3069,8 +3134,8 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk chunk_entry->chunk_states.new_chunk.length = chunk_entry->chunk_states.chunk_current.length; /* Currently, these chunk reads are done independently and will likely - * cause issues with collective metadata reads enabled. In the future, - * this should be refactored to use collective chunk reads - JTH */ + * cause issues with collective metadata reads enabled. In the future, + * this should be refactored to use collective chunk reads - JTH */ /* Get the original state of parallel I/O transfer mode */ if(H5CX_get_io_xfer_mode(&xfer_mode) < 0) diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index aaa3db2..6fb7889 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -95,7 +95,13 @@ /* Definitions for all collective chunk instrumentation properties */ #define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned) #define H5D_XFER_COLL_CHUNK_DEF 1 -#define H5D_XFER_COLL_CHUNK_FIX 0 + +/* General collective I/O instrumentation properties */ +#define H5D_XFER_COLL_RANK0_BCAST_NAME "coll_rank0_bcast" + +/* Definitions for general collective I/O instrumentation properties */ +#define H5D_XFER_COLL_RANK0_BCAST_SIZE sizeof(hbool_t) +#define H5D_XFER_COLL_RANK0_BCAST_DEF FALSE #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ /* Default temporary buffer size */ @@ -1484,7 +1484,7 @@ done: * * Purpose: Prints the error stack in some default way. This is just a * convenience function for H5Ewalk() with a function that - * prints error messages. Users are encouraged to write there + * prints error messages. Users are encouraged to write their * own more specific error handlers. * * Return: SUCCEED/FAIL @@ -1566,8 +1566,8 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Walk the error stack */ op.vers = 2; op.u.func2 = stack_func; - if(H5E__walk(estack, direction, &op, client_data) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + if((ret_value = H5E__walk(estack, direction, &op, client_data)) < 0) + HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Eint.c b/src/H5Eint.c index 540c9b1..66653ca 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -422,7 +422,7 @@ done: * Purpose: Private function to print the error stack in some default * way. This is just a convenience function for H5Ewalk() and * H5Ewalk2() with a function that prints error messages. - * Users are encouraged to write there own more specific error + * Users are encouraged to write their own more specific error * handlers. * * Return: SUCCEED/FAIL @@ -511,10 +511,9 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o void *client_data) { int i; /* Local index variable */ - herr_t status; /* Status from callback function */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(estack); @@ -530,9 +529,9 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o if(op->u.func1) { H5E_error1_t old_err; - status = SUCCEED; + ret_value = SUCCEED; if(H5E_WALK_UPWARD == direction) { - for(i = 0; i < (int)estack->nused && status >= 0; i++) { + for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) { /* Point to each error record on the stack and pass it to callback function.*/ old_err.maj_num = estack->slot[i].maj_num; old_err.min_num = estack->slot[i].min_num; @@ -541,12 +540,12 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o old_err.desc = estack->slot[i].desc; old_err.line = estack->slot[i].line; - status = (op->u.func1)(i, &old_err, client_data); + ret_value = (op->u.func1)(i, &old_err, client_data); } /* end for */ } /* end if */ else { H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); - for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) { + for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) { /* Point to each error record on the stack and pass it to callback function.*/ old_err.maj_num = estack->slot[i].maj_num; old_err.min_num = estack->slot[i].min_num; @@ -555,12 +554,12 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o old_err.desc = estack->slot[i].desc; old_err.line = estack->slot[i].line; - status = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data); + ret_value = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data); } /* end for */ } /* end else */ - if(status < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + if(ret_value < 0) + HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); } /* end if */ #else /* H5_NO_DEPRECATED_SYMBOLS */ HDassert(0 && "version 1 error stack walk without deprecated symbols!"); @@ -569,23 +568,22 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o else { HDassert(op->vers == 2); if(op->u.func2) { - status = SUCCEED; + ret_value = SUCCEED; if(H5E_WALK_UPWARD == direction) { - for(i = 0; i < (int)estack->nused && status >= 0; i++) - status = (op->u.func2)((unsigned)i, estack->slot + i, client_data); + for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) + ret_value = (op->u.func2)((unsigned)i, estack->slot + i, client_data); } /* end if */ else { H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); - for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) - status = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data); + for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) + ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data); } /* end else */ - if(status < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + if(ret_value < 0) + HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); } /* end if */ } /* end else */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E__walk() */ @@ -653,11 +653,17 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* get the VOL info from the fapl */ + /* Get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + if(H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -733,7 +739,13 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + if(H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") /* Open the file through the VOL layer */ if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index ed05e95..d1a17cd 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -348,14 +348,17 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) HDassert(file); - /* Write to backing store */ - if((off_t)addr != HDlseek(file->fd, (off_t)addr, SEEK_SET)) +#ifndef H5_HAVE_PREADWRITE + /* Seek to the correct location (if we don't have pwrite) */ + if((HDoff_t)addr != HDlseek(file->fd, (off_t)addr, SEEK_SET)) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "error seeking in backing store") +#endif /* H5_HAVE_PREADWRITE */ while (size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ + HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -366,15 +369,21 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) bytes_in = (h5_posix_io_t)size; do { +#ifdef H5_HAVE_PREADWRITE + bytes_wrote = HDpwrite(file->fd, ptr, bytes_in, offset); + offset += bytes_wrote; +#else bytes_wrote = HDwrite(file->fd, ptr, bytes_in); +#endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_wrote && EINTR == errno); if(-1 == bytes_wrote) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); - HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset); + offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ HDassert(bytes_wrote > 0); @@ -852,6 +861,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ + HDoff_t offset = (HDoff_t)0; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -862,15 +872,21 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr bytes_in = (h5_posix_io_t)size; do { +#ifdef H5_HAVE_PREADWRITE + bytes_read = HDpread(file->fd, mem, bytes_in, offset); + offset += bytes_read; +#else bytes_read = HDread(file->fd, mem, bytes_in); +#endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_read && EINTR == errno); if(-1 == bytes_read) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); - HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset); + offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + + HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ HDassert(bytes_read >= 0); diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 97d1b41..655d7d3 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -1191,7 +1191,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd } /* end if */ } /* end if */ - /* Seek to the correct location */ +#ifndef H5_HAVE_PREADWRITE + /* Seek to the correct location (if we don't have pread) */ if(addr != file->pos || OP_READ != file->op) { #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags & H5FD_LOG_TIME_SEEK) @@ -1234,6 +1235,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd #endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ } /* end if */ +#endif /* H5_HAVE_PREADWRITE */ /* * Read data, being careful of interrupted system calls, partial results, @@ -1247,6 +1249,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ + HDoff_t offset = (HDoff_t)addr; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1257,18 +1260,24 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd bytes_in = (h5_posix_io_t)size; do { +#ifdef H5_HAVE_PREADWRITE + bytes_read = HDpread(file->fd, buf, bytes_in, offset); + offset += bytes_read; +#else bytes_read = HDread(file->fd, buf, bytes_in); +#endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_read && EINTR == errno); if(-1 == bytes_read) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); - HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + + offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); if(file->fa.flags & H5FD_LOG_LOC_READ) HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ if(0 == bytes_read) { @@ -1398,7 +1407,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had file->nwrite[tmp_addr++]++; } /* end if */ - /* Seek to the correct location */ +#ifndef H5_HAVE_PREADWRITE + /* Seek to the correct location (if we don't have pwrite) */ if(addr != file->pos || OP_WRITE != file->op) { #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags & H5FD_LOG_TIME_SEEK) @@ -1441,6 +1451,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had #endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ } /* end if */ +#endif /* H5_HAVE_PREADWRITE */ /* * Write the data, being careful of interrupted system calls and partial @@ -1454,6 +1465,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ + HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1464,18 +1476,24 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had bytes_in = (h5_posix_io_t)size; do { +#ifdef H5_HAVE_PREADWRITE + bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset); + offset += bytes_wrote; +#else bytes_wrote = HDwrite(file->fd, buf, bytes_in); +#endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_wrote && EINTR == errno); if(-1 == bytes_wrote) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); - HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + + offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); if(file->fa.flags & H5FD_LOG_LOC_WRITE) HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ HDassert(bytes_wrote > 0); diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 0b58ebe..614c7ba 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -91,70 +91,70 @@ typedef struct H5FD_mpio_t { /* Private Prototypes */ /* Callbacks */ -static herr_t H5FD_mpio_term(void); -static void *H5FD_mpio_fapl_get(H5FD_t *_file); -static void *H5FD_mpio_fapl_copy(const void *_old_fa); -static herr_t H5FD_mpio_fapl_free(void *_fa); -static H5FD_t *H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); -static herr_t H5FD_mpio_close(H5FD_t *_file); -static int H5FD_mpio_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_mpio_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_mpio_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +static herr_t H5FD__mpio_term(void); +static void *H5FD__mpio_fapl_get(H5FD_t *_file); +static void *H5FD__mpio_fapl_copy(const void *_old_fa); +static herr_t H5FD__mpio_fapl_free(void *_fa); +static H5FD_t *H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, + haddr_t maxaddr); +static herr_t H5FD__mpio_close(H5FD_t *_file); +static int H5FD__mpio_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__mpio_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +static herr_t H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static int H5FD_mpio_mpi_rank(const H5FD_t *_file); -static int H5FD_mpio_mpi_size(const H5FD_t *_file); -static MPI_Comm H5FD_mpio_communicator(const H5FD_t *_file); -static herr_t H5FD_mpio_get_info(H5FD_t *_file, void** mpi_info); +static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static int H5FD__mpio_mpi_rank(const H5FD_t *_file); +static int H5FD__mpio_mpi_size(const H5FD_t *_file); +static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file); +static herr_t H5FD__mpio_get_info(H5FD_t *_file, void** mpi_info); /* The MPIO file driver information */ static const H5FD_class_mpi_t H5FD_mpio_g = { { /* Start of superclass information */ "mpio", /*name */ HADDR_MAX, /*maxaddr */ - H5F_CLOSE_SEMI, /* fc_degree */ - H5FD_mpio_term, /*terminate */ + H5F_CLOSE_SEMI, /*fc_degree */ + H5FD__mpio_term, /*terminate */ NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ sizeof(H5FD_mpio_fapl_t), /*fapl_size */ - H5FD_mpio_fapl_get, /*fapl_get */ - H5FD_mpio_fapl_copy, /*fapl_copy */ - H5FD_mpio_fapl_free, /*fapl_free */ + H5FD__mpio_fapl_get, /*fapl_get */ + H5FD__mpio_fapl_copy, /*fapl_copy */ + H5FD__mpio_fapl_free, /*fapl_free */ 0, /*dxpl_size */ NULL, /*dxpl_copy */ NULL, /*dxpl_free */ - H5FD_mpio_open, /*open */ - H5FD_mpio_close, /*close */ - H5FD_mpio_cmp, /*cmp */ - H5FD_mpio_query, /*query */ + H5FD__mpio_open, /*open */ + H5FD__mpio_close, /*close */ + H5FD__mpio_cmp, /*cmp */ + H5FD__mpio_query, /*query */ NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ - H5FD_mpio_get_eoa, /*get_eoa */ - H5FD_mpio_set_eoa, /*set_eoa */ - H5FD_mpio_get_eof, /*get_eof */ - H5FD_mpio_get_handle, /*get_handle */ - H5FD_mpio_read, /*read */ - H5FD_mpio_write, /*write */ - H5FD_mpio_flush, /*flush */ - H5FD_mpio_truncate, /*truncate */ + H5FD__mpio_get_eoa, /*get_eoa */ + H5FD__mpio_set_eoa, /*set_eoa */ + H5FD__mpio_get_eof, /*get_eof */ + H5FD__mpio_get_handle, /*get_handle */ + H5FD__mpio_read, /*read */ + H5FD__mpio_write, /*write */ + H5FD__mpio_flush, /*flush */ + H5FD__mpio_truncate, /*truncate */ NULL, /*lock */ NULL, /*unlock */ H5FD_FLMAP_DICHOTOMY /*fl_map */ }, /* End of superclass information */ - H5FD_mpio_mpi_rank, /*get_rank */ - H5FD_mpio_mpi_size, /*get_size */ - H5FD_mpio_communicator, /*get_comm */ - H5FD_mpio_get_info /*get_info */ + H5FD__mpio_mpi_rank, /*get_rank */ + H5FD__mpio_mpi_size, /*get_size */ + H5FD__mpio_communicator, /*get_comm */ + H5FD__mpio_get_info /*get_info */ }; #ifdef H5FDmpio_DEBUG @@ -181,10 +181,13 @@ static int H5FD_mpio_Debug[256] = /*-------------------------------------------------------------------------- NAME H5FD__init_package -- Initialize interface-specific information + USAGE herr_t H5FD__init_package() + RETURNS Non-negative on success/Negative on failure + DESCRIPTION Initializes any interface-specific data or routines. (Just calls H5FD_mpio_init currently). @@ -265,7 +268,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_mpio_term + * Function: H5FD__mpio_term * * Purpose: Shut down the VFD * @@ -277,15 +280,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_term(void) +H5FD__mpio_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC /* Reset VFL ID */ - H5FD_MPIO_g=0; + H5FD_MPIO_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_mpio_term() */ +} /* end H5FD__mpio_term() */ /*------------------------------------------------------------------------- @@ -312,7 +315,6 @@ H5FD_mpio_term(void) * are freed. * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Albert Cheng @@ -330,10 +332,9 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) FUNC_ENTER_API(FAIL) H5TRACE3("e", "iMcMi", fapl_id, comm, info); + /* Check arguments */ if(fapl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if(MPI_COMM_NULL == comm) @@ -368,7 +369,6 @@ done: * modifications to the access property list do * not affect them and it is the responsibility * of the application to free them. - * * Failure: Negative * * Programmer: Robb Matzke @@ -389,6 +389,7 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, comm, info); + /* Check arguments */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if(H5FD_MPIO != H5P_peek_driver(plist)) @@ -461,10 +462,9 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) FUNC_ENTER_API(FAIL) H5TRACE2("e", "iDt", dxpl_id, xfer_mode); + /* Check arguments */ if(dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") if(H5FD_MPIO_INDEPENDENT != xfer_mode && H5FD_MPIO_COLLECTIVE != xfer_mode) @@ -488,7 +488,6 @@ done: * Return: Success: Non-negative, with the transfer mode returned * through the XFER_MODE argument if it is * non-null. - * * Failure: Negative * * Programmer: Albert Cheng @@ -505,6 +504,7 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", dxpl_id, xfer_mode); + /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -546,10 +546,9 @@ H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mo FUNC_ENTER_API(FAIL) H5TRACE2("e", "iDc", dxpl_id, opt_mode); + /* Check arguments */ if(dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -590,10 +589,9 @@ H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode) FUNC_ENTER_API(FAIL) H5TRACE2("e", "iDh", dxpl_id, opt_mode); + /* Check arguments */ if(dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -632,10 +630,9 @@ H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc) FUNC_ENTER_API(FAIL) H5TRACE2("e", "iIu", dxpl_id, num_chunk_per_proc); + /* Check arguments */ if(dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -677,10 +674,9 @@ H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_ch FUNC_ENTER_API(FAIL) H5TRACE2("e", "iIu", dxpl_id, percent_num_proc_per_chunk); + /* Check arguments */ if(dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -694,14 +690,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_get + * Function: H5FD__mpio_fapl_get * * Purpose: Returns a file access property list which could be used to * create another file the same as this one. * * Return: Success: Ptr to new file access property list with all * fields copied from the file pointer. - * * Failure: NULL * * Programmer: Robb Matzke @@ -710,17 +705,19 @@ done: *------------------------------------------------------------------------- */ static void * -H5FD_mpio_fapl_get(H5FD_t *_file) +H5FD__mpio_fapl_get(H5FD_t *_file) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; H5FD_mpio_fapl_t *fa = NULL; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); + /* Check arguments */ if(NULL == (fa = (H5FD_mpio_fapl_t *)H5MM_calloc(sizeof(H5FD_mpio_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -733,16 +730,15 @@ H5FD_mpio_fapl_get(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__mpio_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_copy + * Function: H5FD__mpio_fapl_copy * * Purpose: Copies the mpio-specific file access properties. * * Return: Success: Ptr to a new property list - * * Failure: NULL * * Programmer: Albert Cheng @@ -751,16 +747,17 @@ done: *------------------------------------------------------------------------- */ static void * -H5FD_mpio_fapl_copy(const void *_old_fa) +H5FD__mpio_fapl_copy(const void *_old_fa) { - void *ret_value = NULL; const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa; H5FD_mpio_fapl_t *new_fa = NULL; + void *ret_value = NULL; + + FUNC_ENTER_STATIC - FUNC_ENTER_NOAPI_NOINIT #ifdef H5FDmpio_DEBUG -if (H5FD_mpio_Debug[(int)'t']) -fprintf(stderr, "enter H5FD_mpio_fapl_copy\n"); +if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stderr, "%s: entering\n", FUNC); #endif if(NULL == (new_fa = (H5FD_mpio_fapl_t *)H5MM_malloc(sizeof(H5FD_mpio_fapl_t)))) @@ -770,65 +767,68 @@ fprintf(stderr, "enter H5FD_mpio_fapl_copy\n"); HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t)); /* Duplicate communicator and Info object. */ - if(FAIL == H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info)) + if(H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") + + /* Set return value */ ret_value = new_fa; done: - if (NULL == ret_value){ + if(NULL == ret_value) /* cleanup */ - if (new_fa) + if(new_fa) H5MM_xfree(new_fa); - } #ifdef H5FDmpio_DEBUG -if (H5FD_mpio_Debug[(int)'t']) -fprintf(stderr, "leaving H5FD_mpio_fapl_copy\n"); +if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stderr, "%s: leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mpio_fapl_copy() */ +} /* end H5FD__mpio_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_free + * Function: H5FD__mpio_fapl_free * * Purpose: Frees the mpio-specific file access properties. * * Return: Success: 0 - * * Failure: -1 * * Programmer: Albert Cheng * Jan 8, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_fapl_free(void *_fa) +H5FD__mpio_fapl_free(void *_fa) { - herr_t ret_value = SUCCEED; H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC - FUNC_ENTER_NOAPI_NOINIT_NOERR #ifdef H5FDmpio_DEBUG -if (H5FD_mpio_Debug[(int)'t']) -fprintf(stderr, "in H5FD_mpio_fapl_free\n"); +if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stderr, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(fa); /* Free the internal communicator and INFO object */ - HDassert(MPI_COMM_NULL!=fa->comm); + HDassert(MPI_COMM_NULL != fa->comm); H5FD_mpi_comm_info_free(&fa->comm, &fa->info); H5MM_xfree(fa); #ifdef H5FDmpio_DEBUG -if (H5FD_mpio_Debug[(int)'t']) -fprintf(stderr, "leaving H5FD_mpio_fapl_free\n"); +if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stderr, "%s: leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mpio_fapl_free() */ +} /* end H5FD__mpio_fapl_free() */ /*------------------------------------------------------------------------- @@ -856,26 +856,27 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) FUNC_ENTER_NOAPI_NOINIT #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_set_mpio_atomicity\n"); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif - if (FALSE == flag) + if(FALSE == flag) temp_flag = 0; else temp_flag = 1; /* set atomicity value */ - if (MPI_SUCCESS != (mpi_code=MPI_File_set_atomicity(file->f, temp_flag))) + if(MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, temp_flag))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Leaving H5FD_set_mpio_atomicity\n"); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_set_mpio_atomicity() */ /*------------------------------------------------------------------------- @@ -903,26 +904,27 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) FUNC_ENTER_NOAPI_NOINIT #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_get_mpio_atomicity\n"); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif - /* get atomicity value */ - if (MPI_SUCCESS != (mpi_code=MPI_File_get_atomicity(file->f, &temp_flag))) + /* Get atomicity value */ + if(MPI_SUCCESS != (mpi_code = MPI_File_get_atomicity(file->f, &temp_flag))) HMPI_GOTO_ERROR(FAIL, "MPI_File_get_atomicity", mpi_code) - if (0 != temp_flag) + if(0 != temp_flag) *flag = TRUE; else *flag = FALSE; done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Leaving H5FD_get_mpio_atomicity\n"); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_get_mpio_atomicity() */ /* * Function: H5FD_mpio_fileinfo_get @@ -939,7 +941,7 @@ done: * requirement that we do a "normal" file open to provide * an actual file handle with which we can gather more * detailed information to eventually implement file - * comparisons (see: H5FD_mpio_cmp) + * comparisons (see: H5FD__mpio_cmp) * * Return: Success: Non-negative * @@ -1007,7 +1009,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_open + * Function: H5FD__mpio_open * * Purpose: Opens a file with name NAME. The FLAGS are a bit field with * purpose similar to the second argument of open(2) and which @@ -1017,21 +1019,20 @@ done: * access. This is collective. * * Return: Success: A new file pointer. - * * Failure: NULL * - * Programmer: + * Programmer: Robert Kim Yates * January 30, 1998 * *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t H5_ATTR_UNUSED maxaddr) +H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, + haddr_t H5_ATTR_UNUSED maxaddr) { - H5FD_mpio_t *file=NULL; + H5FD_mpio_t *file = NULL; MPI_File fh; - unsigned file_opened=0; /* Flag to indicate that the file was successfully opened */ + unsigned file_opened = 0; /* Flag to indicate that the file was successfully opened */ int mpi_amode; int mpi_rank; /* MPI rank of this process */ int mpi_size; /* Total number of MPI processes */ @@ -1044,13 +1045,11 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, MPI_Info info_dup = MPI_INFO_NULL; H5FD_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) { - fprintf(stdout, "Entering H5FD_mpio_open(name=\"%s\", flags=0x%x, " - "fapl_id=%d, maxaddr=%lu)\n", name, flags, (int)fapl_id, (unsigned long)maxaddr); - } + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, name, flags, (int)fapl_id, (unsigned long)maxaddr); #endif /* Obtain a pointer to mpio-specific file access properties */ @@ -1061,10 +1060,9 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, _fa.info = MPI_INFO_NULL; /*default*/ fa = &_fa; } /* end if */ - else { + else if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") - } /* end else */ /* Duplicate communicator and Info object for use by this file. */ if(FAIL == H5FD_mpi_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup)) @@ -1080,21 +1078,19 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, #ifdef H5FDmpio_DEBUG /* Check for debug commands in the info parameter */ - { - if(MPI_INFO_NULL != info_dup) { - char debug_str[128]; - int flag; - - MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag); - if(flag) { - int i; - - fprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str); - for(i = 0; debug_str[i]/*end of string*/ && i < 128/*just in case*/; ++i) - H5FD_mpio_Debug[(int)debug_str[i]] = 1; - } - } - } + if(MPI_INFO_NULL != info_dup) { + char debug_str[128]; + int flag; + + MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag); + if(flag) { + int i; + + HDfprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str); + for(i = 0; debug_str[i]/*end of string*/ && i < 128/*just in case*/; ++i) + H5FD_mpio_Debug[(int)debug_str[i]] = 1; + } /* end if */ + } /* end if */ #endif if(MPI_SUCCESS != (mpi_code = MPI_File_open(comm_dup, name, mpi_amode, info_dup, &fh))) @@ -1149,30 +1145,31 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, HMPI_GOTO_ERROR(NULL, "H5FD_mpio_fileinfo_get failed", -1) } /* Set return value */ - ret_value=(H5FD_t*)file; + ret_value = (H5FD_t*)file; done: - if(ret_value==NULL) { + if(ret_value == NULL) { if(file_opened) MPI_File_close(&fh); - if (MPI_COMM_NULL != comm_dup) + if(MPI_COMM_NULL != comm_dup) MPI_Comm_free(&comm_dup); - if (MPI_INFO_NULL != info_dup) + if(MPI_INFO_NULL != info_dup) MPI_Info_free(&info_dup); - if (file) + if(file) H5MM_xfree(file); } /* end if */ #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Leaving H5FD_mpio_open\n" ); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mpio_open() */ +} /* end H5FD__mpio_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_cmp + * Function: H5FD__mpio_cmp * * Purpose: This version of the 'cmp' function is used to compare two * files which have been created and opened using the MPI-IO @@ -1206,7 +1203,7 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_mpio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__mpio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_mpio_t *f1 = (const H5FD_mpio_t *)_f1; const H5FD_mpio_t *f2 = (const H5FD_mpio_t *)_f2; @@ -1291,50 +1288,42 @@ H5FD_mpio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mpio_cmp() */ +} /* end H5FD__mpio_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_close + * Function: H5FD__mpio_close * * Purpose: Closes a file. This is collective. * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Unknown * January 30, 1998 * - * Modifications: - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Albert Cheng, 2003-04-17 - * Free the communicator stored. *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_close(H5FD_t *_file) +H5FD__mpio_close(H5FD_t *_file) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; int mpi_code; /* MPI return code */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_mpio_close\n"); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); - HDassert(H5FD_MPIO==file->pub.driver_id); + HDassert(H5FD_MPIO == file->pub.driver_id); /* MPI_File_close sets argument to MPI_FILE_NULL */ - if (MPI_SUCCESS != (mpi_code=MPI_File_close(&(file->f)/*in,out*/))) + if(MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f)/*in,out*/))) HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code) /* Clean up other stuff */ @@ -1343,45 +1332,36 @@ H5FD_mpio_close(H5FD_t *_file) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Leaving H5FD_mpio_close\n"); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__mpio_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_query + * Function: H5FD__mpio_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol * Friday, August 25, 2000 * - * Modifications: - * - * John Mainzer -- 9/21/05 - * Modified code to turn off the - * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag. - * With the movement of - * all cache writes to process 0, this flag has become - * problematic in PHDF5. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */) +H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC /* Set the VFL feature flags that this driver supports */ if(flags) { - *flags=0; + *flags = 0; *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ *flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */ @@ -1390,83 +1370,73 @@ H5FD_mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5FD__mpio_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_get_eoa + * Function: H5FD__mpio_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the * format address space. * * Return: Success: The end-of-address marker. - * * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Friday, August 6, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(file); - HDassert(H5FD_MPIO==file->pub.driver_id); + HDassert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->eoa) -} +} /* end H5FD__mpio_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_set_eoa + * Function: H5FD__mpio_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order * to tell the driver where the end of the HDF5 data is located. * * Return: Success: 0 - * * Failure: -1 * * Programmer: Robb Matzke * Friday, August 6, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(file); - HDassert(H5FD_MPIO==file->pub.driver_id); + HDassert(H5FD_MPIO == file->pub.driver_id); file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5FD__mpio_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_get_eof + * Function: H5FD__mpio_get_eof * * Purpose: Gets the end-of-file marker for the file. The EOF marker * is the real size of the file. @@ -1484,32 +1454,30 @@ H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * file. -QAK * * Return: Success: The end-of-address marker. - * * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Friday, August 6, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(file); - HDassert(H5FD_MPIO==file->pub.driver_id); + HDassert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->eof) -} +} /* end H5FD__mpio_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_get_handle + * Function: H5FD__mpio_get_handle * * Purpose: Returns the file handle of MPIO file driver. * @@ -1518,17 +1486,15 @@ H5FD_mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * Programmer: Raymond Lu * Sept. 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle) +H5FD__mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle) { - H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - herr_t ret_value = SUCCEED; + H5FD_mpio_t *file = (H5FD_mpio_t *)_file; + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") @@ -1537,7 +1503,7 @@ H5FD_mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handl done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__mpio_get_handle() */ /*------------------------------------------------------------------------- @@ -1574,7 +1540,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_read + * Function: H5FD__mpio_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -1592,85 +1558,41 @@ done: * * Programmer: rky, 1998-01-30 * - * Modifications: - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. - * - * rky, 1998-04-10 - * Call independent or collective MPI read, based on - * ACCESS_PARMS. - * - * Albert Cheng, 1998-06-01 - * Added XFER_MODE to control independent or collective MPI - * read. - * - * rky, 1998-08-16 - * Use BTYPE, FTYPE, and DISP from access parms. The guts of - * H5FD_mpio_read and H5FD_mpio_write should be replaced by a - * single dual-purpose routine. - * - * Robb Matzke, 1999-04-21 - * Changed XFER_MODE to XFER_PARMS for all H5F_*_read() - * callbacks. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Quincey Koziol, 2002-05-14 - * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type - * for the I/O transfer. Someday we might include code to decode - * the MPI type used for more complicated transfers and call - * MPI_Get_count all the time. - * - * Quincey Koziol - 2002/06/17 - * Removed 'disp' parameter from H5FD_mpio_setup routine and use - * the address of the dataset in MPI_File_set_view() calls, as - * necessary. - * - * Quincey Koziol - 2002/06/24 - * Removed "lazy" MPI_File_set_view() calls, since they would fail - * if the first I/O was a collective I/O using MPI derived types - * and the next I/O was an independent I/O. - * - * Quincey Koziol - 2003/10/22-31 - * Restructured code massively, straightening out logic and finally - * getting the bytes_read stuff working. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, +H5FD__mpio_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/*out*/) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - MPI_Offset mpi_off; - MPI_Status mpi_stat; /* Status from I/O operation */ - int mpi_code; /* mpi return code */ - MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ - int size_i; /* Integer copy of 'size' to read */ + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + MPI_Offset mpi_off; + MPI_Status mpi_stat; /* Status from I/O operation */ + int mpi_code; /* mpi return code */ + MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ + int size_i; /* Integer copy of 'size' to read */ #if MPI_VERSION >= 3 - MPI_Count bytes_read; /* Number of bytes read in */ - MPI_Count type_size; /* MPI datatype used for I/O's size */ - MPI_Count io_size; /* Actual number of bytes requested */ - MPI_Count n; + MPI_Count bytes_read = 0; /* Number of bytes read in */ + MPI_Count type_size; /* MPI datatype used for I/O's size */ + MPI_Count io_size; /* Actual number of bytes requested */ + MPI_Count n; #else - int bytes_read; /* Number of bytes read in */ - int type_size; /* MPI datatype used for I/O's size */ - int io_size; /* Actual number of bytes requested */ - int n; + int bytes_read = 0; /* Number of bytes read in */ + int type_size; /* MPI datatype used for I/O's size */ + int io_size; /* Actual number of bytes requested */ + int n; #endif - hbool_t use_view_this_time = FALSE; - herr_t ret_value = SUCCEED; + hbool_t use_view_this_time = FALSE; + hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */ + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_mpio_read\n" ); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO==file->pub.driver_id); HDassert(buf); @@ -1679,21 +1601,20 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, HDmemset(&mpi_stat,0,sizeof(MPI_Status)); /* some numeric conversions */ - if (H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off/*out*/)<0) + if(H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off/*out*/) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") size_i = (int)size; - if ((hsize_t)size_i != size) + if((hsize_t)size_i != size) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i") #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - fprintf(stdout, "in H5FD_mpio_read mpi_off=%ld size_i=%d\n", - (long)mpi_off, size_i ); + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); #endif /* Only look for MPI views for raw data transfers */ if(type == H5FD_MEM_DRAW) { - H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ /* Get the transfer mode from the API context */ if(H5CX_get_io_xfer_mode(&xfer_mode) < 0) @@ -1705,8 +1626,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which * could mean "use MPI_BYTE" by convention). */ - if(xfer_mode==H5FD_MPIO_COLLECTIVE) { - MPI_Datatype file_type; + if(xfer_mode == H5FD_MPIO_COLLECTIVE) { + MPI_Datatype file_type; /* Remember that views are used */ use_view_this_time = TRUE; @@ -1733,8 +1654,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, H5FD_mpio_collective_opt_t coll_opt_mode; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ if(H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) @@ -1742,16 +1663,33 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG - if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_read: doing MPI collective IO\n"); + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); #endif - if(MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code) + /* Check whether we should read from rank 0 and broadcast to other ranks */ + if(H5CX_get_mpio_rank0_bcast()) { +#ifdef H5FDmpio_DEBUG + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC); +#endif + /* Indicate path we've taken */ + rank0_bcast = TRUE; + + /* Read on rank 0 Bcast to other ranks */ + if(file->mpi_rank == 0) + if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(buf, size_i, buf_type, 0, file->comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code) + } /* end if */ + else + if(MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code) } /* end if */ else { #ifdef H5FDmpio_DEBUG - if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_read: doing MPI independent IO\n"); + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); #endif if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) @@ -1763,52 +1701,65 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, */ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) - } else { + } /* end if */ + else if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) - } - /* How many bytes were actually read? */ + /* Only retrieve bytes read if this rank _actually_ participated in I/O */ + if(!rank0_bcast || (rank0_bcast && file->mpi_rank == 0) ) { + /* How many bytes were actually read? */ #if MPI_VERSION >= 3 - if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read))) + if(MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read))) #else - if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read))) + if(MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read))) #endif - HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code) + } /* end if */ + + /* If the rank0-bcast feature was used, broadcast the # of bytes read to + * other ranks, which didn't perform any I/O. + */ + /* NOTE: This could be optimized further to be combined with the broadcast + * of the data. (QAK - 2019/1/2) + */ + if(rank0_bcast) + if(MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_LONG_LONG, 0, file->comm)) + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0) /* Get the type's size */ #if MPI_VERSION >= 3 - if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size))) + if(MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size))) #else - if (MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size))) + if(MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size))) #endif HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code) /* Compute the actual number of bytes requested */ - io_size=type_size*size_i; + io_size = type_size * size_i; /* Check for read failure */ - if (bytes_read<0 || bytes_read>io_size) + if(bytes_read < 0 || bytes_read > io_size) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") /* * This gives us zeroes beyond end of physical MPI file. */ - if ((n=(io_size-bytes_read)) > 0) + if((n = (io_size - bytes_read)) > 0) HDmemset((char*)buf+bytes_read, 0, (size_t)n); done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Leaving H5FD_mpio_read\n" ); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__mpio_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_write + * Function: H5FD__mpio_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1820,116 +1771,16 @@ done: * * Return: Success: Zero. USE_TYPES and OLD_USE_TYPES in the * access params are altered. - * * Failure: -1, USE_TYPES and OLD_USE_TYPES in the * access params may be altered. * - * Programmer: Unknown + * Programmer: Robert Kim Yates * January 30, 1998 * - * Modifications: - * rky, 1998-08-28 - * If the file->allsame flag is set, we assume that all the - * procs in the relevant MPI communicator will write identical - * data at identical offsets in the file, so only proc 0 will - * write, and all other procs will wait for p0 to finish. This - * is useful for writing metadata, for example. Note that we - * don't _check_ that the data is identical. Also, the mechanism - * we use to eliminate the redundant writes is by requiring a - * call to H5FD_mpio_tas_allsame before the write, which is - * rather klugey. Would it be better to pass a parameter to - * low-level writes like H5F_block_write and H5F_low_write, - * instead? Or...??? Also, when I created this mechanism I - * wanted to minimize the difference in behavior between the old - * way of doing things (i.e., all procs write) and the new way, - * so the writes are eliminated at the very lowest level, here - * in H5FD_mpio_write. It may be better to rethink that, and - * short-circuit the writes at a higher level (e.g., at the - * points in the code where H5FD_mpio_tas_allsame is called). - * - * - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. - * - * rky, 1998-04-10 - * Call independent or collective MPI write, based on - * ACCESS_PARMS. - * - * rky, 1998-04-24 - * Removed redundant write from H5FD_mpio_write. - * - * Albert Cheng, 1998-06-01 - * Added XFER_MODE to control independent or collective MPI - * write. - * - * rky, 1998-08-16 - * Use BTYPE, FTYPE, and DISP from access parms. The guts of - * H5FD_mpio_read and H5FD_mpio_write should be replaced by a - * single dual-purpose routine. - * - * rky, 1998-08-28 - * Added ALLSAME parameter to make all but proc 0 skip the - * actual write. - * - * Robb Matzke, 1999-04-21 - * Changed XFER_MODE to XFER_PARMS for all H5FD_*_write() - * callbacks. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Albert Cheng, 1999-12-19 - * When only-p0-write-allsame-data, p0 Bcasts the - * ret_value to other processes. This prevents - * a racing condition (that other processes try to - * read the file before p0 finishes writing) and also - * allows all processes to report the same ret_value. - * - * Kim Yates, Pat Weidhaas, 2000-09-26 - * Move block of coding where only p0 writes after the - * MPI_File_set_view call. - * - * Quincey Koziol, 2002-05-10 - * Instead of always writing metadata from process 0, spread the - * burden among all the processes by using a round-robin rotation - * scheme. - * - * Quincey Koziol, 2002-05-10 - * Removed allsame code, keying off the type parameter instead. - * - * Quincey Koziol, 2002-05-14 - * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type - * for the I/O transfer. Someday we might include code to decode - * the MPI type used for more complicated transfers and call - * MPI_Get_count all the time. - * - * Quincey Koziol - 2002/06/17 - * Removed 'disp' parameter from H5FD_mpio_setup routine and use - * the address of the dataset in MPI_File_set_view() calls, as - * necessary. - * - * Quincey Koziol - 2002/06/24 - * Removed "lazy" MPI_File_set_view() calls, since they would fail - * if the first I/O was a collective I/O using MPI derived types - * and the next I/O was an independent I/O. - * - * Quincey Koziol - 2002/07/18 - * Added "block_before_meta_write" dataset transfer flag, which - * is set during writes from a metadata cache flush and indicates - * that all the processes must sync up before (one of them) - * writing metadata. - * - * Quincey Koziol - 2003/10/22-31 - * Restructured code massively, straightening out logic and finally - * getting the bytes_written stuff working. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, +H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; @@ -1951,12 +1802,14 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_mpio_write\n" ); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO==file->pub.driver_id); HDassert(buf); @@ -1976,7 +1829,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'w']) - fprintf(stdout, "in H5FD_mpio_write mpi_off=%ld size_i=%d\n", (long)mpi_off, size_i); + HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); #endif /* Get the transfer mode from the API context */ @@ -2016,8 +1869,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, H5FD_mpio_collective_opt_t coll_opt_mode; #ifdef H5FDmpio_DEBUG - if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); + if(H5FD_mpio_Debug[(int)'w']) + HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ @@ -2026,8 +1879,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG - if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_write: doing MPI collective IO\n"); + if(H5FD_mpio_Debug[(int)'w']) + HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); #endif if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) @@ -2036,8 +1889,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, if(type != H5FD_MEM_DRAW) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Metadata Coll opt property should be collective at this point") #ifdef H5FDmpio_DEBUG - if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_write: doing MPI independent IO\n"); + if(H5FD_mpio_Debug[(int)'w']) + HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); #endif if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) @@ -2046,10 +1899,10 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, /* Reset the file view when we used MPI derived types */ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) - } else { + } /* end if */ + else if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) - } /* How many bytes were actually written? */ #if MPI_VERSION >= 3 @@ -2088,15 +1941,15 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "proc %d: Leaving H5FD_mpio_write with ret_value=%d\n", - file->mpi_rank, ret_value ); + HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value ); #endif + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mpio_write() */ +} /* end H5FD__mpio_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_flush + * Function: H5FD__mpio_flush * * Purpose: Makes sure that all data is on disk. This is collective. * @@ -2110,18 +1963,20 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; int mpi_code; /* mpi return code */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering %s\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); @@ -2133,15 +1988,15 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving %s\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mpio_flush() */ +} /* end H5FD__mpio_flush() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_truncate + * Function: H5FD__mpio_truncate * * Purpose: Make certain the file's size matches it's allocated size * @@ -2161,31 +2016,22 @@ done: * Programmer: Quincey Koziol * January 31, 2008 * - * Changes: Heavily reworked to avoid unnecessary MPI_File_set_size() - * calls. The hope is that these calls are superfluous in the - * typical case, allowing us to avoid truncates most of the - * time. - * - * The basic idea is to query the file system to get the - * current eof, and only truncate if the file systems - * conception of the eof disagrees with our eoa. - * - * JRM -- 10/27/17 - * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) +H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - herr_t ret_value = SUCCEED; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering %s\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); @@ -2251,15 +2097,15 @@ H5FD_mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving %s\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mpio_truncate() */ +} /* end H5FD__mpio_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_mpi_rank + * Function: H5FD__mpio_mpi_rank * * Purpose: Returns the MPI rank for a process * @@ -2269,26 +2115,25 @@ done: * Programmer: Quincey Koziol * Thursday, May 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5FD_mpio_mpi_rank(const H5FD_t *_file) +H5FD__mpio_mpi_rank(const H5FD_t *_file) { const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(file); - HDassert(H5FD_MPIO==file->pub.driver_id); + HDassert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->mpi_rank) -} /* end H5FD_mpio_mpi_rank() */ +} /* end H5FD__mpio_mpi_rank() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_mpi_size + * Function: H5FD__mpio_mpi_size * * Purpose: Returns the number of MPI processes * @@ -2298,26 +2143,25 @@ H5FD_mpio_mpi_rank(const H5FD_t *_file) * Programmer: Quincey Koziol * Thursday, May 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5FD_mpio_mpi_size(const H5FD_t *_file) +H5FD__mpio_mpi_size(const H5FD_t *_file) { const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(file); - HDassert(H5FD_MPIO==file->pub.driver_id); + HDassert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->mpi_size) -} /* end H5FD_mpio_mpi_size() */ +} /* end H5FD__mpio_mpi_size() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_communicator + * Function: H5FD__mpio_communicator * * Purpose: Returns the MPI communicator for the file. * @@ -2328,22 +2172,53 @@ H5FD_mpio_mpi_size(const H5FD_t *_file) * Programmer: Robb Matzke * Monday, August 9, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static MPI_Comm -H5FD_mpio_communicator(const H5FD_t *_file) +H5FD__mpio_communicator(const H5FD_t *_file) { const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(file); - HDassert(H5FD_MPIO==file->pub.driver_id); + HDassert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->comm) -} /* end H5FD_mpio_communicator() */ +} /* end H5FD__mpio_communicator() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD__mpio_get_info + * + * Purpose: Returns the file info of MPIO file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: John Mainzer + * April 4, 2017 + * + * Modifications: + * + *------------------------------------------------------------------------- +*/ +static herr_t +H5FD__mpio_get_info(H5FD_t *_file, void **mpi_info) +{ + H5FD_mpio_t *file = (H5FD_mpio_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + if(!mpi_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mpi info not valid") + + *mpi_info = &(file->info); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__mpio_get_info() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index c507387..0054a86 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -682,11 +682,13 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS if(REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) - /* Seek to the correct location */ +#ifndef H5_HAVE_PREADWRITE + /* Seek to the correct location (if we don't have pread) */ if(addr != file->pos || OP_READ != file->op) { if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") } /* end if */ +#endif /* H5_HAVE_PREADWRITE */ /* Read data, being careful of interrupted system calls, partial results, * and the end of the file. @@ -694,7 +696,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to read */ - h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ + h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ + HDoff_t offset = (HDoff_t)addr; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -705,15 +708,21 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS bytes_in = (h5_posix_io_t)size; do { +#ifdef H5_HAVE_PREADWRITE + bytes_read = HDpread(file->fd, buf, bytes_in, offset); + offset += bytes_read; +#else bytes_read = HDread(file->fd, buf, bytes_in); +#endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_read && EINTR == errno); if(-1 == bytes_read) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); - HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset); + offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ if(0 == bytes_read) { @@ -777,11 +786,13 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if(REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu", (unsigned long long)addr, (unsigned long long)size) - /* Seek to the correct location */ +#ifndef H5_HAVE_PREADWRITE + /* Seek to the correct location (if we don't have pwrite) */ if(addr != file->pos || OP_WRITE != file->op) { if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") } /* end if */ +#endif /* H5_HAVE_PREADWRITE */ /* Write the data, being careful of interrupted system calls and partial * results @@ -790,6 +801,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ + HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -800,15 +812,21 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU bytes_in = (h5_posix_io_t)size; do { +#ifdef H5_HAVE_PREADWRITE + bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset); + offset += bytes_wrote; +#else bytes_wrote = HDwrite(file->fd, buf, bytes_in); +#endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_wrote && EINTR == errno); if(-1 == bytes_wrote) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); - HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset); + offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ HDassert(bytes_wrote > 0); diff --git a/src/H5Fefc.c b/src/H5Fefc.c index a394071..f3881d4 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -29,8 +29,10 @@ /* Packages needed by this file... */ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ @@ -144,6 +146,8 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi H5F_efc_t *efc = NULL; /* External file cache for parent file */ H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */ hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */ + H5P_genplist_t *plist; /* Property list pointer for FAPL */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -153,6 +157,18 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi HDassert(parent->shared); HDassert(name); + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + if(H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + /* Get external file cache */ efc = parent->shared->efc; diff --git a/src/H5Fint.c b/src/H5Fint.c index 17d41b0..dd8774a 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -76,7 +76,7 @@ typedef struct H5F_olist_t { /* Local Prototypes */ /********************/ -static herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info); +static herr_t H5F__set_vol_conn(H5F_t *file); static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); @@ -119,8 +119,9 @@ H5FL_DEFINE(H5F_file_t); *------------------------------------------------------------------------- */ static herr_t -H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info) +H5F__set_vol_conn(H5F_t *file) { + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ void *new_connector_info = NULL; /* Copy of connector info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -129,21 +130,30 @@ H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info) /* Sanity check */ HDassert(file); + /* Retrieve a copy of the "top-level" connector property, before any pass-through + * connectors modified or unwrapped it. + */ + if(H5CX_get_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info from API context") + + /* Sanity check */ + HDassert(0 != connector_prop.connector_id); + /* Copy connector info, if it exists */ - if(vol_info) { + if(connector_prop.connector_info) { H5VL_class_t *connector; /* Pointer to connector */ /* Retrieve the connector for the ID */ - if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id))) + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Allocate and copy connector info */ - if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0) + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop.connector_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed") } /* end if */ /* Cache the connector ID & info for the container */ - file->shared->vol_id = vol_id; + file->shared->vol_id = connector_prop.connector_id; file->shared->vol_info = new_connector_info; if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed") @@ -792,14 +802,12 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, /* get last component of file_name */ H5_GET_LAST_DELIMITER(actual_file_name, ptr) - if(!ptr) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file, file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) - - /* Truncate filename portion from actual file name path */ - *ptr = '\0'; + if(ptr) + /* Truncate filename portion from actual file name path */ + *ptr = '\0'; /* Build new file name for the external file */ - if(H5F__build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) + if(H5F__build_name((ptr ? actual_file_name : ""), temp_file_name, &full_name/*out*/) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") actual_file_name = (char *)H5MM_xfree(actual_file_name); @@ -815,7 +823,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, H5E_clear_stack(NULL); } /* end if */ - /* Success */ + /* Set return value (possibly NULL or valid H5F_t *) */ ret_value = src_file; done: @@ -1090,14 +1098,8 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info") /* Get the VOL connector info */ - { - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - - if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info") - if(H5F__set_vol_conn(f, connector_prop.connector_id, connector_prop.connector_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info") - } /* end block */ + if(H5F__set_vol_conn(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info") /* Create a metadata cache with the specified number of elements. * The cache might be created with a different number of elements and diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index c4bf0b4..9f1ed01 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -234,7 +234,7 @@ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); H5_DLL herr_t H5Fclose(hid_t file_id); H5_DLL hid_t H5Fget_create_plist(hid_t file_id); H5_DLL hid_t H5Fget_access_plist(hid_t file_id); -H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned * intent); +H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent); H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types); H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list); H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); @@ -648,6 +648,8 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + if(!udata && udata_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata cannot be NULL if udata_size is non-zero") /* Check the group access property list */ if(H5P_DEFAULT == lcpl_id) diff --git a/src/H5Oattr.c b/src/H5Oattr.c index c93bf32..c420046 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -176,7 +176,12 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, /* Decode and store the name */ if(NULL == (attr->shared->name = H5MM_strdup((const char *)p))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + /* Make an attempt to detect corrupted name or name length - HDFFV-10588 */ + if(name_len != (HDstrlen(attr->shared->name) + 1)) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length") + if(attr->shared->version < H5O_ATTR_VERSION_2) p += H5O_ALIGN_OLD(name_len); /* advance the memory pointer */ else diff --git a/src/H5Obogus.c b/src/H5Obogus.c index fbf04f2..f3cca0f 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -49,7 +49,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1] = {{ H5O_BOGUS_VALID_ID, /*message id number */ "bogus valid", /*message name for debugging */ 0, /*native message size */ - 0, /* messages are sharable? */ + H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ H5O_bogus_encode, /*encode message */ NULL, /*copy the native value */ @@ -73,7 +73,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ H5O_BOGUS_INVALID_ID, /*message id number */ "bogus invalid", /*message name for debugging */ 0, /*native message size */ - 0, /* messages are sharable? */ + H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ H5O_bogus_encode, /*encode message */ NULL, /*copy the native value */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index fba4f6e..578cff0 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1390,7 +1390,8 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Message size */ UINT16DECODE(chunk_image, mesg_size); - HDassert(mesg_size == H5O_ALIGN_OH(oh, mesg_size)); + if(mesg_size != H5O_ALIGN_OH(oh, mesg_size)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message not aligned") /* Message flags */ flags = *chunk_image++; @@ -1402,10 +1403,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message") if((flags & H5O_MSG_FLAG_WAS_UNKNOWN) && !(flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN)) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message") - if((flags & H5O_MSG_FLAG_SHAREABLE) - && H5O_msg_class_g[id] - && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message of unsharable class flagged as sharable") + /* Delay checking the "shareable" flag until we've made sure id + * references a valid message class that this version of the library + * knows about */ /* Reserved bytes/creation index */ if(oh->version == H5O_VERSION_1) @@ -1517,9 +1517,17 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image mesgs_modified = TRUE; } /* end if */ } /* end if */ - else + else { + /* Check for message of unshareable class marked as "shareable" + */ + if((flags & H5O_MSG_FLAG_SHAREABLE) + && H5O_msg_class_g[id] + && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message of unshareable class flagged as shareable") + /* Set message class for "known" messages */ mesg->type = H5O_msg_class_g[id]; + } /* end else */ /* Do some inspection/interpretation of new messages from this chunk */ /* (detect continuation messages, ref. count messages, etc.) */ diff --git a/src/H5Oint.c b/src/H5Oint.c index 2503eb7..d3a409c 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -125,12 +125,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = { H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ H5O_MSG_FSINFO, /*0x0017 Free-space manager info */ H5O_MSG_MDCI, /*0x0018 Metadata cache image */ - H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */ -#ifdef H5O_ENABLE_BOGUS - H5O_MSG_BOGUS_INVALID, /*0x001A "Bogus invalid" (for testing) */ -#else /* H5O_ENABLE_BOGUS */ - NULL, /*0x001A "Bogus invalid" (for testing) */ -#endif /* H5O_ENABLE_BOGUS */ + H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */ }; /* Format version bounds for object header */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index d6e3dce..18f3706 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1598,16 +1598,23 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(mesg); - - /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */ - if(type->share_flags & H5O_SHARE_IS_SHARABLE) - ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type); - else +#ifdef H5O_ENABLE_BOGUS + if(type_id >= NELMTS(H5O_msg_class_g)) ret_value = FALSE; + else +#endif /* H5O_ENABLE_BOGUS */ + { + HDassert(type_id < NELMTS(H5O_msg_class_g)); + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + HDassert(type); + HDassert(mesg); + + /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */ + if(type->share_flags & H5O_SHARE_IS_SHARABLE) + ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type); + else + ret_value = FALSE; + } /* end block/else */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_is_shared() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index dbc8089..668f4f0 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -29,7 +29,7 @@ #define H5O_NMESGS 8 /*initial number of messages */ #define H5O_NCHUNKS 2 /*initial number of chunks */ #define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */ -#define H5O_MSG_TYPES 27 /* # of types of messages */ +#define H5O_MSG_TYPES 26 /* # of types of messages */ #define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */ /* Versions of object header structure */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 5a3d4f6..46e2845 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -227,11 +227,11 @@ typedef struct H5O_copy_t { * Note: Must increment H5O_MSG_TYPES in H5Opkg.h and update H5O_msg_class_g * in H5O.c when creating a new message type. Also bump the value of * H5O_BOGUS_INVALID_ID, below, to be one greater than the value of - * H5O_UNKNOWN_ID. + * H5O_UNKNOWN_ID, and re-run gen_bogus.c. * * (this should never exist in a file) */ -#define H5O_BOGUS_INVALID_ID 0x001A /* "Bogus invalid" Message. */ +#define H5O_BOGUS_INVALID_ID 0x001a /* "Bogus invalid" Message. */ /* Shared object message types. * Shared objects can be committed, in which case the shared message contains @@ -655,6 +655,7 @@ typedef struct H5O_layout_t { */ #define H5O_BOGUS_VALUE 0xdeadbeef typedef struct H5O_bogus_t { + H5O_shared_t sh_loc; /* Shared message info (must be first) */ unsigned u; /* Hold the bogus info */ } H5O_bogus_t; #endif /* H5O_ENABLE_BOGUS */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index bfc1d93..8338d84 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -2017,6 +2017,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_mpio_actual_io_mode() */ + /*------------------------------------------------------------------------- * Function: H5Pget_mpio_no_collective_cause * @@ -2053,8 +2054,6 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_mpio_no_collective_cause() */ - - #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 2f094ea..078fe74 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -167,7 +167,8 @@ typedef enum H5D_mpio_no_collective_cause_t { H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10, H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20, H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40, - H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x80 + H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE = 0x80, + H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100 } H5D_mpio_no_collective_cause_t; /********************/ @@ -237,26 +237,25 @@ H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space) HDassert(space); - if (space_id < 0) + /* Check for invalid ID */ + if(space_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)") - if (H5S_ALL == space_id) { - /* No special dataspace struct for H5S_ALL */ + /* No special dataspace struct for H5S_ALL */ + if(H5S_ALL == space_id) *space = NULL; - } else { /* Get the dataspace pointer */ - if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + if(NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID") /* Check for valid selection */ - if (H5S_SELECT_VALID(*space) != TRUE) + if(H5S_SELECT_VALID(*space) != TRUE) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent") - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5S_get_validated_dataspace() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index ed3fa45..88c570d 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -278,11 +278,8 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space) static herr_t H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { - const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ - H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */ unsigned rank; /* Dataspace's dimension rank */ unsigned u; /* Index variable */ - int i; /* Index variable */ FUNC_ENTER_STATIC_NOERR @@ -298,16 +295,16 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) /* Get the rank of the dataspace */ rank = space->extent.rank; - /* Set the temporary pointer to the dimension information */ - tdiminfo = space->select.sel_info.hslab->opt_diminfo; - /* Check for the special case of just one H5Sselect_hyperslab call made */ if(space->select.sel_info.hslab->diminfo_valid) { /* Initialize the information needed for regular hyperslab I/O */ + const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ const hsize_t *mem_size; /* Temporary pointer to dataspace extent's dimension sizes */ - hsize_t acc; /* Accumulator for "flattened" dimension's sizes */ unsigned cont_dim = 0; /* # of contiguous dimensions */ + /* Set the temporary pointer to the dimension information */ + tdiminfo = space->select.sel_info.hslab->opt_diminfo; + /* Set the temporary pointer to the dataspace extent's dimension sizes */ mem_size = space->extent.size; @@ -336,9 +333,11 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) /* Check if the regular selection can be "flattened" */ if(cont_dim > 0) { + hsize_t acc; /* Accumulator for "flattened" dimension's sizes */ unsigned last_dim_flattened = 1; /* Flag to indicate that the last dimension was flattened */ unsigned flat_rank = rank-cont_dim; /* Number of dimensions after flattening */ unsigned curr_dim; /* Current dimension */ + int i; /* Index variable */ /* Set the iterator's rank to the contiguous dimensions */ iter->u.hyp.iter_rank = flat_rank; @@ -416,6 +415,8 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) iter->u.hyp.spans = NULL; } /* end if */ else { + H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */ + /* Initialize the information needed for non-regular hyperslab I/O */ HDassert(space->select.sel_info.hslab->span_lst); /* Make a copy of the span tree to iterate over */ @@ -1443,70 +1444,65 @@ H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_sp FUNC_ENTER_STATIC_NOERR - /* Check for redundant comparison */ + /* Check for redundant comparison (or both spans being NULL) */ if(span_info1 == span_info2) ret_value = TRUE; else { - const H5S_hyper_span_t *span1; - const H5S_hyper_span_t *span2; - - /* Check for both spans being NULL */ - if(span_info1 == NULL && span_info2 == NULL) - ret_value = TRUE; + /* Check for one span being NULL */ + if(span_info1 == NULL || span_info2 == NULL) + ret_value = FALSE; else { - /* Check for one span being NULL */ - if(span_info1 == NULL || span_info2 == NULL) - ret_value = FALSE; - else { - /* Get the pointers to the actual lists of spans */ - span1 = span_info1->head; - span2 = span_info2->head; - - /* Sanity checking */ - HDassert(span1); - HDassert(span2); - - /* infinite loop which must be broken out of */ - while(1) { - /* Check for both spans being NULL */ - if(span1 == NULL && span2 == NULL) { - ret_value = TRUE; + const H5S_hyper_span_t *span1; + const H5S_hyper_span_t *span2; + + /* Get the pointers to the actual lists of spans */ + span1 = span_info1->head; + span2 = span_info2->head; + + /* Sanity checking */ + HDassert(span1); + HDassert(span2); + + /* infinite loop which must be broken out of */ + while(1) { + /* Check for both spans being NULL */ + if(span1 == NULL && span2 == NULL) { + ret_value = TRUE; + break; + } /* end if */ + else { + /* Check for one span being NULL */ + if(span1 == NULL || span2 == NULL) { + ret_value = FALSE; break; } /* end if */ else { - /* Check for one span being NULL */ - if(span1 == NULL || span2 == NULL) { + /* Check if the actual low & high span information is the same */ + if(span1->low != span2->low || span1->high != span2->high) { ret_value = FALSE; break; } /* end if */ else { - /* Check if the actual low & high span information is the same */ - if(span1->low != span2->low || span1->high != span2->high) { - ret_value = FALSE; - break; - } /* end if */ - else { - if(span1->down != NULL || span2 != NULL) { - if(!H5S__hyper_cmp_spans(span1->down, span2->down)) { - ret_value = FALSE; - break; - } /* end if */ - else { - /* Keep going... */ - } /* end else */ + if(span1->down != NULL || span2 != NULL) { + if(!H5S__hyper_cmp_spans(span1->down, span2->down)) { + ret_value = FALSE; + break; } /* end if */ else { /* Keep going... */ } /* end else */ + } /* end if */ + else { + /* Keep going... */ } /* end else */ } /* end else */ } /* end else */ + } /* end else */ - /* Advance to the next nodes in the span list */ - span1 = span1->next; - span2 = span2->next; - } /* end while */ - } /* end else */ + /* Advance to the next nodes in the span list */ + span1 = span1->next; + span2 = span2->next; + } /* end while */ } /* end else */ } /* end else */ @@ -2368,17 +2364,17 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl hsize_t *tstart; /* Temporary hyperslab pointers */ hsize_t *tend; /* Temporary hyperslab pointers */ hsize_t *tblock; /* Temporary hyperslab pointers */ - size_t num_elem; /* Number of elements in selection */ + size_t block_count; /* Number of blocks in selection */ unsigned v; /* Local counting variable */ - /* Decode the number of points */ - UINT32DECODE(pp, num_elem); + /* Decode the number of blocks */ + UINT32DECODE(pp, block_count); /* Set the count & stride for all blocks */ stride = count = H5S_hyper_ones_g; /* Retrieve the coordinates from the buffer */ - for(u = 0; u < num_elem; u++) { + for(u = 0; u < block_count; u++) { /* Decode the starting points */ for(tstart = start, v = 0; v < rank; v++, tstart++) UINT32DECODE(pp, *tstart); @@ -3283,10 +3279,9 @@ H5S__hyper_is_single(const H5S_t *space) */ /* Check for a single block */ - for(u = 0; u < space->extent.rank; u++) { + for(u = 0; u < space->extent.rank; u++) if(space->select.sel_info.hslab->opt_diminfo[u].count > 1) HGOTO_DONE(FALSE) - } /* end for */ } /* end if */ else { H5S_hyper_span_info_t *spans; /* Hyperslab span info node */ @@ -4019,13 +4014,12 @@ done: PURPOSE Helper routine to detect intersections in span trees USAGE - htri_t H5S_hyper_intersect_block_helper(spans, start, end) + hbool_t H5S__hyper_intersect_block_helper(spans, start, end) H5S_hyper_span_info_t *spans; IN: First span tree to operate with - hssize_t *offset; IN: Selection offset coordinate hsize_t *start; IN: Starting coordinate for block hsize_t *end; IN: Ending coordinate for block RETURN - Non-negative on success, negative on failure + Non-negative (TRUE/FALSE) on success, can't fail DESCRIPTION Quickly detect intersections between span tree and block GLOBAL VARIABLES @@ -4369,6 +4363,7 @@ static herr_t H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) { H5S_hyper_span_t *prev_span = NULL; /* Pointer to previous list of spans */ + unsigned delta_rank; /* Difference in dataspace ranks */ unsigned curr_dim; /* Current dimension being operated on */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4382,7 +4377,8 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) /* Create nodes until reaching the correct # of dimensions */ new_space->select.sel_info.hslab->span_lst = NULL; curr_dim = 0; - while(curr_dim < (new_space->extent.rank - base_space->extent.rank)) { + delta_rank = (new_space->extent.rank - base_space->extent.rank); + while(curr_dim < delta_rank) { H5S_hyper_span_info_t *new_span_info; /* Pointer to list of spans */ H5S_hyper_span_t *new_span; /* Temporary hyperslab span */ @@ -4723,11 +4719,11 @@ done: "Normalize" a hyperslab selection by adjusting it's coordinates by the amount of the selection offset. USAGE - hbool_t H5S_hyper_normalize_offset(space, old_offset) + htri_t H5S_hyper_normalize_offset(space, old_offset) H5S_t *space; IN/OUT: Pointer to dataspace to move hssize_t *old_offset; OUT: Pointer to space to store old offset RETURNS - TRUE if space has been normalized, FALSE if not + TRUE/FALSE for hyperslab selection, FAIL on error DESCRIPTION Copies the current selection offset into the array provided, then inverts the selection offset, subtracts the offset from the hyperslab @@ -4740,7 +4736,7 @@ done: htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset) { - htri_t ret_value = FALSE; /* Return value */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -5101,10 +5097,10 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Split off upper part of span 'b' at upper span of span 'a' */ /* Check if there is actually an upper part of span 'b' to split off */ - if(span_a->high<span_b->high) { + if(span_a->high < span_b->high) { /* Allocate new span node for upper part of span 'b' */ if(NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") /* Advance span 'a' */ H5S__hyper_recover_span(&recover_a,&span_a,span_a->next); @@ -5269,12 +5265,12 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s } /* end else */ /* Check if there is actually an upper part of span 'b' to split off */ - if(span_a->high<span_b->high) { + if(span_a->high < span_b->high) { /* Split off upper part of span 'b' at upper span of span 'a' */ /* Allocate new span node for upper part of spans 'a' */ if(NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") /* And advance span 'a' */ H5S__hyper_recover_span(&recover_a,&span_a,span_a->next); @@ -5294,9 +5290,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* AAAAAAAAAA */ /* <-----------------------------------> */ /* BBBBBBBBBB */ - else if((span_a->low>=span_b->low && span_a->low<=span_b->high) && span_a->high>span_b->high) { + else if((span_a->low >= span_b->low && span_a->low <= span_b->high) && span_a->high > span_b->high) { /* Check if there is actually a lower part of span 'b' to split off */ - if(span_a->low>span_b->low) { + if(span_a->low > span_b->low) { /* Split off lower part of span 'b' at lower span of span 'a' */ /* Merge/add lower part of span 'b' with/to b_not_a list */ @@ -5364,7 +5360,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Allocate new span node for upper part of span 'a' */ if(NULL == (tmp_span = H5S__hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") /* Make upper part of span 'a' into new span 'a' */ H5S__hyper_recover_span(&recover_a,&span_a,tmp_span); @@ -5448,12 +5444,6 @@ static H5S_hyper_span_info_t * H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans) { H5S_hyper_span_info_t *merged_spans = NULL; /* Pointer to the merged span tree */ - H5S_hyper_span_info_t *tmp_spans; /* Pointer to temporary new span tree */ - H5S_hyper_span_t *tmp_span; /* Pointer to temporary new span */ - H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */ - H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */ - H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */ - hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */ H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -5472,6 +5462,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf } /* end else */ } /* end if */ else { + H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */ + H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */ + H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */ + hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */ + /* Get the pointers to the 'a' and 'b' span lists */ span_a = a_spans->head; span_b = b_spans->head; @@ -5484,6 +5479,9 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Work through the list of spans in the new list */ while(span_a != NULL && span_b != NULL) { + H5S_hyper_span_info_t *tmp_spans; /* Pointer to temporary new span tree */ + H5S_hyper_span_t *tmp_span; /* Pointer to temporary new span */ + /* Check if the 'a' span is completely before 'b' span */ /* AAAAAAA */ /* <-----------------------------------> */ @@ -5766,7 +5764,7 @@ done: static herr_t H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t can_own) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space); @@ -9317,21 +9315,17 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Assert that src_space and src_intersect_space have same extent and there * are no point selections */ - HDassert(H5S_GET_EXTENT_NDIMS(src_space) - == H5S_GET_EXTENT_NDIMS(src_intersect_space)); + HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); HDassert(!HDmemcmp(src_space->extent.size, src_intersect_space->extent.size, - (size_t)H5S_GET_EXTENT_NDIMS(src_space) - * sizeof(src_space->extent.size[0]))); + (size_t)H5S_GET_EXTENT_NDIMS(src_space) * sizeof(src_space->extent.size[0]))); HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_POINTS); HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_POINTS); HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) != H5S_SEL_POINTS); /* Initialize prev_space, curr_span_tree, and curr_span_up_dim */ - for(i = 0; i < H5S_MAX_RANK; i++) { - curr_span_tree[i] = NULL; - prev_span[i] = NULL; - curr_span_up_dim[i] = (hsize_t)0; - } /* end for */ + HDmemset(curr_span_tree, 0, sizeof(curr_span_tree)); + HDmemset(prev_span, 0, sizeof(prev_span)); + HDmemset(curr_span_up_dim, 0, sizeof(curr_span_up_dim)); /* Save rank of projected space */ proj_rank = proj_space->extent.rank; @@ -9343,8 +9337,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, sis_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_intersect_space); HDassert(ss_nelem == ds_nelem); - /* Calculate proj_down_dims (note loop relies on unsigned i wrapping around) - */ + /* Calculate proj_down_dims */ if(H5VM_array_down(proj_rank, proj_space->extent.size, proj_down_dims) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value") @@ -9358,7 +9351,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Allocate space for the hyperslab selection information (note this sets * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */ - if((proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL) + if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") /* Set selection type */ @@ -9367,9 +9360,9 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Set unlim_dim */ proj_space->select.sel_info.hslab->unlim_dim = -1; - /* Allocate the source space iterator */ + /* Allocate the source selection iterator */ if(NULL == (ss_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source space iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source selection iterator") /* Initialize source space iterator */ if(H5S_select_iter_init(ss_iter, src_space, (size_t)1) < 0) @@ -9382,9 +9375,9 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, ss_nelem -= nelem; HDassert(ss_nseq > 0); - /* Allocate the destination space iterator */ + /* Allocate the destination selection iterator */ if(NULL == (ds_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination space iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination selection iterator") /* Initialize destination space iterator */ if(H5S_select_iter_init(ds_iter, dst_space, (size_t)1) < 0) @@ -9443,9 +9436,8 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Reset advance_ss */ advance_ss = FALSE; - } /* end if */ - if(advance_sis - || (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) { + } /* end while */ + if(advance_sis || (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) { do { /* Either we finished the current source intersect sequence or * the sequences do not intersect. Advance source intersect @@ -9524,8 +9516,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(ds_sel_off <= int_sel_off); proj_off = ds_off[ds_i] + int_sel_off - ds_sel_off; proj_len = proj_len_rem = (size_t)MIN(int_len, - (size_t)(ds_sel_off + (hsize_t)ds_len[ds_i] - - int_sel_off)); + (size_t)(ds_sel_off + (hsize_t)ds_len[ds_i] - int_sel_off)); /* Add to span tree */ while(proj_len_rem > (size_t)0) { @@ -9565,7 +9556,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, (size_t)(proj_space->extent.size[proj_rank - 1] - low)); HDassert(proj_len_rem >= span_len); - high = low + (hsize_t)span_len - (hsize_t)1; + high = (low + (hsize_t)span_len) - (hsize_t)1; /* Append span in lowest dimension */ if(H5S__hyper_append_span(&prev_span[proj_rank - 1], &curr_span_tree[proj_rank - 1], low, high, NULL, NULL) < 0) @@ -9791,11 +9782,11 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -void +static void H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, hsize_t *block, hsize_t clip_size) { - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Check for selection outside clip size */ if(start >= clip_size) { @@ -9819,7 +9810,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, } /* end else */ FUNC_LEAVE_NOAPI_VOID -} /* end H5S_hyper_get_clip_diminfo() */ +} /* end H5S__hyper_get_clip_diminfo() */ /*-------------------------------------------------------------------------- @@ -9836,8 +9827,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, Non-negative on success/Negative on failure. DESCRIPTION This function changes the unlimited selection into a limited selection - with the extent of the formerly unlimited dimension specified by - * clip_size. + with the extent of the formerly unlimited dimension specified by clip_size. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Note this function does not take the offset into account. @@ -9892,8 +9882,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) } /* end if */ else { /* Calculate number of elements */ - space->select.num_elem = diminfo->count * diminfo->block - * hslab->num_elem_non_unlim; + space->select.num_elem = diminfo->count * diminfo->block * hslab->num_elem_non_unlim; /* Check if last block is partial. If superset is set, just keep the * last block complete to speed computation. */ @@ -9924,8 +9913,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) /* Indicate that the regular dimensions are no longer valid */ hslab->diminfo_valid = FALSE; - /* "And" selection with calculated block to perform clip operation - */ + /* "And" selection with calculated block to perform clip operation */ if(H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs") } /* end if */ @@ -10369,7 +10357,7 @@ done: /*-------------------------------------------------------------------------- NAME - H5Sgetregular_hyperslab + H5Sget_regular_hyperslab PURPOSE Retrieve a regular hyperslab selection USAGE diff --git a/src/H5Spkg.h b/src/H5Spkg.h index d895f40..9ad97dc 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -124,7 +124,7 @@ typedef struct { * information. */ int unlim_dim; /* Dimension where selection is unlimited, or -1 if none */ hsize_t num_elem_non_unlim; /* # of elements in a "slice" excluding the unlimited dimension */ - H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information */ + H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information of all dimensions */ } H5S_hyper_sel_t; /* Selection information methods */ @@ -275,8 +275,7 @@ H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, /* Operations on selections */ H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space, - const H5S_t *dst_space, const H5S_t *src_intersect_space, - H5S_t *proj_space); + const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space); H5_DLL herr_t H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space); /* Testing functions */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 9924920..aea7d5c 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -775,7 +775,6 @@ done: static hssize_t H5S_point_serial_size (const H5S_t *space) { - H5S_pnt_node_t *curr; /* Point information nodes */ hssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -789,12 +788,8 @@ H5S_point_serial_size (const H5S_t *space) ret_value = 24; /* Count points in selection */ - curr=space->select.sel_info.pnt_lst->head; - while(curr!=NULL) { - /* Add 4 bytes times the rank for each element selected */ - ret_value+=4*space->extent.rank; - curr=curr->next; - } /* end while */ + /* (Add 4 bytes times the rank for each element selected) */ + ret_value += (4 * space->extent.rank) * (hssize_t)H5S_GET_SELECT_NPOINTS(space); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_serial_size() */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index a42d12e..6e6ca76 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -1515,14 +1515,20 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space, /* Make the application callback */ user_ret = (op->u.app_op.op)(loc, op->u.app_op.type_id, ndims, coords, op_data); break; + case H5S_SEL_ITER_OP_LIB: /* Call the library's callback */ user_ret = (op->u.lib_op)(loc, type, ndims, coords, op_data); break; + default: HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported op type") } /* end switch */ + /* Check for error return from iterator */ + if(user_ret < 0) + HERROR(H5E_DATASPACE, H5E_CANTNEXT, "iteration operator failed"); + /* Increment offset in dataspace */ curr_off += elmt_size; @@ -1711,10 +1717,6 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) HDassert(space_a_rank >= space_b_rank); HDassert(space_b_rank > 0); - /* Check for different number of elements selected */ - if(H5S_GET_SELECT_NPOINTS(space_a) != H5S_GET_SELECT_NPOINTS(space_b)) - HGOTO_DONE(FALSE) - /* Check for "easy" cases before getting into generalized block iteration code */ if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_ALL) && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_ALL)) { hsize_t dims1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */ @@ -295,6 +295,7 @@ static htri_t H5T__compiler_conv(H5T_t *src, H5T_t *dst); static herr_t H5T__set_size(H5T_t *dt, size_t size); static herr_t H5T__close_cb(H5T_t *dt); static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv); +static hbool_t H5T__detect_reg_ref(const H5T_t *dt); /*****************************/ @@ -5506,6 +5507,111 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_detect_reg_ref + * + * Purpose: Check whether a datatype contains (or is) a region reference + * datatype. + * + * Return: TRUE (1) or FALSE (0) on success + * (Can't fail) + * + * Programmer: Quincey Koziol + * Saturday, January 5, 2019 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5T__detect_reg_ref(const H5T_t *dt) +{ + unsigned u; /* Local index variable */ + hbool_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(dt); + + /* Check if this datatype is a region reference */ + if(H5T_REFERENCE == dt->shared->type && H5R_DATASET_REGION == dt->shared->u.atomic.u.r.rtype) + HGOTO_DONE(TRUE); + + /* Check for types that might have the correct type as a component */ + switch(dt->shared->type) { + case H5T_COMPOUND: + /* Iterate over all the compound datatype's fields */ + for(u = 0; u < dt->shared->u.compnd.nmembs; u++) + /* Recurse on field's datatype */ + if(H5T__detect_reg_ref(dt->shared->u.compnd.memb[u].type)) + HGOTO_DONE(TRUE); + break; + + case H5T_ARRAY: + case H5T_VLEN: + case H5T_ENUM: + HGOTO_DONE(H5T__detect_reg_ref(dt->shared->parent)); + break; + + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_NCLASSES: + default: + break; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__detect_reg_ref() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_is_vl_storage + * + * Purpose: Check if a datatype will be stored in a variable-length form. + * + * Notes: Currently, only variable-length string & sequences and region + * references are stored in a variable-length form. + * + * Return: + * One of two values on success: + * TRUE - If the datatype will be stored in a variable-length form + * FALSE - If the datatype will NOT be stored in a variable-length form + * <0 is returned on failure + * + * Programmer: Quincey Koziol + * Saturday, January 5, 2019 + * + *------------------------------------------------------------------------- + */ +htri_t +H5T_is_vl_storage(const H5T_t *dt) +{ + htri_t ret_value = FALSE; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(dt); + + /* VL and region reference datatypes are stored in variable-length form */ + if(H5T_detect_class(dt, H5T_VLEN, FALSE)) + ret_value = TRUE; + else if(H5T_detect_class(dt, H5T_REFERENCE, FALSE)) + ret_value = H5T__detect_reg_ref(dt); + else + ret_value = FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_is_vl_storage() */ + + +/*------------------------------------------------------------------------- * Function: H5T_upgrade_version_cb * * Purpose: H5T__visit callback to Upgrade the version of a datatype diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 6b6446f..3dcbb2c 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -145,6 +145,7 @@ H5_DLL H5T_t *H5T_get_actual_type(H5T_t *dt); H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); H5_DLL hbool_t H5T_already_vol_managed(const H5T_t *dt); +H5_DLL htri_t H5T_is_vl_storage(const H5T_t *dt); /* Reference specific functions */ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); @@ -517,3 +517,73 @@ done: FUNC_LEAVE_API(ret_value) } /* H5VLcmp_connector_cls() */ + +/*--------------------------------------------------------------------------- + * Function: H5VLwrap_register + * + * Purpose: Wrap an internal object with a "wrap context" and register an + * hid_t for the resulting object. + * + * Note: This routine is mainly targeted toward wrapping objects for + * iteration routine callbacks (i.e. the callbacks from H5Aiterate*, + * H5Literate* / H5Lvisit*, and H5Ovisit* ). + * + * Return: Success: Non-negative hid_t for the object. + * Failure: Negative (H5I_INVALID_HID) + * + *--------------------------------------------------------------------------- + */ +hid_t +H5VLwrap_register(void *obj, H5I_type_t type) +{ + hid_t ret_value; /* Return value */ + + /* Use FUNC_ENTER_API_NOINIT here, so the API context doesn't get reset */ + FUNC_ENTER_API_NOINIT + H5TRACE2("i", "*xIt", obj, type); + + /* Check args */ + if(type <= H5I_BADID || type >= H5I_NTYPES) + HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") + if(NULL == obj) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL") + + /* Wrap the object and register an ID for it */ + if((ret_value = H5VL_wrap_register(type, obj, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to wrap object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLwrap_register() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLobject + * + * Purpose: Retrieve the object pointer associated with an hid_t for a. + * VOL object. + * + * Note: This routine is mainly targeted toward unwrapping objects for + * testing. + * + * Return: Success: Object pointer + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLobject(hid_t id) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + H5TRACE1("*x", "i", id); + + /* Retrieve the object pointer for the ID */ + if(NULL == (ret_value = H5VL_object(id))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to retrieve object") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLobject() */ + diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 811162d..2d6ac33 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -829,7 +829,8 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj) +H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj, + H5I_type_t obj_type) { void *ret_value = SUCCEED; /* Return value */ @@ -842,7 +843,7 @@ H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj) /* Only wrap object if there's a wrap context */ if(wrap_ctx) { /* Ask the connector to wrap the object */ - if(NULL == (ret_value = (connector->wrap_object)(obj, wrap_ctx))) + if(NULL == (ret_value = (connector->wrap_object)(obj, obj_type, wrap_ctx))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") } /* end if */ else @@ -864,13 +865,13 @@ done: *--------------------------------------------------------------------------- */ void * -H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx) +H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx) { H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("*x", "*xi*x", obj, connector_id, wrap_ctx); + H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx); /* Check args and get class pointer */ if(NULL == obj) @@ -879,7 +880,7 @@ H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Wrap the object */ - if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj))) + if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") done: diff --git a/src/H5VLint.c b/src/H5VLint.c index 8695a80..f22fdb6 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -65,7 +65,7 @@ typedef struct H5VL_wrap_ctx_t { /* Local Prototypes */ /********************/ static herr_t H5VL__free_cls(H5VL_class_t *cls); -static void *H5VL__wrap_obj(void *obj); +static void *H5VL__wrap_obj(void *obj, H5I_type_t obj_type); static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t wrap_obj); static void *H5VL__object(hid_t id, H5I_type_t obj_type); @@ -248,7 +248,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__wrap_obj(void *obj) +H5VL__wrap_obj(void *obj, H5I_type_t obj_type) { H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ void *ret_value = NULL; /* Return value */ @@ -265,7 +265,7 @@ H5VL__wrap_obj(void *obj) /* If there is a VOL object wrapping context, wrap the object */ if(vol_wrap_ctx) { /* Wrap object, using the VOL callback */ - if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) + if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj, obj_type))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") } /* end if */ else @@ -310,7 +310,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object") new_vol_obj->connector = vol_connector; if(wrap_obj) { - if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object))) + if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object, type))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object") } /* end if */ else @@ -879,9 +879,11 @@ done: * * Purpose: Compare VOL class for a connector * - * Return: Positive if VALUE1 is greater than VALUE2, negative if - * VALUE2 is greater than VALUE1 and zero if VALUE1 and - * VALUE2 are equal (like strcmp). + * Note: Sets *cmp_value positive if VALUE1 is greater than VALUE2, + * negative if VALUE2 is greater than VALUE1, and zero if VALUE1 + * and VALUE2 are equal (like strcmp). + * + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ @@ -1097,7 +1099,7 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") /* Wrap the object with VOL connector info */ - if(NULL == (new_obj = H5VL__wrap_obj(obj))) + if(NULL == (new_obj = H5VL__wrap_obj(obj, type))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") /* Retrieve the VOL object wrapping context */ diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 8b83e2e..f7f9058 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -26,6 +26,7 @@ /* Header files needed */ /* (Public HDF5 and standard C / POSIX only) */ #include <assert.h> +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -89,7 +90,8 @@ static herr_t H5VL_pass_through_str_to_info(const char *str, void **info); static void *H5VL_pass_through_get_object(const void *obj); static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx); static herr_t H5VL_pass_through_free_wrap_ctx(void *obj); -static void *H5VL_pass_through_wrap_object(void *obj, void *wrap_ctx); +static void *H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, + void *wrap_ctx); /* Attribute callbacks */ static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); @@ -171,7 +173,7 @@ static const H5VL_class_t H5VL_pass_through_g = { 0, /* capability flags */ H5VL_pass_through_init, /* initialize */ H5VL_pass_through_term, /* terminate */ - sizeof(H5VL_pass_through_t), /* info size */ + sizeof(H5VL_pass_through_info_t), /* info size */ H5VL_pass_through_info_copy, /* info copy */ H5VL_pass_through_info_cmp, /* info compare */ H5VL_pass_through_info_free, /* info free */ @@ -659,7 +661,7 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx) *--------------------------------------------------------------------------- */ static void * -H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx) +H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx) { H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx; H5VL_pass_through_t *new_obj; @@ -670,7 +672,7 @@ H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx) #endif /* Wrap the object with the underlying VOL */ - under = H5VLwrap_object(obj, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx); + under = H5VLwrap_object(obj, obj_type, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx); if(under) new_obj = H5VL_pass_through_new_obj(under, wrap_ctx->under_vol_id); else diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index ef5a81e..283c77a 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -95,7 +95,7 @@ H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx); H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_connector); H5_DLL herr_t H5VL_reset_vol_wrapper(void); H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, - void *obj); + void *obj, H5I_type_t obj_type); /* ID registration functions */ H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 5de36c8..6ea9fc1 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -22,6 +22,7 @@ #include "H5Apublic.h" /* Attributes */ #include "H5ESpublic.h" /* Event Stack */ #include "H5Fpublic.h" /* Files */ +#include "H5Ipublic.h" /* IDs */ #include "H5Lpublic.h" /* Links */ #include "H5Opublic.h" /* Objects */ #include "H5Rpublic.h" /* References */ @@ -383,7 +384,7 @@ typedef struct H5VL_class_t { herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */ void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */ herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */ - void* (*wrap_object)(void *obj, void *wrap_ctx); /* Callback to wrap a library object */ + void* (*wrap_object)(void *obj, H5I_type_t obj_type, void *wrap_ctx); /* Callback to wrap a library object */ herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */ /* Data Model */ @@ -433,6 +434,8 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); /* Helper routines for VOL connector authors */ H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2); +H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type); +H5_DLL void *H5VLobject(hid_t obj_id); /* Public wrappers for generic callbacks */ @@ -448,7 +451,8 @@ H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, ch H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info); H5_DLL void *H5VLget_object(void *obj, hid_t connector_id); H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx); -H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx); +H5_DLL void *H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, + void *wrap_ctx); H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); /* Public wrappers for attribute callbacks */ @@ -1548,7 +1548,7 @@ done: * * Purpose: Given source and destination buffers in memory (SRC & DST) * copy sequences of from the source buffer into the destination - * buffer. Each set of sequnces has an array of lengths, an + * buffer. Each set of sequences has an array of lengths, an * array of offsets, the maximum number of sequences and the * current sequence to start at in the sequence. * diff --git a/src/H5private.h b/src/H5private.h index f58faec..8b6253d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1156,6 +1156,9 @@ typedef off_t h5_stat_size_t; #ifndef HDpowf #define HDpowf(X,Y) powf(X,Y) #endif /* HDpowf */ +#ifndef HDpread + #define HDpread(F,B,C,O) pread(F,B,C,O) +#endif /* HDpread */ #ifndef HDprintf #define HDprintf(...) HDfprintf(stdout, __VA_ARGS__) #endif /* HDprintf */ @@ -1168,6 +1171,9 @@ typedef off_t h5_stat_size_t; #ifndef HDputs #define HDputs(S) puts(S) #endif /* HDputs */ +#ifndef HDpwrite + #define HDpwrite(F,B,C,O) pwrite(F,B,C,O) +#endif /* HDpwrite */ #ifndef HDqsort #define HDqsort(M,N,Z,F) qsort(M,N,Z,F) #endif /* HDqsort*/ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 69afb85..0d67485 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -374,6 +374,7 @@ set (H5_CHECK_TESTS atomic_reader links_env filenotclosed + del_many_dense_attrs flushrefresh ) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 9816543..ba72e3a 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -171,6 +171,7 @@ set (HDF5_REFERENCE_TEST_FILES le_data.h5 le_extlink1.h5 le_extlink2.h5 + memleak_H5O_dtype_decode_helper_H5Odtype.h5 mergemsg.h5 multi_file_v16-r.h5 multi_file_v16-s.h5 @@ -520,6 +521,7 @@ set (test_CLEANFILES flushrefresh_VERIFICATION_CHECKPOINT2 flushrefresh_VERIFICATION_DONE filenotclosed.h5 + del_many_dense_attrs.h5 atomic_data accum_swmr_big.h5 ohdr_swmr.h5 @@ -585,10 +587,10 @@ foreach (test ${H5_TESTS}) endif () endforeach () -set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) -set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) -set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT 1800) -set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT 1800) +set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) +set_tests_properties (H5TEST-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) +set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) +set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) if (BUILD_SHARED_LIBS) # Remove any output file left over from previous test run @@ -627,10 +629,10 @@ if (BUILD_SHARED_LIBS) endif () endforeach () - set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800) - set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800) - set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800) - set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT 1800) + set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () #-- Adding test for cache @@ -662,7 +664,7 @@ if (NOT CYGWIN) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 1800) + set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () #-- Adding test for cache_image @@ -712,7 +714,7 @@ if (BUILD_SHARED_LIBS) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT 1800) + set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () endif () @@ -796,6 +798,7 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES # atomic_reader # links_env # filenotclosed +# del_many_dense_attrs # flushrefresh ############################################################################## # autotools script tests @@ -803,7 +806,7 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES # NOT CONVERTED accum_swmr_reader is used by accum.c. # NOT CONVERTED atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh -# filenotclosed is used by test_filenotclosed.sh +# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh # NOT CONVERTED flushrefresh is used by testflushrefresh.sh. # NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh # NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh. @@ -830,6 +833,23 @@ set_tests_properties (H5TEST-filenotclosed PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +#-- Adding test for del_many_dense_attrs +add_test ( + NAME H5TEST-clear-del_many_dense_attrs-objects + COMMAND ${CMAKE_COMMAND} + -E remove + del_many_dense_attrs.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-clear-del_many_dense_attrs-objects PROPERTIES FIXTURES_SETUP del_many_dense_attrs_clear_objects) +add_test (NAME H5TEST-del_many_dense_attrs COMMAND $<TARGET_FILE:del_many_dense_attrs>) +set_tests_properties (H5TEST-del_many_dense_attrs PROPERTIES + FIXTURES_REQUIRED del_many_dense_attrs_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + #-- Adding test for err_compat if (HDF5_ENABLE_DEPRECATED_SYMBOLS) add_test (NAME H5TEST-clear-err_compat-objects diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index be02110..9f03c40 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -263,17 +263,17 @@ endif () set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1) set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10) set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800) + set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) if (NOT CYGWIN) - set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800) + set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () if (BUILD_SHARED_LIBS) set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared) set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10) set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800) + set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) if (NOT CYGWIN AND NOT WIN32) - set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800) + set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () endif () if (HDF5_TEST_FHEAP_VFD) @@ -288,7 +288,7 @@ endif () -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-fheap PROPERTIES - TIMEOUT 1800 + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) @@ -304,7 +304,7 @@ endif () -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-fheap-shared PROPERTIES - TIMEOUT 1800 + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) diff --git a/test/CMakeVOLTests.cmake b/test/CMakeVOLTests.cmake index 39fa2a6..fdd7ba0 100644 --- a/test/CMakeVOLTests.cmake +++ b/test/CMakeVOLTests.cmake @@ -262,17 +262,17 @@ endif () set_tests_properties (VOL-${volname}-flush2 PROPERTIES DEPENDS VOL-${volname}-flush1) set_tests_properties (VOL-${volname}-flush1 PROPERTIES TIMEOUT 10) set_tests_properties (VOL-${volname}-flush2 PROPERTIES TIMEOUT 10) - set_tests_properties (VOL-${volname}-istore PROPERTIES TIMEOUT 1800) + set_tests_properties (VOL-${volname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) if (NOT CYGWIN) - set_tests_properties (VOL-${volname}-cache PROPERTIES TIMEOUT 1800) + set_tests_properties (VOL-${volname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () if (BUILD_SHARED_LIBS) set_tests_properties (VOL-${volname}-flush2-shared PROPERTIES DEPENDS VOL-${volname}-flush1-shared) set_tests_properties (VOL-${volname}-flush1-shared PROPERTIES TIMEOUT 10) set_tests_properties (VOL-${volname}-flush2-shared PROPERTIES TIMEOUT 10) - set_tests_properties (VOL-${volname}-istore-shared PROPERTIES TIMEOUT 1800) + set_tests_properties (VOL-${volname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) if (NOT CYGWIN AND NOT WIN32) - set_tests_properties (VOL-${volname}-cache-shared PROPERTIES TIMEOUT 1800) + set_tests_properties (VOL-${volname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () endif () if (HDF5_TEST_FHEAP_VOL) @@ -287,7 +287,7 @@ endif () -P "${HDF_RESOURCES_DIR}/volTest.cmake" ) set_tests_properties (VOL-${volname}-fheap PROPERTIES - TIMEOUT 1800 + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} ) @@ -303,7 +303,7 @@ endif () -P "${HDF_RESOURCES_DIR}/volTest.cmake" ) set_tests_properties (VOL-${volname}-fheap-shared PROPERTIES - TIMEOUT 1800 + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared ) diff --git a/test/Makefile.am b/test/Makefile.am index 1a232ab..88dc542 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -29,12 +29,13 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src # testflushrefresh.sh: flushrefresh # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* -# test_filenotclosed.sh: filenotclosed.c +# testabort_fail.sh: filenotclosed.c and del_many_dense_attrs.c # test_filter_plugin.sh: filter_plugin.c # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes -TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filenotclosed.sh\ - testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh -SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) filenotclosed$(EXEEXT) \ +TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \ + testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh +SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \ + filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \ flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \ swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) swmr_writer$(EXEEXT) \ swmr_remove_reader$(EXEEXT) swmr_remove_writer$(EXEEXT) swmr_addrem_writer$(EXEEXT) \ @@ -68,7 +69,7 @@ TEST_PROG= testhdf5 \ # accum_swmr_reader is used by accum.c. # atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh -# filenotclosed is used by test_filenotclosed.sh +# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh # flushrefresh is used by testflushrefresh.sh. # use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh # swmr_* files (besides swmr.c) are used by testswmr.sh. @@ -78,7 +79,8 @@ TEST_PROG= testhdf5 \ # and this lets automake keep all its test programs in one place. check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ testmeta accum_swmr_reader atomic_writer atomic_reader \ - links_env filenotclosed flushrefresh use_append_chunk use_append_mchunks use_disable_mdc_flushes \ + links_env filenotclosed del_many_dense_attrs flushrefresh \ + use_append_chunk use_append_mchunks use_disable_mdc_flushes \ swmr_generator swmr_start_write swmr_reader swmr_writer swmr_remove_reader \ swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \ swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer @@ -221,7 +223,7 @@ use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c # Temporary files. DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \ - testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh test_filenotclosed.sh \ + testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh \ test_vol_plugin.sh include $(top_srcdir)/config/conclude.am diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 58dc85d..98f3daf 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -171,6 +171,7 @@ if (UNIX) # atomic_writer # atomic_reader # filenotclosed + # del_many_dense_attrs # flushrefresh ############################################################################## # autotools script tests @@ -178,7 +179,7 @@ if (UNIX) # NOT CONVERTED accum_swmr_reader is used by accum.c. # NOT CONVERTED atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh - # filenotclosed is used by test_filenotclosed.sh + # filenotclosed and del_many_dense_attrs are used by testabort_fail.sh # NOT CONVERTED flushrefresh is used by testflushrefresh.sh. # NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh # NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh. diff --git a/test/accum.c b/test/accum.c index 87628d8..7af353c 100644 --- a/test/accum.c +++ b/test/accum.c @@ -26,10 +26,13 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename */ -#define FILENAME "accum.h5" +/* (The file names are the same as the define in accum_swmr_reader.c) */ +const char *FILENAME[] = { + "accum", + "accum_swmr_big", + NULL +}; -/* The file name is the same as the define in accum_swmr_reader.c */ -#define SWMR_FILENAME "accum_swmr_big.h5" /* The reader forked by test_swmr_write_big() */ #define SWMR_READER "accum_swmr_reader" @@ -92,6 +95,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t fid = -1; hid_t fapl = -1; /* File access property list */ + char filename[1024]; H5F_t * f = NULL; /* File for all tests */ @@ -99,15 +103,13 @@ main(void) puts("Testing the metadata accumulator"); /* File access property list */ + h5_reset(); if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Create a test file */ - if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - - /* Closing and remove the file */ - if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR @@ -143,7 +145,6 @@ main(void) /* End of test code, close and delete file */ if(H5Fclose(fid) < 0) TEST_ERROR - HDremove(FILENAME); /* This test uses a different file */ nerrors += test_swmr_write_big(TRUE); @@ -152,6 +153,7 @@ main(void) if(nerrors) goto error; puts("All metadata accumulator tests passed."); + h5_cleanup(FILENAME, fapl); return 0; @@ -1828,6 +1830,7 @@ test_swmr_write_big(hbool_t newest_format) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ H5F_t *rf = NULL; /* File pointer */ + char filename[1024]; uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ uint8_t wbuf[1024]; /* Buffer for reading & writing */ unsigned u; /* Local index variable */ @@ -1865,17 +1868,18 @@ test_swmr_write_big(hbool_t newest_format) /* File access property list */ if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); /* Both cases will result in v3 superblock and version 2 object header for SWMR */ if(newest_format) { /* latest format */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR - if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } else { /* non-latest-format */ - if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } /* end if */ @@ -1884,7 +1888,7 @@ test_swmr_write_big(hbool_t newest_format) FAIL_STACK_ERROR /* Open the file with SWMR_WRITE */ - if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) + if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR /* Push API context */ @@ -1979,20 +1983,19 @@ test_swmr_write_big(hbool_t newest_format) /* Flush the accumulator */ if(accum_reset(rf) < 0) FAIL_STACK_ERROR; - /* Close the property list */ - if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; /* Close and remove the file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR; + /* Close the property list */ + if(H5Pclose(fapl) < 0) + FAIL_STACK_ERROR; + /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - HDremove(SWMR_FILENAME); - /* Release memory */ if(wbuf2) HDfree(wbuf2); @@ -2004,12 +2007,11 @@ test_swmr_write_big(hbool_t newest_format) error: /* Closing and remove the file */ - H5Pclose(fapl); H5Fclose(fid); if(api_ctx_pushed) H5CX_pop(); - HDremove(SWMR_FILENAME); + H5Pclose(fapl); /* Release memory */ if(wbuf2) diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 16e0ddc..ac48a13 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -23,7 +23,12 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */ -#define SWMR_FILENAME "accum_swmr_big.h5" +const char *FILENAME[] = { + "accum", + "accum_swmr_big", + NULL +}; + /*------------------------------------------------------------------------- @@ -47,6 +52,7 @@ main(void) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* file access property list ID */ H5F_t *f = NULL; /* File pointer */ + char filename[1024]; unsigned u; /* Local index variable */ uint8_t rbuf[1024]; /* Buffer for reading */ uint8_t buf[1024]; /* Buffer for holding the expected data */ @@ -68,10 +74,11 @@ main(void) if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); /* Open the file with SWMR_READ */ - if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) - FAIL_STACK_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) + FAIL_STACK_ERROR /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR @@ -79,21 +86,21 @@ main(void) /* Get H5F_t * to internal file structure */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Should read in [1024, 2024] with buf data */ if(H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data read is correct */ if(HDmemcmp(buf, rbuf, (size_t)1024) != 0) - TEST_ERROR; + TEST_ERROR; /* CLose the file */ if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR diff --git a/test/cache_image.c b/test/cache_image.c index 10e9a8a..ee49502 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -40,27 +40,27 @@ static void attempt_swmr_open_hdf5_file(hbool_t create_file, static void verify_datasets(hid_t file_id, int min_dset, int max_dset); /* local test function declarations */ -static unsigned check_cache_image_ctl_flow_1(void); -static unsigned check_cache_image_ctl_flow_2(void); -static unsigned check_cache_image_ctl_flow_3(void); -static unsigned check_cache_image_ctl_flow_4(void); -static unsigned check_cache_image_ctl_flow_5(void); -static unsigned check_cache_image_ctl_flow_6(void); - -static unsigned cache_image_smoke_check_1(void); -static unsigned cache_image_smoke_check_2(void); -static unsigned cache_image_smoke_check_3(void); -static unsigned cache_image_smoke_check_4(void); -static unsigned cache_image_smoke_check_5(void); -static unsigned cache_image_smoke_check_6(void); - -static unsigned cache_image_api_error_check_1(void); -static unsigned cache_image_api_error_check_2(void); -static unsigned cache_image_api_error_check_3(void); -static unsigned cache_image_api_error_check_4(void); - -static unsigned get_free_sections_test(void); -static unsigned evict_on_close_test(void); +static unsigned check_cache_image_ctl_flow_1(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_2(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_3(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_4(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_5(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_6(hbool_t single_file_vfd); + +static unsigned cache_image_smoke_check_1(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_2(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_3(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_4(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_5(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_6(hbool_t single_file_vfd); + +static unsigned cache_image_api_error_check_1(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_2(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_3(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_4(hbool_t single_file_vfd); + +static unsigned get_free_sections_test(hbool_t single_file_vfd); +static unsigned evict_on_close_test(hbool_t single_file_vfd); /****************************************************************************/ @@ -713,6 +713,9 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR, fapl_id); } + /* tidy up */ + H5Pclose(fapl_id); + if ( file_id < 0 ) { pass = FALSE; @@ -1329,7 +1332,7 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) */ static unsigned -check_cache_image_ctl_flow_1(void) +check_cache_image_ctl_flow_1(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_1()"; char filename[512]; @@ -1341,6 +1344,13 @@ check_cache_image_ctl_flow_1(void) TESTING("metadata cache image control flow test 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -1608,7 +1618,7 @@ check_cache_image_ctl_flow_1(void) */ static unsigned -check_cache_image_ctl_flow_2(void) +check_cache_image_ctl_flow_2(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_2()"; char filename[512]; @@ -1620,6 +1630,13 @@ check_cache_image_ctl_flow_2(void) TESTING("metadata cache image control flow test 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -1871,7 +1888,7 @@ check_cache_image_ctl_flow_2(void) */ static unsigned -check_cache_image_ctl_flow_3(void) +check_cache_image_ctl_flow_3(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_3()"; char filename[512]; @@ -1883,6 +1900,13 @@ check_cache_image_ctl_flow_3(void) TESTING("metadata cache image control flow test 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2242,7 +2266,7 @@ check_cache_image_ctl_flow_3(void) */ static unsigned -check_cache_image_ctl_flow_4(void) +check_cache_image_ctl_flow_4(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_4()"; char filename[512]; @@ -2254,6 +2278,13 @@ check_cache_image_ctl_flow_4(void) TESTING("metadata cache image control flow test 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2573,7 +2604,7 @@ check_cache_image_ctl_flow_4(void) */ static unsigned -check_cache_image_ctl_flow_5(void) +check_cache_image_ctl_flow_5(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_5()"; char filename[512]; @@ -2585,6 +2616,13 @@ check_cache_image_ctl_flow_5(void) TESTING("metadata cache image control flow test 5"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2854,7 +2892,7 @@ check_cache_image_ctl_flow_5(void) */ static unsigned -check_cache_image_ctl_flow_6(void) +check_cache_image_ctl_flow_6(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_6()"; char filename[512]; @@ -2866,6 +2904,13 @@ check_cache_image_ctl_flow_6(void) TESTING("metadata cache image control flow test 6"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -3139,7 +3184,7 @@ check_cache_image_ctl_flow_6(void) */ static unsigned -cache_image_smoke_check_1(void) +cache_image_smoke_check_1(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_1()"; char filename[512]; @@ -3151,6 +3196,13 @@ cache_image_smoke_check_1(void) TESTING("metadata cache image smoke check 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -3562,7 +3614,7 @@ cache_image_smoke_check_1(void) */ static unsigned -cache_image_smoke_check_2(void) +cache_image_smoke_check_2(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_2()"; char filename[512]; @@ -3574,6 +3626,13 @@ cache_image_smoke_check_2(void) TESTING("metadata cache image smoke check 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -3863,7 +3922,7 @@ cache_image_smoke_check_2(void) */ static unsigned -cache_image_smoke_check_3(void) +cache_image_smoke_check_3(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_3()"; char filename[512]; @@ -3875,6 +3934,13 @@ cache_image_smoke_check_3(void) TESTING("metadata cache image smoke check 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -4248,7 +4314,7 @@ cache_image_smoke_check_3(void) */ static unsigned -cache_image_smoke_check_4(void) +cache_image_smoke_check_4(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_4()"; char filename[512]; @@ -4262,6 +4328,13 @@ cache_image_smoke_check_4(void) TESTING("metadata cache image smoke check 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -4650,10 +4723,10 @@ cache_image_smoke_check_4(void) *------------------------------------------------------------------------- */ -#define MAX_NUM_GROUPS 128 +#define MAX_NUM_GROUPS 64 static unsigned -cache_image_smoke_check_5(void) +cache_image_smoke_check_5(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_5()"; char filename[512]; @@ -4670,6 +4743,13 @@ cache_image_smoke_check_5(void) TESTING("metadata cache image smoke check 5"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -4679,12 +4759,16 @@ cache_image_smoke_check_5(void) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + hid_t fapl_id = h5_fileaccess(); + + if ( h5_fixname(FILENAMES[0], fapl_id, filename, sizeof(filename)) == NULL ) { pass = FALSE; failure_mssg = "h5_fixname() failed.\n"; } + + H5Pclose(fapl_id); } if ( show_progress ) @@ -5168,7 +5252,7 @@ cache_image_smoke_check_5(void) */ static unsigned -cache_image_smoke_check_6(void) +cache_image_smoke_check_6(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_6()"; char filename[512]; @@ -5183,6 +5267,13 @@ cache_image_smoke_check_6(void) TESTING("metadata cache image smoke check 6"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -5578,7 +5669,7 @@ cache_image_smoke_check_6(void) */ static unsigned -cache_image_api_error_check_1(void) +cache_image_api_error_check_1(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_1()"; char filename[512]; @@ -5590,6 +5681,13 @@ cache_image_api_error_check_1(void) TESTING("metadata cache image api error check 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -5954,7 +6052,7 @@ cache_image_api_error_check_1(void) */ static unsigned -cache_image_api_error_check_2(void) +cache_image_api_error_check_2(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_2()"; char filename[512]; @@ -5966,6 +6064,13 @@ cache_image_api_error_check_2(void) TESTING("metadata cache image api error check 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -6365,7 +6470,7 @@ cache_image_api_error_check_2(void) */ static unsigned -cache_image_api_error_check_3(void) +cache_image_api_error_check_3(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_3()"; char filename[512]; @@ -6377,6 +6482,13 @@ cache_image_api_error_check_3(void) TESTING("metadata cache image api error check 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -6649,7 +6761,7 @@ cache_image_api_error_check_3(void) */ static unsigned -cache_image_api_error_check_4(void) +cache_image_api_error_check_4(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_4()"; char filename[512]; @@ -6663,6 +6775,13 @@ cache_image_api_error_check_4(void) TESTING("metadata cache image api error check 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -7238,7 +7357,7 @@ cache_image_api_error_check_4(void) *------------------------------------------------------------------------- */ static unsigned -get_free_sections_test(void) +get_free_sections_test(hbool_t single_file_vfd) { const char * fcn_name = "get_free_sections_test()"; char filename[512]; @@ -7251,6 +7370,13 @@ get_free_sections_test(void) TESTING("Cache image / H5Fget_free_sections() interaction"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -7710,7 +7836,7 @@ get_free_sections_test(void) *------------------------------------------------------------------------- */ static unsigned -evict_on_close_test(void) +evict_on_close_test(hbool_t single_file_vfd) { #ifndef H5_HAVE_PARALLEL const char * fcn_name = "evict_on_close_test()"; @@ -7731,6 +7857,13 @@ evict_on_close_test(void) return 0; #else + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -8041,9 +8174,16 @@ evict_on_close_test(void) int main(void) { + const char *env_h5_drvr; /* File driver value from environment */ + hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */ unsigned nerrs = 0; int express_test; + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + H5open(); express_test = GetTestExpress(); @@ -8053,27 +8193,30 @@ main(void) printf(" express_test = %d\n", express_test); printf("=========================================\n"); - nerrs += check_cache_image_ctl_flow_1(); - nerrs += check_cache_image_ctl_flow_2(); - nerrs += check_cache_image_ctl_flow_3(); - nerrs += check_cache_image_ctl_flow_4(); - nerrs += check_cache_image_ctl_flow_5(); - nerrs += check_cache_image_ctl_flow_6(); - - nerrs += cache_image_smoke_check_1(); - nerrs += cache_image_smoke_check_2(); - nerrs += cache_image_smoke_check_3(); - nerrs += cache_image_smoke_check_4(); - nerrs += cache_image_smoke_check_5(); - nerrs += cache_image_smoke_check_6(); - - nerrs += cache_image_api_error_check_1(); - nerrs += cache_image_api_error_check_2(); - nerrs += cache_image_api_error_check_3(); - nerrs += cache_image_api_error_check_4(); - - nerrs += get_free_sections_test(); - nerrs += evict_on_close_test(); + /* Check for VFD which stores data in multiple files */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + + nerrs += check_cache_image_ctl_flow_1(single_file_vfd); + nerrs += check_cache_image_ctl_flow_2(single_file_vfd); + nerrs += check_cache_image_ctl_flow_3(single_file_vfd); + nerrs += check_cache_image_ctl_flow_4(single_file_vfd); + nerrs += check_cache_image_ctl_flow_5(single_file_vfd); + nerrs += check_cache_image_ctl_flow_6(single_file_vfd); + + nerrs += cache_image_smoke_check_1(single_file_vfd); + nerrs += cache_image_smoke_check_2(single_file_vfd); + nerrs += cache_image_smoke_check_3(single_file_vfd); + nerrs += cache_image_smoke_check_4(single_file_vfd); + nerrs += cache_image_smoke_check_5(single_file_vfd); + nerrs += cache_image_smoke_check_6(single_file_vfd); + + nerrs += cache_image_api_error_check_1(single_file_vfd); + nerrs += cache_image_api_error_check_2(single_file_vfd); + nerrs += cache_image_api_error_check_3(single_file_vfd); + nerrs += cache_image_api_error_check_4(single_file_vfd); + + nerrs += get_free_sections_test(single_file_vfd); + nerrs += evict_on_close_test(single_file_vfd); return(nerrs > 0); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 752dd27..b91f013 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -448,7 +448,7 @@ check_file_creation_tags(hid_t fcpl_id, int type) TESTING("tag application during file creation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0 ) TEST_ERROR; @@ -539,7 +539,7 @@ check_file_open_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -652,7 +652,7 @@ check_group_creation_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -751,7 +751,7 @@ check_multi_group_creation_tags(void) TESTING("tag application during multiple group creation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Set latest version of library */ if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; @@ -881,7 +881,7 @@ check_link_iteration_tags(void) TESTING("tag application during iteration over links in a group"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* =========== */ /* Create File */ @@ -1000,7 +1000,7 @@ check_dense_attribute_tags(void) TESTING("tag application during dense attribute manipulation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; /* Create Dcpl */ @@ -1184,7 +1184,7 @@ check_group_open_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -1295,7 +1295,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1429,7 +1429,7 @@ check_attribute_open_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1576,7 +1576,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1761,7 +1761,7 @@ check_attribute_delete_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1917,7 +1917,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2051,7 +2051,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2187,7 +2187,7 @@ check_dataset_open_tags(void) /* ========= */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2318,7 +2318,7 @@ check_dataset_write_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2457,7 +2457,7 @@ check_attribute_write_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2613,7 +2613,7 @@ check_dataset_read_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2751,7 +2751,7 @@ check_dataset_size_retrieval(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2890,7 +2890,7 @@ check_dataset_extend_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3017,7 +3017,7 @@ check_object_info_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3126,7 +3126,7 @@ check_object_copy_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3257,7 +3257,7 @@ check_link_removal_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -3416,7 +3416,7 @@ check_link_getname_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3553,7 +3553,7 @@ check_external_link_creation_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3660,7 +3660,7 @@ check_external_link_open_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3671,8 +3671,6 @@ check_external_link_open_tags(void) /* Create a second file */ if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; - if ( H5Pclose(fapl) < 0 ) TEST_ERROR; - /* determine tag value of root group's object header */ if ( get_object_header_tag(fid2, &root2_tag) < 0 ) TEST_ERROR; @@ -3688,7 +3686,9 @@ check_external_link_open_tags(void) /* Close and Reopen the file */ if ( H5Fclose(fid) < 0 ) TEST_ERROR; - if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Evict as much as we can from the cache so we can track full tag path */ if ( evict_entries(fid) < 0 ) TEST_ERROR; @@ -3787,7 +3787,7 @@ check_invalid_tag_application(void) #if H5C_DO_TAGGING_SANITY_CHECKS /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index b011bc2..a8baeac 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2070,7 +2070,7 @@ test_ooo_order(char *filename, hid_t fapl_id) /* Close and reopen the file */ if(H5Tclose(dtype)) TEST_ERROR if(H5Fclose(file)) TEST_ERROR - if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR /* Open the type */ if((dtype_tmp = H5Topen2(file, "dtype", H5P_DEFAULT)) < 0) TEST_ERROR @@ -2123,7 +2123,7 @@ test_ooo_order(char *filename, hid_t fapl_id) if(H5Tclose(dtype_tmp)) TEST_ERROR if(H5Tclose(dtype)) TEST_ERROR if(H5Fclose(file)) TEST_ERROR - if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id)) < 0) TEST_ERROR /* Open the type, and verify status */ if((dtype_tmp = H5Topen2(file, "dtype2", H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/cork.c b/test/cork.c index dceaf5a..240be77 100644 --- a/test/cork.c +++ b/test/cork.c @@ -286,19 +286,19 @@ static unsigned verify_obj_dset_cork(hbool_t swmr) { /* Variable Declarations */ - hid_t fid = -1; /* File ID */ + hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ hid_t aid = -1; /* Attribute ID */ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */ hid_t did = -1, did2 = -1; /* Dataset IDs */ hid_t oid = -1; /* Object ID */ - hid_t dcpl2; /* Dataset creation property list */ + hid_t dcpl2; /* Dataset creation property list */ int i = 0; /* Local index variable */ - hsize_t dim[1] = {100}; /* Dataset dimension size */ + hsize_t dim[1] = {100}; /* Dataset dimension size */ hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */ H5O_info_t oinfo, oinfo2; /* Object metadata information */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ if(swmr) { TESTING("cork status for dataset objects with attributes (SWMR)"); @@ -341,7 +341,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Attach and write to an attribute to the dataset: DSET */ - if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ @@ -380,11 +380,11 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Attach 8 attributes to the dataset */ - for(i = 0;i < 8; i++) { - sprintf(attrname, "attr %d", i); - if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_UINT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) + for(i = 0; i < 8; i++) { + HDsprintf(attrname, "attr %d", i); + if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) + if(H5Awrite(aid, H5T_NATIVE_INT, &i) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c new file mode 100644 index 0000000..d88045c --- /dev/null +++ b/test/del_many_dense_attrs.c @@ -0,0 +1,203 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Test to verify that the infinite loop closing library/abort failure + * is fixed when the application creates and removes dense attributes + * (See HDFFV-10659). + */ + + +#include "h5test.h" + +/* The test file name */ +const char *FILENAME[] = { + "del_many_dense_attrs", + NULL +}; + +#define ATTR_COUNT 64 /* The number of attributes */ + +/*------------------------------------------------------------------------- + * Function: catch_signal + * + * Purpose: The signal handler to catch the SIGABRT signal. + * + * Return: No return + * + * Programmer: Vailin Choi + * + *------------------------------------------------------------------------- + */ +static void catch_signal(int H5_ATTR_UNUSED signo) +{ + HDexit(1); +} /* catch_signal() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Test to verify that the infinite loop closing library/abort failure + * is fixed when the application creates and removes dense attributes + * (See HDFFV-10659). + * + * Return: Success: exit(EXIT_SUCCESS) + * Failure: exit(EXIT_FAILURE) + * + * Programmer: Vailin Choi; Dec 2018 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fid = -1; /* HDF5 File ID */ + hid_t gid = -1; /* Group ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t tid = -1; /* Datatype ID */ + hid_t fapl = -1; /* File access property lists */ + hid_t gcpl = -1; /* Group creation property list */ + char aname[50]; /* Name of attribute */ + char *basename="attr"; /* Name prefix for attribute */ + char filename[100]; /* File name */ + int i; /* Local index variable */ + + /* Testing setup */ + h5_reset(); + + /* To exit from the file for SIGABRT signal */ + if(HDsignal(SIGABRT, catch_signal) == SIG_ERR) + TEST_ERROR + + fapl = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + /* Set to latest format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR + + /* Create the file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR + + /* Re-open the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create the group creation property list */ + if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) + TEST_ERROR + + /* Set to use dense storage for all attributes on the group */ + if(H5Pset_attr_phase_change(gcpl, 0, 0) < 0) + TEST_ERROR + + /* Create the group in the file */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((sid = H5Screate(H5S_SCALAR)) < 0) + TEST_ERROR + + /* Get a copy of the datatype */ + if((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0) + TEST_ERROR + + /* Create attributes in the group */ + for(i = ATTR_COUNT; i >= 0; i--) { + /* Set up the attribute name */ + HDsprintf(aname, "%s%d", basename, i); + + /* Create the attribute */ + if((aid = H5Acreate2(gid, aname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Write to the attribute */ + if(H5Awrite(aid, tid, &i) < 0) + TEST_ERROR + + /* Close the attribute */ + if(H5Aclose(aid) < 0) + TEST_ERROR + } + + /* Close the datatype */ + if(H5Tclose(tid) < 0) + TEST_ERROR + + /* Close the dataspace */ + if(H5Sclose(sid) < 0) + TEST_ERROR + + /* Close the group */ + if(H5Gclose(gid) < 0) + TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl) < 0) + TEST_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR + + /* Re-open the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Open the group */ + if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Delete the attributes */ + for (i = 0; i <= ATTR_COUNT; i++) { + /* Set up the attribute name */ + HDsprintf(aname, "%s%d", basename, i); + + /* Delete the attribute */ + if(H5Adelete(gid, aname) < 0) + TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(gid) < 0) + TEST_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR + + h5_cleanup(FILENAME, fapl); + + return(EXIT_SUCCESS); + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Sclose(sid); + H5Tclose(tid); + H5Aclose(aid); + H5Fclose(fid); + H5Pclose(gcpl); + H5Pclose(fapl); + } H5E_END_TRY + + return EXIT_FAILURE; +} diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 2ef38ea..2edfe64 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -1910,10 +1910,10 @@ test_read_unallocated_chunk (hid_t file) goto error; /* Write a single chunk to intialize the chunk storage */ - HDmemset(&chunk_dims, 0, sizeof(chunk_dims)); + HDmemset(direct_buf, 0, CHUNK_NX * CHUNK_NY * sizeof(int)); offset[0] = 0; offset[1] = 0; - if(H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, &chunk_dims) < 0) + if(H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0) goto error; /* Attempt to read each chunk in the dataset. Chunks are not allocated, diff --git a/test/dsets.c b/test/dsets.c index e63878c..5de9cfa 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -13072,15 +13072,13 @@ test_object_header_minimization_dcpl(void) /*********/ if(NULL == h5_fixname(OHMIN_FILENAME_A, H5P_DEFAULT, filename, sizeof(filename))) - FAIL_PUTS_ERROR("unable to prepare filename") + TEST_ERROR file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (0 > file_id) - FAIL_PUTS_ERROR("unable to create test file\n"); + if (0 > file_id) TEST_ERROR dcpl_id = H5Pcreate(H5P_DATASET_CREATE); - if (0 > dcpl_id) - FAIL_PUTS_ERROR("unable to create DCPL\n"); + if (0 > dcpl_id) TEST_ERROR /*********/ /* TESTS */ @@ -13088,28 +13086,23 @@ test_object_header_minimization_dcpl(void) /* default value (not set explicitly) */ - if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) - FAIL_PUTS_ERROR("unable to get minimize value\n"); + if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR if (FALSE != minimize) - FAIL_PUTS_ERROR("Expected FALSE default but was not!\n"); + TEST_ERROR /* FALSE-set value */ - if (H5Pset_dset_no_attrs_hint(dcpl_id, FALSE) == FAIL) - FAIL_PUTS_ERROR("unable to set minimize value to FALSE\n"); - if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) - FAIL_PUTS_ERROR("unable to get minimize value\n"); + if (H5Pset_dset_no_attrs_hint(dcpl_id, FALSE) == FAIL) TEST_ERROR + if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR if (FALSE != minimize) - FAIL_PUTS_ERROR("Expected FALSE default but was not!\n"); + TEST_ERROR /* TRUE-set value */ - if (H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) == FAIL) - FAIL_PUTS_ERROR("unable to set minimize value to TRUE\n"); - if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) - FAIL_PUTS_ERROR("unable to get minimize value\n"); + if (H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) == FAIL) TEST_ERROR + if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR if (TRUE != minimize) - FAIL_PUTS_ERROR("Expected TRUE default but was not!\n"); + TEST_ERROR /* error cases */ @@ -13117,35 +13110,35 @@ test_object_header_minimization_dcpl(void) ret = H5Pget_dset_no_attrs_hint(-1, &minimize); } H5E_END_TRY; if (ret == SUCCEED) - FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n"); + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pset_dset_no_attrs_hint(-1, FALSE); } H5E_END_TRY; if (ret == SUCCEED) - FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n"); + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pset_dset_no_attrs_hint(-1, TRUE); } H5E_END_TRY; if (ret == SUCCEED) - FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n"); + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pget_dset_no_attrs_hint(dcpl_id, NULL); } H5E_END_TRY; if (ret == SUCCEED) - FAIL_PUTS_ERROR("NULL out pointer should fail\n"); + TEST_ERROR /* NULL out pointer should fail */ /************/ /* TEARDOWN */ /************/ if (H5Fclose(file_id) == FAIL) - FAIL_PUTS_ERROR("can't close FILE"); + TEST_ERROR if (H5Pclose(dcpl_id) == FAIL) - FAIL_PUTS_ERROR("unable to close DCPL\n"); + TEST_ERROR PASSED(); return SUCCEED; diff --git a/test/dt_arith.c b/test/dt_arith.c index c7f2986..2729ba1 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -4883,7 +4883,24 @@ run_fp_tests(const char *name) #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE); +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT); +#else + { + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", + name, "long double", "float"); + printf("%-70s", str); + SKIPPED(); +#if H5_SIZEOF_LONG_DOUBLE!=0 + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); +#else + HDputs(" Test skipped due to disabled long double."); +#endif + } +#endif + nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #endif @@ -4893,8 +4910,24 @@ run_fp_tests(const char *name) #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE); +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); +#else + { + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", + name, "long double", "float or double"); + printf("%-70s", str); + SKIPPED(); +#if H5_SIZEOF_LONG_DOUBLE!=0 + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); +#else + HDputs(" Test skipped due to disabled long double."); +#endif + } +#endif #endif done: @@ -4963,7 +4996,7 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE); #if H5_SIZEOF_LONG!=H5_SIZEOF_INT -#ifndef H5_LONG_TO_LDOUBLE_SPECIAL +#if !defined(H5_LONG_TO_LDOUBLE_SPECIAL) && !defined(H5_DISABLE_SOME_LDOUBLE_CONV) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); #else @@ -5077,16 +5110,46 @@ run_fp_int_conv(const char *name) #endif #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); + if(test_values != TEST_SPECIAL) { + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); + } else { +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); +#else + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", + name, "long double", "signed and unsigned char, short, int, long"); + printf("%-70s", str); + SKIPPED(); +#if H5_SIZEOF_LONG_DOUBLE!=0 + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); +#else + HDputs(" Test skipped due to disabled long double."); +#endif +#endif + } #if H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0 #ifndef H5_LDOUBLE_TO_LONG_SPECIAL - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); + if(test_values != TEST_SPECIAL && test_values != TEST_NORMAL) { + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); + } else { +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); +#endif + } #else { char str[256]; /*string */ @@ -20,6 +20,7 @@ #include "H5Fpkg.h" #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5Pprivate.h" /* Property lists */ const char *FILENAME[] = { "efc0", @@ -2896,6 +2897,8 @@ int main(void) { unsigned nerrors = 0; /* track errors */ + H5P_genplist_t *plist; /* Property list pointer for FAPL */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ @@ -2917,6 +2920,15 @@ main(void) if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; + /* Get the VOL info from the fapl */ + plist = (H5P_genplist_t *)H5I_object(fapl_id); + H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop); + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + H5CX_set_vol_connector_prop(&connector_prop); + /* Test Functions */ nerrors += test_single(); nerrors += test_graph_nocycle(); diff --git a/test/gen_bogus.c b/test/gen_bogus.c index ec29eb9..237b024 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -89,6 +89,14 @@ generate_datasets(hid_t loc_id, unsigned bogus_id) if((did = H5Dcreate2(loc_id, "Dataset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if(H5Dclose(did) < 0) goto error; + /* Set "shareable" message flag for bogus message */ + bogus_flags = H5O_MSG_FLAG_SHAREABLE; + if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error; + + /* Create fourth dataset, with "shareable" message flag */ + if((did = H5Dcreate2(loc_id, "Dataset5", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + if(H5Dclose(did) < 0) goto error; + /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) goto error; diff --git a/test/h5test.c b/test/h5test.c index 32638e6..dfa6a31 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -803,6 +803,50 @@ error: /*------------------------------------------------------------------------- + * Function: h5_fileaccess_flags + * + * Purpose: Returns a file access template which is the default template + * but with a file driver, VOL connector, or libver bound set + * according to a constant or environment variable + * + * Return: Success: A file access property list + * Failure: H5I_INVALID_HID + * + * Programmer: Robb Matzke + * Thursday, November 19, 1998 + * + *------------------------------------------------------------------------- + */ +hid_t +h5_fileaccess_flags(unsigned flags) +{ + hid_t fapl_id = H5I_INVALID_HID; + + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + /* Attempt to set up a file driver first */ + if((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0) + goto error; + + /* Next, try to set up a VOL connector */ + if((flags & H5_FILEACCESS_VOL) && h5_get_vol_fapl(fapl_id) < 0) + goto error; + + /* Finally, check for libver bounds */ + if((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) + goto error; + + return fapl_id; + +error: + if(fapl_id != H5I_INVALID_HID) + H5Pclose(fapl_id); + return H5I_INVALID_HID; +} /* end h5_fileaccess_flags() */ + + +/*------------------------------------------------------------------------- * Function: h5_get_vfd_fapl * * Purpose: Sets the file driver for a FAPL according to the value specified @@ -1894,6 +1938,42 @@ static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UN static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; } +/* Dummy VFD with the minimum parameters to make a VFD that can be registered */ +static const H5FD_class_t H5FD_dummy_g = { + "dummy", /* name */ + 1, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + NULL, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + dummy_vfd_open, /* open */ + dummy_vfd_close, /* close */ + NULL, /* cmp */ + NULL, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + dummy_vfd_get_eoa, /* get_eoa */ + dummy_vfd_set_eoa, /* set_eoa */ + dummy_vfd_get_eof, /* get_eof */ + NULL, /* get_handle */ + dummy_vfd_read, /* read */ + dummy_vfd_write, /* write */ + NULL, /* flush */ + NULL, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + /*------------------------------------------------------------------------- * Function: h5_get_dummy_vfd_class() @@ -1921,21 +2001,11 @@ h5_get_dummy_vfd_class(void) H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */ /* Create the class and initialize everything to zero/NULL */ - if(NULL == (vfd_class = (H5FD_class_t *)HDcalloc((size_t)1, sizeof(H5FD_class_t)))) + if(NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t)))) TEST_ERROR; - /* Fill in the minimum parameters to make a VFD that - * can be registered. - */ - vfd_class->name = "dummy"; - vfd_class->maxaddr = 1; - vfd_class->open = dummy_vfd_open; - vfd_class->close = dummy_vfd_close; - vfd_class->get_eoa = dummy_vfd_get_eoa; - vfd_class->set_eoa = dummy_vfd_set_eoa; - vfd_class->get_eof = dummy_vfd_get_eof; - vfd_class->read = dummy_vfd_read; - vfd_class->write = dummy_vfd_write; + /* Copy the dummy VFD */ + HDmemcpy(vfd_class, &H5FD_dummy_g, sizeof(H5FD_class_t)); return vfd_class; diff --git a/test/h5test.h b/test/h5test.h index c72f389..66a7863 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -102,7 +102,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * the H5_FAILED() macro is invoked automatically when an API function fails. */ #define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} -#define TESTING_2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);} +#define TESTING_2(WHAT) {printf(" Testing %-60s",WHAT); fflush(stdout);} #define PASSED() {puts(" PASSED");fflush(stdout);} #define H5_FAILED() {puts("*FAILED*");fflush(stdout);} #define H5_WARNING() {puts("*WARNING*");fflush(stdout);} @@ -121,6 +121,11 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #define ALARM_ON TestAlarmOn() #define ALARM_OFF HDalarm(0) +/* Flags for h5_fileaccess_flags() */ +#define H5_FILEACCESS_VFD 0x01 +#define H5_FILEACCESS_VOL 0x02 +#define H5_FILEACCESS_LIBVER 0x04 + #ifdef __cplusplus extern "C" { #endif @@ -132,6 +137,7 @@ H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, s H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL hid_t h5_fileaccess(void); +H5TEST_DLL hid_t h5_fileaccess_flags(unsigned flags); H5TEST_DLL void h5_no_hwconv(void); H5TEST_DLL const char *h5_rmprefix(const char *filename); H5TEST_DLL void h5_reset(void); diff --git a/test/links.c b/test/links.c index b09ddb1..520f784 100644 --- a/test/links.c +++ b/test/links.c @@ -8823,6 +8823,12 @@ ud_link_errors(hid_t fapl, hbool_t new_format) TEST_ERROR } H5E_END_TRY + /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY; + /* Create a user-defined link to the group. */ strcpy(group_name, "/group"); if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR diff --git a/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 b/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 Binary files differnew file mode 100644 index 0000000..b5980b7 --- /dev/null +++ b/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 diff --git a/test/objcopy.c b/test/objcopy.c index 6ee2f72..eb4927f 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -7871,7 +7871,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) addr_reset(); /* Setup */ - if((src_fapl = h5_fileaccess()) < 0) TEST_ERROR + if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR /* open source file (read-only) */ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR diff --git a/test/ohdr.c b/test/ohdr.c index 042a81b..85554a5 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -521,6 +521,16 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) PASSED(); + TESTING("object with unknown header message & 'shareable' flag set"); + + /* Open the dataset with the unknown header message, adn "shareable" flag */ + if((did = H5Dopen2(loc_bogus, "Dataset5", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + + PASSED(); + TESTING("object in r/o file with unknown header message & 'fail if unknown and open for write' flag set"); /* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */ @@ -753,7 +763,7 @@ put_attribute(hid_t loc_id, const char *attrname, const void *attrvalue, hid_t d { if((*attribute_id) < 0) { hid_t id = -1; - id = H5Acreate(loc_id, attrname, datatype_id, dataspace_id, H5P_DEFAULT, H5P_DEFAULT); + id = H5Acreate2(loc_id, attrname, datatype_id, dataspace_id, H5P_DEFAULT, H5P_DEFAULT); if(id < 0) return FAIL; *attribute_id = id; @@ -770,7 +780,7 @@ count_attributes(hid_t dset_id) { H5O_info_t info; - if(H5Oget_info(dset_id, &info, H5O_INFO_ALL) < 0) + if(H5Oget_info2(dset_id, &info, H5O_INFO_ALL) < 0) return -1; else return (int)info.num_attrs; /* should never exceed int bounds */ @@ -850,7 +860,7 @@ test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id) * SETUP * *********/ - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL) + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) TEST_ERROR dspace_id = H5Screate_simple(1, array_10, NULL); @@ -879,10 +889,10 @@ test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id) } H5E_END_TRY; if(count != -1) TEST_ERROR - dset_id = H5Dcreate(file_id, "dataset", int_type_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset_id = H5Dcreate2(file_id, "dataset", int_type_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dset_id < 0) TEST_ERROR - mindset_id = H5Dcreate(file_id, "mindataset", int_type_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + mindset_id = H5Dcreate2(file_id, "mindataset", int_type_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); if(mindset_id < 0) TEST_ERROR /******************** @@ -1081,10 +1091,10 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id) * SETUP * *********/ - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename_a, sizeof(filename_a)) == NULL) + if(h5_fixname(FILENAME[1], fapl_id, filename_a, sizeof(filename_a)) == NULL) TEST_ERROR - if(h5_fixname(FILENAME[2], H5P_DEFAULT, filename_b, sizeof(filename_b)) == NULL) + if(h5_fixname(FILENAME[2], fapl_id, filename_b, sizeof(filename_b)) == NULL) TEST_ERROR for (compact = 0; compact < 2; compact++) { /* 0 or 1 */ @@ -1121,13 +1131,13 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id) file_f_id = H5Fcreate(filename_a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); if(file_f_id < 0) TEST_ERROR - dset_f_x_id = H5Dcreate(file_f_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT); + dset_f_x_id = H5Dcreate2(file_f_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT); if(dset_f_x_id < 0) TEST_ERROR - dset_f_N_id = H5Dcreate(file_f_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT); + dset_f_N_id = H5Dcreate2(file_f_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT); if(dset_f_N_id < 0) TEST_ERROR - dset_f_Y_id = H5Dcreate(file_f_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT); + dset_f_Y_id = H5Dcreate2(file_f_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT); if(dset_f_x_id < 0) TEST_ERROR file_F_id = H5Fcreate(filename_b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); @@ -1135,13 +1145,13 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id) ret = H5Fset_dset_no_attrs_hint(file_F_id, TRUE); if(ret < 0) TEST_ERROR - dset_F_x_id = H5Dcreate(file_F_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT); + dset_F_x_id = H5Dcreate2(file_F_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT); if(dset_F_x_id < 0) TEST_ERROR - dset_F_N_id = H5Dcreate(file_F_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT); + dset_F_N_id = H5Dcreate2(file_F_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT); if(dset_F_N_id < 0) TEST_ERROR - dset_F_Y_id = H5Dcreate(file_F_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT); + dset_F_Y_id = H5Dcreate2(file_F_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT); if(dset_F_Y_id < 0) TEST_ERROR /********* @@ -1244,7 +1254,7 @@ test_minimized_dset_ohdr_with_filter(hid_t fapl_id) * SETUP * *********/ - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL) + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) TEST_ERROR dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE); @@ -1276,16 +1286,16 @@ test_minimized_dset_ohdr_with_filter(hid_t fapl_id) file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); if(file_id < 0) TEST_ERROR - dset_xx_id = H5Dcreate(file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset_xx_id = H5Dcreate2(file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dset_xx_id < 0) TEST_ERROR - dset_mx_id = H5Dcreate(file_id, "Mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT); + dset_mx_id = H5Dcreate2(file_id, "Mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT); if(dset_mx_id < 0) TEST_ERROR - dset_xZ_id = H5Dcreate(file_id, "xZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xZ_id, H5P_DEFAULT); + dset_xZ_id = H5Dcreate2(file_id, "xZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xZ_id, H5P_DEFAULT); if(dset_xZ_id < 0) TEST_ERROR - dset_mZ_id = H5Dcreate(file_id, "MZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mZ_id, H5P_DEFAULT); + dset_mZ_id = H5Dcreate2(file_id, "MZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mZ_id, H5P_DEFAULT); if(dset_mZ_id < 0) TEST_ERROR /********* @@ -1383,7 +1393,7 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id) * SETUP * *********/ - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL) + if(h5_fixname(FILENAME[1], _fapl_id, filename, sizeof(filename)) == NULL) TEST_ERROR dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE); @@ -1426,8 +1436,6 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id) if(fapl_id < 0) TEST_ERROR if(cases[i].oh_version > 1) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if(fapl_id < 0) TEST_ERROR ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_V110); if(ret < 0) TEST_ERROR } @@ -1435,18 +1443,18 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id) file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); if(file_id < 0) TEST_ERROR - dset_xx_id = H5Dcreate( file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset_xx_id = H5Dcreate2( file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dset_xx_id < 0) TEST_ERROR - dset_mx_id = H5Dcreate(file_id, "mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT); + dset_mx_id = H5Dcreate2(file_id, "mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT); if(dset_mx_id < 0) TEST_ERROR - dset_xT_id = H5Dcreate(file_id, "xT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xT_id, H5P_DEFAULT); + dset_xT_id = H5Dcreate2(file_id, "xT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xT_id, H5P_DEFAULT); if(dset_xT_id < 0) TEST_ERROR - dset_mT_id = H5Dcreate(file_id, "mT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mT_id, H5P_DEFAULT); + dset_mT_id = H5Dcreate2(file_id, "mT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mT_id, H5P_DEFAULT); if(dset_mT_id < 0) TEST_ERROR - dset_mN_id = H5Dcreate(file_id, "mN", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mN_id, H5P_DEFAULT); + dset_mN_id = H5Dcreate2(file_id, "mN", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mN_id, H5P_DEFAULT); if(dset_mN_id < 0) TEST_ERROR /* ----- * @@ -1534,7 +1542,10 @@ test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id) TESTING("minimized dset object headers with fill values and different libver support"); - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL) + fapl_id = H5Pcopy(_fapl_id); + if(fapl_id < 0) TEST_ERROR + + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) TEST_ERROR dspace_id = H5Screate_simple(1, extents, extents); @@ -1552,16 +1563,13 @@ test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id) ret = H5Pset_fill_value(dcpl_id, dtype_id, fill); if(ret == FAIL) TEST_ERROR; - fapl_id = H5Pcopy(_fapl_id); - if(fapl_id < 0) TEST_ERROR - ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); if(ret == FAIL) TEST_ERROR; file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); if(file_id < 0) TEST_ERROR - dset_0_id = H5Dcreate(file_id, "fullrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + dset_0_id = H5Dcreate2(file_id, "fullrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); if(dset_0_id < 0) TEST_ERROR /* Close file and re-open with different libver bounds. @@ -1576,7 +1584,7 @@ test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id) file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); if(file_id < 0) TEST_ERROR - dset_1_id = H5Dcreate(file_id, "upperrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + dset_1_id = H5Dcreate2(file_id, "upperrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); if(dset_1_id < 0) TEST_ERROR /* re-open "fullrange" dataset @@ -1678,6 +1686,8 @@ main(void) hid_t fapl = -1; hid_t file = -1; H5F_t *f = NULL; + const char *env_h5_drvr; /* File driver value from environment */ + hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */ char filename[1024]; H5O_hdr_info_t hdr_info; /* Object info */ H5O_loc_t oh_loc; /* Object header locations */ @@ -1688,6 +1698,14 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; /* Generic return value */ + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Check for VFD which stores data in multiple files */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + /* Reset library */ h5_reset(); fapl = h5_fileaccess(); @@ -1906,11 +1924,23 @@ main(void) * and the various "fail/mark if unknown" object header message flags */ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID"); - if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) - TEST_ERROR + if(single_file_vfd) { + if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) + TEST_ERROR + } /* end if */ + else { + SKIPPED(); + HDputs(" Unknown header message test not supported with the current VFD."); + } /* end else */ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID"); - if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) - TEST_ERROR + if(single_file_vfd) { + if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) + TEST_ERROR + } /* end if */ + else { + SKIPPED(); + HDputs(" Unknown header message test not supported with the current VFD."); + } /* end else */ /* Test object header creation metadata cache issues */ if(test_ohdr_cache(filename, fapl) < 0) diff --git a/test/tattr.c b/test/tattr.c index c1167c6..454ea71 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -150,6 +150,8 @@ float attr_data5=-5.123F; /* Test data for 5th attribute */ #define INVALID_RENAME_TEST_ATTR_NAME "InvalidRenameTestAttr" #define INVALID_RENAME_TEST_NEW_ATTR_NAME "InvalidRenameTestNewAttr" +/* Used by test_attr_get_name_invalid_buf() */ +#define GET_NAME_INVALID_BUF_TEST_ATTR_NAME "InvalidNameBufferTestAttr" /* Attribute iteration struct */ typedef struct { @@ -6138,6 +6140,60 @@ test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl) } +/*************************************************************** +** +** test_attr_get_name_invalid_buf(): A test to ensure that +** passing a NULL buffer to H5Aget_name(_by_idx) when +** the 'size' parameter is non-zero doesn't cause bad +** behavior. +** +****************************************************************/ +static void +test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl) +{ + ssize_t err_ret = -1; + hid_t fid; + hid_t attr; + hid_t sid; + + /* Create dataspace for attribute */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create attribute */ + attr = H5Acreate2(fid, GET_NAME_INVALID_BUF_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate2"); + + H5E_BEGIN_TRY { + err_ret = H5Aget_name(attr, 1, NULL); + } H5E_END_TRY; + + VERIFY(err_ret, FAIL, "H5Aget_name"); + + H5E_BEGIN_TRY { + err_ret = H5Aget_name_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, 1, H5P_DEFAULT); + } H5E_END_TRY; + + VERIFY(err_ret, FAIL, "H5Aget_name_by_idx"); + + /* Close dataspace */ + err_ret = H5Sclose(sid); + CHECK(err_ret, FAIL, "H5Sclose"); + + /* Close attribute */ + err_ret = H5Aclose(attr); + CHECK(err_ret, FAIL, "H5Aclose"); + + /* Close file */ + err_ret = H5Fclose(fid); + CHECK(err_ret, FAIL, "H5Fclose"); +} + + /**************************************************************** ** ** test_attr_delete_by_idx(): Test basic H5A (attribute) code. @@ -11176,6 +11232,7 @@ test_attr(void) test_attr_many(new_format, my_fcpl, my_fapl); /* Test storing lots of attributes */ test_attr_info_null_info_pointer(my_fcpl, my_fapl); /* Test passing a NULL attribute info pointer to H5Aget_info(_by_name/_by_idx) */ test_attr_rename_invalid_name(my_fcpl, my_fapl); /* Test passing a NULL or empty attribute name to H5Arename(_by_name) */ + test_attr_get_name_invalid_buf(my_fcpl, my_fapl); /* Test passing NULL buffer to H5Aget_name(_by_idx) */ /* New attribute API routine tests */ diff --git a/test/tbogus.h5 b/test/tbogus.h5 Binary files differindex 91ab76f..efcbd79 100644 --- a/test/tbogus.h5 +++ b/test/tbogus.h5 diff --git a/test/test_filenotclosed.sh.in b/test/testabort_fail.sh.in index 0b43c5b..925d8a4 100644 --- a/test/test_filenotclosed.sh.in +++ b/test/testabort_fail.sh.in @@ -13,6 +13,9 @@ # # Test to verify that the assertion/abort failure is fixed when the application # does not close the file. (See HDFFV-10160) +# +# Test to verify that the infinite loop closing library/abort failure is fixed +# when the application creates and removes dense attributes (See HDFFV-10659) srcdir=@srcdir@ @@ -20,22 +23,44 @@ nerrors=0 ############################################################################## ############################################################################## -### T H E T E S T ### +### T H E T E S T S ### ############################################################################## ############################################################################## - +# +# echo "Testing file not closed assertion/abort failure" TEST_NAME=filenotclosed # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary # # Run the test -#$RUNSERIAL $TEST_BIN >/dev/null 2>&1 -$RUNSERIAL $TEST_BIN 2>&1 +$RUNSERIAL $TEST_BIN >/dev/null 2>&1 exitcode=$? if [ $exitcode -eq 0 ]; then echo "Test PASSED" else + echo "Test FAILED" nerrors="`expr $nerrors + 1`" - echo "***Error encountered***" fi -exit $nerrors +# +# +echo "Testing infinite loop closing library/abort failure" +TEST_NAME=del_many_dense_attrs # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +# Run the test +$RUNSERIAL $TEST_BIN >/dev/null 2>&1 +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test PASSED" +else + echo "Test FAILED" + nerrors="`expr $nerrors + 1`" +fi +# +# +if test $nerrors -eq 0 ; then + echo "All tests for abort failure passed." + exit 0 +else + echo "Tests for abort failure failed with $nerrors errors." + exit 1 +fi diff --git a/test/tfile.c b/test/tfile.c index 5338c32..c5e913c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1595,16 +1595,18 @@ test_file_perm2(void) ** *****************************************************************/ static void -test_file_is_accessible(void) +test_file_is_accessible(const char *env_h5_drvr) { hid_t fid; /* File opened with read-write permission */ hid_t fcpl_id; /* File creation property list */ hid_t fapl = -1; /* File access property list */ int fd; /* POSIX file descriptor */ + char filename[FILENAME_LEN]; /* Filename to use */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ unsigned char buf[1024]; /* Buffer of data to write */ htri_t status; /* Whether a file is an HDF5 file */ + hbool_t single_file_vfd; /* Whether VFD used is a single file */ herr_t ret; /* Output message about test being performed */ @@ -1613,9 +1615,10 @@ test_file_is_accessible(void) /* Get FAPL */ fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Close file */ @@ -1623,53 +1626,60 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); + status = H5Fis_accessible(filename, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); - /* Create a file creation property list with a non-default user block size */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl_id, FAIL, "H5Pcreate"); + /* This test is not currently working for the family VFD */ + if(0 != HDstrcmp(env_h5_drvr, "family")) { + /* Create a file creation property list with a non-default user block size */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl_id, FAIL, "H5Pcreate"); - ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); - CHECK(ret, FAIL, "H5Pset_userblock"); + ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* Create file with non-default user block */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + /* Create file with non-default user block */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl); + CHECK(fid, FAIL, "H5Fcreate"); - /* Release file-creation property list */ - ret = H5Pclose(fcpl_id); - CHECK(ret, FAIL, "H5Pclose"); + /* Release file-creation property list */ + ret = H5Pclose(fcpl_id); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); - VERIFY(status, TRUE, "H5Fis_accessible"); + /* Verify that the file is an HDF5 file */ + status = H5Fis_accessible(filename, fapl); + VERIFY(status, TRUE, "H5Fis_accessible"); + } /* end if */ - /* Create non-HDF5 file and check it */ - fd = HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); - CHECK(fd, FAIL, "HDopen"); + /* This test only works for VFDs with a single file */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + if(single_file_vfd) { + /* Create non-HDF5 file and check it */ + fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, FAIL, "HDopen"); - /* Initialize information to write */ - for (u=0; u<1024; u++) - buf[u]=(unsigned char)u; + /* Initialize information to write */ + for (u=0; u<1024; u++) + buf[u]=(unsigned char)u; - /* Write some information */ - nbytes = HDwrite(fd, buf, (size_t)1024); - VERIFY(nbytes, 1024, "HDwrite"); + /* Write some information */ + nbytes = HDwrite(fd, buf, (size_t)1024); + VERIFY(nbytes, 1024, "HDwrite"); - /* Close the file */ - ret = HDclose(fd); - CHECK(ret, FAIL, "HDclose"); + /* Close the file */ + ret = HDclose(fd); + CHECK(ret, FAIL, "HDclose"); - /* Verify that the file is not an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); - VERIFY(status, FALSE, "H5Fis_accessible"); + /* Verify that the file is not an HDF5 file */ + status = H5Fis_accessible(filename, fapl); + VERIFY(status, FALSE, "H5Fis_accessible"); + } /* end if */ /* Close property list */ ret = H5Pclose(fapl); @@ -1693,6 +1703,7 @@ test_file_ishdf5(void) hid_t fcpl; /* File creation property list */ hid_t fapl = -1; /* File access property list */ int fd; /* File Descriptor */ + char filename[FILENAME_LEN]; /* Filename to use */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ unsigned char buf[1024]; /* Buffer of data to write */ @@ -1705,9 +1716,10 @@ test_file_ishdf5(void) /* Get FAPL */ fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create a file */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Close file */ @@ -1715,7 +1727,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, TRUE, "H5Fis_hdf5"); @@ -1727,7 +1739,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1739,12 +1751,12 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, TRUE, "H5Fis_hdf5"); /* Create non-HDF5 file and check it */ - fd = HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); + fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); CHECK(fd, FAIL, "HDopen"); /* Initialize information to write */ @@ -1760,7 +1772,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "HDclose"); /* Verify that the file is not an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, FALSE, "H5Fis_hdf5"); /* Close property list */ @@ -2247,6 +2259,7 @@ test_file_double_file_dataset_open(hbool_t new_format) hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */ hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */ hsize_t size; /* File size */ + char filename[FILENAME_LEN]; /* Filename to use */ const char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */ const char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */ char* buffer[5]; /* Output buffer */ @@ -2263,9 +2276,10 @@ test_file_double_file_dataset_open(hbool_t new_format) ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); } /* end if */ + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create the test file */ - fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create a chunked dataset with fixed array indexing */ @@ -2347,8 +2361,6 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Sclose"); ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -2357,7 +2369,7 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2372,7 +2384,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Dwrite"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2413,11 +2425,11 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2478,7 +2490,7 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2490,7 +2502,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(size, 0, "H5Dget_storage_size"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2523,7 +2535,7 @@ test_file_double_file_dataset_open(hbool_t new_format) * from second call to H5Dset_extent->...H5D__earray_idx_remove->H5EA_get...H5EA__iblock_protect...H5AC_protect */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2542,7 +2554,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Dwrite"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2573,6 +2585,9 @@ test_file_double_file_dataset_open(hbool_t new_format) ret = H5Tclose(tid1); CHECK(ret, FAIL, "H5Tclose"); + /* Close FAPL */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); } /* end test_file_double_dataset_open() */ /**************************************************************** @@ -7500,6 +7515,7 @@ test_deprec(void) void test_file(void) { + hbool_t single_file_vfd; /* Whether VFD used is a single file */ const char *env_h5_drvr; /* File Driver value from environment */ /* Output message about test being performed */ @@ -7509,6 +7525,7 @@ test_file(void) env_h5_drvr = HDgetenv("HDF5_DRIVER"); if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); test_file_create(); /* Test file creation(also creation templates)*/ test_file_open(); /* Test file opening */ @@ -7518,7 +7535,7 @@ test_file(void) test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ test_file_perm(); /* Test file access permissions */ test_file_perm2(); /* Test file access permission again */ - test_file_is_accessible(); /* Test detecting HDF5 files correctly */ + test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */ test_file_open_dot(); /* Test opening objects with "." for a name */ test_file_open_overlap(); /* Test opening files in an overlapping manner */ test_file_getname(); /* Test basic H5Fget_name() functionality */ @@ -7554,7 +7571,10 @@ test_file(void) test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */ test_min_dset_ohdr(); /* Test datset object header minimization */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + if(single_file_vfd) + test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + else + MESSAGE(5, ("Skipping testing detection of HDF5 Files (using deprecated H5Fis_hdf5() call for non-single file VFDs)\n")); test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ diff --git a/test/titerate.c b/test/titerate.c index de652a7..87ddfb8 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -20,6 +20,7 @@ *************************************************************/ #include "testhdf5.h" +#include "H5srcdir.h" #define DATAFILE "titerate.h5" @@ -53,6 +54,17 @@ typedef struct { iter_enum command; /* The type of return value */ } iter_info; +/* Definition for test_corrupted_attnamelen */ +#define CORRUPTED_ATNAMELEN_FILE "memleak_H5O_dtype_decode_helper_H5Odtype.h5" +#define DSET_NAME "image" +typedef struct searched_err_t { + char message[256]; + bool found; +} searched_err_t; + +/* Call back function for test_corrupted_attnamelen */ +static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data); + /* Local functions */ int iter_strcmp(const void *s1, const void *s2); int iter_strcmp2(const void *s1, const void *s2); @@ -915,6 +927,92 @@ static void test_links(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_links() */ +/*------------------------------------------------------------------------- + * Function: find_err_msg_cb + * + * Purpose: Callback function to find the given error message. + * Helper function for test_corrupted_attnamelen(). + * + * Return: H5_ITER_STOP when the message is found + * H5_ITER_CONT, otherwise + * + *------------------------------------------------------------------------- + */ +static int +find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data) +{ + int status = H5_ITER_CONT; + searched_err_t *searched_err = (searched_err_t *)_client_data; + + if (searched_err == NULL) + return -1; + + /* If the searched error message is found, stop the iteration */ + if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) + { + searched_err->found = true; + status = H5_ITER_STOP; + } + return status; +} /* end find_err_msg_cb() */ + +/************************************************************************** +** +** test_corrupted_attnamelen(): Test the fix for the JIRA issue HDFFV-10588, +** where corrupted attribute's name length can be +** detected and invalid read can be avoided. +** +**************************************************************************/ +static void test_corrupted_attnamelen(void) +{ + hid_t fid = -1; /* File ID */ + hid_t did = -1; /* Dataset ID */ + searched_err_t err_caught; /* Data to be passed to callback func */ + int err_status; /* Status returned by H5Aiterate2 */ + herr_t ret; /* Return value */ + const char *testfile = H5_get_srcdir_filename(CORRUPTED_ATNAMELEN_FILE); /* Corrected test file name */ + + const char *err_message = "attribute name has different length than stored length"; + /* the error message produced when the failure occurs */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing the Handling of Corrupted Attribute's Name Length\n")); + + fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* Open the dataset */ + did = H5Dopen2(fid, DSET_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); + + /* Call H5Aiterate2 to trigger the failure in HDFFV-10588. Failure should + occur in the decoding stage, so some arguments are not needed. */ + err_status = H5Aiterate2(did, H5_INDEX_NAME, H5_ITER_INC, NULL, NULL, NULL); + + /* Make sure the intended error was caught */ + if(err_status == -1) + { + /* Initialize client data */ + HDstrcpy(err_caught.message, err_message); + err_caught.found = false; + + /* Look for the correct error message */ + ret = H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, find_err_msg_cb, &err_caught); + CHECK(ret, FAIL, "H5Ewalk2"); + + /* Fail if the indicated message is not found */ + CHECK(err_caught.found, false, "test_corrupted_attnamelen: Expected error not found"); + } + + /* Close the dataset and file */ + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_corrupted_attnamelen() */ + /**************************************************************** ** ** test_iterate(): Main iteration testing routine. @@ -951,6 +1049,9 @@ test_iterate(void) test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ } /* end for */ + /* Test the fix for issue HDFFV-10588 */ + test_corrupted_attnamelen(); + /* Close FAPLs */ ret = H5Pclose(fapl); CHECK(ret, FAIL, "H5Pclose"); diff --git a/test/tselect.c b/test/tselect.c index 3c93e7a..bcc2a5b 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -1308,14 +1308,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) { + if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); -#ifdef QAK - for(i=0, tbuf=wbuf; i<12; i++) - for(j=0; j<30; j++) - printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -1432,14 +1426,8 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) { + if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) TestErrPrintf("Error: hyperslab values don't match!\n"); -#ifdef QAK - for(i=0, tbuf=wbuf; i<12; i++) - for(j=0; j<30; j++) - printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -3743,15 +3731,8 @@ test_select_hyper_copy(void) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) { + if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); -#ifdef QAK - for(i=0; i<SPACE3_DIM1; i++) - for(j=0; j<SPACE3_DIM2; j++) - if((unsigned)*(rbuf+i*SPACE3_DIM2+j)!=(unsigned)*(rbuf2+i*SPACE3_DIM2+j)) - printf("i=%d, j=%d, *rbuf=%u, *rbuf2=%u\n",i,j,(unsigned)*(rbuf+i*SPACE3_DIM2+j),(unsigned)*(rbuf2+i*SPACE3_DIM2+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -5220,7 +5201,7 @@ test_select_hyper_union_3d(void) tmp2_space = H5Scombine_select(sid2,H5S_SELECT_OR,tmp_space); CHECK(tmp2_space, FAIL, "H5Scombin_select"); - npoints = H5Sget_select_npoints(tmp2_space); + npoints = (hsize_t)H5Sget_select_npoints(tmp2_space); VERIFY(npoints, 15*26, "H5Sget_select_npoints"); /* Create a dataset */ @@ -5902,37 +5883,20 @@ test_select_hyper_union_random_5d(hid_t read_plist) CHECK(sid2, FAIL, "H5Screate_simple"); /* Get initial random # seed */ - seed=(unsigned)time(NULL)+(unsigned)clock(); + seed = (unsigned)HDtime(NULL) + (unsigned)HDclock(); /* Crunch through a bunch of random hyperslab reads from the file dataset */ for(test_num=0; test_num<NRAND_HYPER; test_num++) { /* Save random # seed for later use */ /* (Used in case of errors, to regenerate the hyperslab sequence) */ -#ifndef QAK - seed+=(unsigned)clock(); -#else /* QAK */ - seed=987909620; -#endif /* QAK */ + seed += (unsigned)HDclock(); HDsrandom(seed); -#ifdef QAK -printf("test_num=%d, seed=%u\n",test_num,seed); -#endif /* QAK */ -#ifndef QAK for(i=0; i<NHYPERSLABS; i++) { -#else /* QAK */ - for(i=0; i<2; i++) { -#endif /* QAK */ -#ifdef QAK -printf("hyperslab=%d\n",i); -#endif /* QAK */ /* Select random hyperslab location & size for selection */ for(j=0; j<SPACE5_RANK; j++) { start[j] = ((hsize_t)HDrandom() % dims1[j]); count[j] = (((hsize_t)HDrandom() % (dims1[j] - start[j])) + 1); -#ifdef QAK -printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[j],j,(int)(start[j]+count[j]-1)); -#endif /* QAK */ } /* end for */ /* Select hyperslab */ @@ -5953,41 +5917,9 @@ printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[ npoints2 = H5Sget_select_npoints(sid2); VERIFY(npoints, npoints2, "H5Sget_select_npoints"); -#ifdef QAK -printf("random I/O, before H5Dread(), npoints=%lu\n",(unsigned long)npoints); -{ - hsize_t blocks[128][2][SPACE5_RANK]; - hssize_t nblocks; - int k; - - nblocks=H5Sget_select_hyper_nblocks(sid1); - printf("nblocks=%d\n",(int)nblocks); - H5Sget_select_hyper_blocklist(sid1,0,nblocks,blocks); - for(j=0; j<nblocks; j++) { - printf("Block #%d, start = {",j); - for(k=0; k<SPACE5_RANK; k++) { - printf("%d",blocks[j][0][k]); - if(k<(SPACE5_RANK-1)) - printf(", "); - else - printf("}, end = {"); - } /* end for */ - for(k=0; k<SPACE5_RANK; k++) { - printf("%d",blocks[j][1][k]); - if(k<(SPACE5_RANK-1)) - printf(", "); - else - printf("}\n"); - } /* end for */ - } /* end for */ -} -#endif /* QAK */ /* Read selection from disk */ ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,read_plist,rbuf); CHECK(ret, FAIL, "H5Dread"); -#ifdef QAK -printf("random I/O, after H5Dread()\n"); -#endif /* QAK */ /* Compare data read with data written out */ tbuf=rbuf; @@ -20,8 +20,12 @@ #include "h5test.h" +/* Filename */ +const char *FILENAME[] = { + "native_vol_test", + NULL +}; -#define NATIVE_VOL_TEST_FILENAME "native_vol_test" #define NATIVE_VOL_TEST_GROUP_NAME "test_group" #define NATIVE_VOL_TEST_DATASET_NAME "test_dataset" #define NATIVE_VOL_TEST_ATTRIBUTE_NAME "test_dataset" @@ -237,7 +241,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_file_operation(void) +test_basic_file_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fid_reopen = H5I_INVALID_HID; @@ -245,6 +249,7 @@ test_basic_file_operation(void) hid_t fapl_id2 = H5I_INVALID_HID; hid_t fcpl_id = H5I_INVALID_HID; + char filename[1024]; ssize_t obj_count; hid_t obj_id_list[1]; hsize_t file_size; @@ -257,6 +262,7 @@ test_basic_file_operation(void) /* Retrieve the file access property for testing */ fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); /* Set the file close degree to a non-default value, to make the H5Pequal * work out. This is kinda odd, but the library's current behavior with @@ -273,7 +279,7 @@ test_basic_file_operation(void) FAIL_STACK_ERROR /* H5Fcreate */ - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* H5Fget_obj_count */ @@ -290,13 +296,16 @@ test_basic_file_operation(void) if ((obj_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET, 2, obj_id_list)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ /* H5Fget_create_plist */ if ((fcpl_id = H5Fget_create_plist(fid)) < 0) @@ -308,9 +317,12 @@ test_basic_file_operation(void) if (H5Fget_filesize(fid, &file_size) < 0) TEST_ERROR; - /* H5Fget_vfd_handle */ - if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) - TEST_ERROR; + /* Can't retrieve VFD handle for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_vfd_handle */ + if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) + TEST_ERROR; + } /* end if */ /* H5Fget_intent */ if (H5Fget_intent(fid, &intent) < 0) @@ -337,43 +349,49 @@ test_basic_file_operation(void) TEST_ERROR; /* H5Fis_accessible */ - if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, fapl_id) < 0) + if (H5Fis_accessible(filename, fapl_id) < 0) TEST_ERROR; /* H5Fopen */ - if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, fapl_id)) < 0) + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if(H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if(H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ if ((fid_reopen = H5Freopen(fid)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) + TEST_ERROR; + if(H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if(H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ if (H5Fclose(fid) < 0) TEST_ERROR; if (H5Fclose(fid_reopen) < 0) TEST_ERROR; + h5_delete_test_file(FILENAME[0], fapl_id); + /* H5Pclose */ if (H5Pclose(fapl_id) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); - PASSED(); return SUCCEED; @@ -404,14 +422,20 @@ static herr_t test_basic_group_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t gid_a = H5I_INVALID_HID; hid_t gcpl_id = H5I_INVALID_HID; + char filename[1024]; H5G_info_t info; TESTING("Basic VOL group operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* H5Gcreate */ @@ -465,7 +489,11 @@ test_basic_group_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -474,6 +502,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); H5Gclose(gid); + H5Pclose(fapl_id); H5Pclose(gcpl_id); } H5E_END_TRY; @@ -495,6 +524,7 @@ static herr_t test_basic_dataset_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t dcpl_id = H5I_INVALID_HID; hid_t dapl_id = H5I_INVALID_HID; hid_t did = H5I_INVALID_HID; @@ -502,6 +532,8 @@ test_basic_dataset_operation(void) hid_t sid = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; + char filename[1024]; + hsize_t curr_dims = 0; hsize_t max_dims = H5S_UNLIMITED; @@ -516,7 +548,11 @@ test_basic_dataset_operation(void) TESTING("Basic VOL dataset operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; for (i = 0; i < N_ELEMENTS; i++) { in_buf[i] = i; @@ -630,7 +666,11 @@ test_basic_dataset_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -642,6 +682,7 @@ error: H5Dclose(did_a); H5Sclose(sid); H5Tclose(tid); + H5Pclose(fapl_id); H5Pclose(dapl_id); H5Pclose(dcpl_id); } H5E_END_TRY; @@ -664,11 +705,14 @@ static herr_t test_basic_attribute_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t aid = H5I_INVALID_HID; hid_t aid_name = H5I_INVALID_HID; hid_t sid = H5I_INVALID_HID; + char filename[1024]; + hsize_t dims = 1; int data_in = 42; @@ -676,7 +720,11 @@ test_basic_attribute_operation(void) TESTING("Basic VOL attribute operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -730,7 +778,11 @@ test_basic_attribute_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -738,6 +790,7 @@ test_basic_attribute_operation(void) error: H5E_BEGIN_TRY { H5Fclose(fid); + H5Pclose(fapl_id); H5Gclose(gid); H5Sclose(sid); H5Aclose(aid); @@ -762,14 +815,20 @@ static herr_t test_basic_object_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t oid = H5I_INVALID_HID; + char filename[1024]; H5O_info_t object_info; TESTING("Basic VOL object operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -797,7 +856,12 @@ test_basic_object_operation(void) if (H5Gclose(gid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + PASSED(); return SUCCEED; @@ -805,6 +869,7 @@ test_basic_object_operation(void) error: H5E_BEGIN_TRY { H5Fclose(fid); + H5Pclose(fapl_id); H5Gclose(gid); } H5E_END_TRY; @@ -827,10 +892,16 @@ test_basic_link_operation(void) { hid_t fid = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + char filename[1024]; TESTING("Basic VOL link operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -862,7 +933,12 @@ test_basic_link_operation(void) if (H5Gclose(gid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + PASSED(); return SUCCEED; @@ -871,6 +947,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); H5Fclose(gid); + H5Pclose(fapl_id); } H5E_END_TRY; return FAIL; @@ -891,13 +968,19 @@ static herr_t test_basic_datatype_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; hid_t tid_anon = H5I_INVALID_HID; hid_t tcpl_id = H5I_INVALID_HID; + char filename[1024]; TESTING("Basic VOL datatype operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR; @@ -941,7 +1024,11 @@ test_basic_datatype_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -950,6 +1037,7 @@ error: H5E_BEGIN_TRY { H5Pclose(tcpl_id); H5Fclose(fid); + H5Pclose(fapl_id); H5Tclose(tid); H5Tclose(tid_anon); } H5E_END_TRY; @@ -958,34 +1046,6 @@ error: } /* end test_basic_datatype_operation() */ -#if 0 - -/*------------------------------------------------------------------------- - * Function: test_echo_vol_operation() - * - * Purpose: Uses the echo VOL connector to test basic VOL operations - * via the H5VL public API. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -test_echo_vol_operation(void) -{ - char name[25]; - - TESTING("Echo VOL operations"); - - PASSED(); - return SUCCEED; - -error: - return FAIL; - -} /* end test_basic_vol_operation() */ -#endif - /*------------------------------------------------------------------------- * Function: main @@ -999,15 +1059,21 @@ error: int main(void) { + const char *env_h5_drvr; /* File driver value from environment */ int nerrors = 0; + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + h5_reset(); HDputs("Testing basic Virtual Object Layer (VOL) functionality."); nerrors += test_vol_registration() < 0 ? 1 : 0; nerrors += test_native_vol_init() < 0 ? 1 : 0; - nerrors += test_basic_file_operation() < 0 ? 1 : 0; + nerrors += test_basic_file_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_basic_group_operation() < 0 ? 1 : 0; nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index dffb813..a0d7f59 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -22,9 +22,9 @@ foreach (testp ${H5P_TESTS}) add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${testp}> ${MPIEXEC_POSTFLAGS}) endforeach () -# The following will only be correct on windows shared -#set_tests_properties (TEST_PAR_t_pflush1 PROPERTIES WILL_FAIL "true") -set_property (TEST TEST_PAR_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") +# The t_pflush1 test is hard-coded to fail. +set_tests_properties (TEST_PAR_t_pflush1 PROPERTIES WILL_FAIL "true") +#set_property (TEST TEST_PAR_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") set_tests_properties (TEST_PAR_t_pflush2 PROPERTIES DEPENDS TEST_PAR_t_pflush1) ############################################################################## diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index fdd3488..1d882b8 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -671,7 +671,7 @@ dataset_big_write(void) /* create a memory dataspace independently */ mem_dataspace = H5Screate_simple (RANK, dims, NULL); VRFY((mem_dataspace >= 0), ""); - if(!mpi_rank == 0) { + if(mpi_rank != 0) { ret = H5Sselect_none(mem_dataspace); VRFY((ret >= 0), "H5Sset_none succeeded"); } @@ -980,7 +980,7 @@ dataset_big_read(void) /* create a memory dataspace independently */ mem_dataspace = H5Screate_simple (RANK, dims, NULL); VRFY((mem_dataspace >= 0), ""); - if(!mpi_rank == 0) { + if(mpi_rank != 0) { ret = H5Sselect_none(mem_dataspace); VRFY((ret >= 0), "H5Sset_none succeeded"); } diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 281d027..d4e556d 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -2649,7 +2649,7 @@ compress_readAll(void) /* Try reading the data */ ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); + VRFY((ret >= 0), "H5Dread succeeded"); /* Verify data read */ for(u=0; u<dim; u++) @@ -2659,8 +2659,10 @@ compress_readAll(void) nerrors++; } +#if MPI_VERSION >= 3 ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read); VRFY((ret >= 0), "H5Dwrite succeeded"); +#endif ret = H5Pclose(xfer_plist); VRFY((ret >= 0), "H5Pclose succeeded"); diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 5d989bb..16eb13c 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -12,6 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "testphdf5.h" +#include "H5Dprivate.h" #define DIM 2 #define SIZE 32 @@ -311,13 +312,27 @@ void compact_dataset(void) VRFY((ret>= 0),"set independent IO collectively succeeded"); } - dataset = H5Dopen2(iof, dname, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dopen2 succeeded"); +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + hbool_t prop_value; + prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; + ret = H5Pinsert2(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL); + VRFY((ret >= 0), "H5Pinsert2() succeeded"); +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + ret = H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, dxpl, inme); VRFY((ret >= 0), "H5Dread succeeded"); +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + prop_value = FALSE; + ret = H5Pget(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value); + VRFY((ret >= 0), "H5Pget succeeded"); + VRFY((prop_value == FALSE && dxfer_coll_type == DXFER_COLLECTIVE_IO),"rank 0 Bcast optimization was performed for a compact dataset"); +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + /* Verify data value */ for(i = 0; i < size; i++) for(j = 0; j < size; j++) @@ -603,8 +618,8 @@ void dataset_fillvalue(void) hsize_t req_count[4] = {1, 6, 7, 8}; hsize_t dset_size; /* Dataset size */ int *rdata, *wdata; /* Buffers for data to read and write */ - int *twdata, *trdata; /* Temporary pointer into buffer */ - int acc, i, j, k, l; /* Local index variables */ + int *twdata, *trdata; /* Temporary pointer into buffer */ + int acc, i, j, k, l, ii; /* Local index variables */ herr_t ret; /* Generic return value */ const char *filename; @@ -645,27 +660,60 @@ void dataset_fillvalue(void) /* * Read dataset before any data is written. */ - /* set entire read buffer with the constant 2 */ - HDmemset(rdata,2,(size_t)(dset_size*sizeof(int))); - /* Independently read the entire dataset back */ - ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); - VRFY((ret >= 0), "H5Dread succeeded"); - /* Verify all data read are the fill value 0 */ - trdata = rdata; - err_num = 0; - for(i = 0; i < (int)dset_dims[0]; i++) + /* Create DXPL for I/O */ + dxpl = H5Pcreate(H5P_DATASET_XFER); + VRFY((dxpl >= 0), "H5Pcreate succeeded"); + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + hbool_t prop_value; + prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; + ret = H5Pinsert2(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL); + VRFY((ret >= 0),"testing property list inserted succeeded"); +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + for(ii = 0; ii < 2; ii++) { + + if(ii == 0) + ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT); + else + ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); + + /* set entire read buffer with the constant 2 */ + HDmemset(rdata,2,(size_t)(dset_size*sizeof(int))); + + /* Read the entire dataset back */ + ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, rdata); + VRFY((ret >= 0), "H5Dread succeeded"); + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + prop_value = FALSE; + ret = H5Pget(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value); + VRFY((ret >= 0), "testing property list get succeeded"); + if(ii == 0) + VRFY((prop_value == FALSE), "correctly handled rank 0 Bcast"); + else + VRFY((prop_value == TRUE), "correctly handled rank 0 Bcast"); +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + /* Verify all data read are the fill value 0 */ + trdata = rdata; + err_num = 0; + for(i = 0; i < (int)dset_dims[0]; i++) for(j = 0; j < (int)dset_dims[1]; j++) - for(k = 0; k < (int)dset_dims[2]; k++) - for(l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++) - if(*trdata != 0) - if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) - printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, j, k, l, *trdata); - if(err_num > MAX_ERR_REPORT && !VERBOSE_MED) + for(k = 0; k < (int)dset_dims[2]; k++) + for(l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++) + if(*trdata != 0) + if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) + printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, j, k, l, *trdata); + if(err_num > MAX_ERR_REPORT && !VERBOSE_MED) printf("[more errors ...]\n"); - if(err_num){ + if(err_num) { printf("%d errors found in check_value\n", err_num); - nerrors++; + nerrors++; + } } /* Barrier to ensure all processes have completed the above test. */ @@ -681,10 +729,6 @@ void dataset_fillvalue(void) ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, req_start, NULL, req_count, NULL); VRFY((ret >= 0), "H5Sselect_hyperslab succeeded on memory dataspace"); - /* Create DXPL for collective I/O */ - dxpl = H5Pcreate(H5P_DATASET_XFER); - VRFY((dxpl >= 0), "H5Pcreate succeeded"); - ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { @@ -711,37 +755,64 @@ void dataset_fillvalue(void) /* * Read dataset after partial write. */ - /* set entire read buffer with the constant 2 */ - HDmemset(rdata,2,(size_t)(dset_size*sizeof(int))); - /* Independently read the entire dataset back */ - ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); - VRFY((ret >= 0), "H5Dread succeeded"); - /* Verify correct data read */ - twdata=wdata; - trdata=rdata; - err_num=0; - for(i=0; i<(int)dset_dims[0]; i++) +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; + ret = H5Pset(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value); + VRFY((ret >= 0), " H5Pset succeeded"); +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + for(ii = 0; ii < 2; ii++) { + + if(ii == 0) + ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT); + else + ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); + + /* set entire read buffer with the constant 2 */ + HDmemset(rdata,2,(size_t)(dset_size*sizeof(int))); + + /* Read the entire dataset back */ + ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, rdata); + VRFY((ret >= 0), "H5Dread succeeded"); + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + prop_value = FALSE; + ret = H5Pget(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value); + VRFY((ret >= 0), "testing property list get succeeded"); + if(ii == 0) + VRFY((prop_value == FALSE), "correctly handled rank 0 Bcast"); + else + VRFY((prop_value == TRUE), "correctly handled rank 0 Bcast"); +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + /* Verify correct data read */ + twdata=wdata; + trdata=rdata; + err_num=0; + for(i=0; i<(int)dset_dims[0]; i++) for(j=0; j<(int)dset_dims[1]; j++) - for(k=0; k<(int)dset_dims[2]; k++) - for(l=0; l<(int)dset_dims[3]; l++, twdata++, trdata++) - if(i<mpi_size) { - if(*twdata != *trdata ) - if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) - printf("Dataset Verify failed at [%d][%d][%d][%d]: expect %d, got %d\n", i,j,k,l, *twdata, *trdata); - } /* end if */ - else { - if(*trdata != 0) - if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) - printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i,j,k,l, *trdata); - } /* end else */ - if(err_num > MAX_ERR_REPORT && !VERBOSE_MED) + for(k=0; k<(int)dset_dims[2]; k++) + for(l=0; l<(int)dset_dims[3]; l++, twdata++, trdata++) + if(i<mpi_size) { + if(*twdata != *trdata ) + if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) + printf("Dataset Verify failed at [%d][%d][%d][%d]: expect %d, got %d\n", i,j,k,l, *twdata, *trdata); + } /* end if */ + else { + if(*trdata != 0) + if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) + printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i,j,k,l, *trdata); + } /* end else */ + if(err_num > MAX_ERR_REPORT && !VERBOSE_MED) printf("[more errors ...]\n"); - if(err_num){ + if(err_num){ printf("%d errors found in check_value\n", err_num); - nerrors++; + nerrors++; + } } - + /* Close all file objects */ ret = H5Dclose(dataset); VRFY((ret >= 0), "H5Dclose succeeded"); @@ -856,7 +927,7 @@ void collective_group_write(void) if(!((m+1) % 10)) { printf("created %d groups\n", m+1); MPI_Barrier(MPI_COMM_WORLD); - } + } #endif /* BARRIER_CHECKS */ } diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c index 4677bfe..27b561b 100644 --- a/testpar/t_pflush1.c +++ b/testpar/t_pflush1.c @@ -15,11 +15,11 @@ * Programmer: Leon Arber <larber@uiuc.edu> * Sept. 28, 2006. * - * Purpose: This is the first half of a two-part test that makes sure - * that a file can be read after a parallel application crashes as long - * as the file was flushed first. We simulate a crash by - * calling _exit(0) since this doesn't flush HDF5 caches but - * still exits with success. + * Purpose: This is the first half of a two-part test that makes sure + * that a file can be read after a parallel application crashes + * as long as the file was flushed first. We simulate a crash by + * calling _exit() since this doesn't flush HDF5 caches but + * still exits with success. */ #include "h5test.h" @@ -29,171 +29,190 @@ const char *FILENAME[] = { NULL }; -static double the_data[100][100]; +static int data_g[100][100]; +#define N_GROUPS 100 + + /*------------------------------------------------------------------------- - * Function: create_file - * - * Purpose: Creates file used in part 1 of the test + * Function: create_test_file * - * Return: Success: 0 + * Purpose: Creates the file used in part 1 of the test * - * Failure: 1 + * Return: Success: A valid file ID + * Failure: H5I_INVALID_HID * - * Programmer: Leon Arber + * Programmer: Leon Arber * Sept. 26, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static hid_t -create_file(char* name, hid_t fapl) +create_test_file(char *name, hid_t fapl_id) { - hid_t file, dcpl, space, dset, groups, grp, plist; - hsize_t ds_size[2] = {100, 100}; - hsize_t ch_size[2] = {5, 5}; - hsize_t i, j; - - - - if((file=H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; + hid_t fid = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t top_level_gid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t dxpl_id = H5I_INVALID_HID; + hsize_t dims[2] = {100, 100}; + hsize_t chunk_dims[2] = {5, 5}; + hsize_t i, j; + + if((fid = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Create a chunked dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk(dcpl, 2, ch_size) < 0) goto error; - if((space = H5Screate_simple(2, ds_size, NULL)) < 0) goto error; - if((dset = H5Dcreate2(file, "dset", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - - plist = H5Pcreate(H5P_DATASET_XFER); - H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE); - + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0) + goto error; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) + goto error; + if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + if(H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0) + goto error; /* Write some data */ - for(i = 0; i < ds_size[0]; i++) { - /* - * The extra cast in the following statement is a bug workaround - * for the Win32 version 5.0 compiler. - * 1998-11-06 ptl - */ - for(j = 0; j < ds_size[1]; j++) - the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1); - } - if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, plist, the_data) < 0) goto error; + for(i = 0; i < dims[0]; i++) + for(j = 0; j < dims[1]; j++) + data_g[i][j] = (int)(i + (i * j) + j); + + if(H5Dwrite(did, H5T_NATIVE_INT, sid, sid, dxpl_id, data_g) < 0) + goto error; /* Create some groups */ - if((groups = H5Gcreate2(file, "some_groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(i = 0; i < 100; i++) { - sprintf(name, "grp%02u", (unsigned)i); - if((grp = H5Gcreate2(groups, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if(H5Gclose(grp) < 0) goto error; + if((top_level_gid = H5Gcreate2(fid, "some_groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + for(i = 0; i < N_GROUPS; i++) { + HDsprintf(name, "grp%02u", (unsigned)i); + if((gid = H5Gcreate2(top_level_gid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Gclose(gid) < 0) + goto error; } - return file; + return fid; error: - HD_exit(1); -} + return H5I_INVALID_HID; +} /* end create_test_file() */ + /*------------------------------------------------------------------------- * Function: main * - * Purpose: Part 1 of a two-part H5Fflush() test. - * - * Return: Success: 0 + * Purpose: Part 1 of a two-part parallel H5Fflush() test. * - * Failure: 1 + * Return: EXIT_FAILURE (always) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 23, 1998 * - * Modifications: - * Leon Arber - * Sept. 26, 2006, expand test to check for failure if H5Fflush is not called. - * - * *------------------------------------------------------------------------- */ int main(int argc, char* argv[]) { - hid_t file1, file2, fapl; - MPI_File *mpifh_p = NULL; - char name[1024]; - const char *envval = NULL; - int mpi_size, mpi_rank; - MPI_Comm comm = MPI_COMM_WORLD; - MPI_Info info = MPI_INFO_NULL; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + MPI_File *mpifh_p = NULL; + char name[1024]; + const char *envval = NULL; + int mpi_size; + int mpi_rank; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; MPI_Init(&argc, &argv); MPI_Comm_size(comm, &mpi_size); MPI_Comm_rank(comm, &mpi_rank); - fapl = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_fapl_mpio(fapl, comm, info); - if(mpi_rank == 0) - TESTING("H5Fflush (part1)"); + TESTING("H5Fflush (part1)"); + + /* Don't run using the split VFD */ envval = HDgetenv("HDF5_DRIVER"); if(envval == NULL) envval = "nomatch"; - if(HDstrcmp(envval, "split")) { + + if(!HDstrcmp(envval, "split")) { + if(mpi_rank == 0) { + SKIPPED(); + HDputs(" Test not compatible with current Virtual File Driver"); + } + MPI_Finalize(); + HDexit(EXIT_FAILURE); + } + + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + if(H5Pset_fapl_mpio(fapl_id, comm, info) < 0) + goto error; + /* Create the file */ - h5_fixname(FILENAME[0], fapl, name, sizeof name); - file1 = create_file(name, fapl); + h5_fixname(FILENAME[0], fapl_id, name, sizeof(name)); + if((fid1 = create_test_file(name, fapl_id)) < 0) + goto error; /* Flush and exit without closing the library */ - if(H5Fflush(file1, H5F_SCOPE_GLOBAL) < 0) goto error; + if(H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0) + goto error; /* Create the other file which will not be flushed */ - h5_fixname(FILENAME[1], fapl, name, sizeof name); - file2 = create_file(name, fapl); - + h5_fixname(FILENAME[1], fapl_id, name, sizeof(name)); + if((fid2 = create_test_file(name, fapl_id)) < 0) + goto error; if(mpi_rank == 0) PASSED(); - fflush(stdout); - fflush(stderr); - } /* end if */ - else { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } /* end else */ - - /* - * Some systems like AIX do not like files not closed when MPI_Finalize + + HDfflush(stdout); + HDfflush(stderr); + + /* Some systems like AIX do not like files not being closed when MPI_Finalize * is called. So, we need to get the MPI file handles, close them by hand. * Then the _exit is still needed to stop at_exit from happening in some systems. * Note that MPIO VFD returns the address of the file-handle in the VFD struct * because MPI_File_close wants to modify the file-handle variable. */ - /* close file1 */ - if(H5Fget_vfd_handle(file1, fapl, (void **)&mpifh_p) < 0) { - printf("H5Fget_vfd_handle for file1 failed\n"); - goto error; - } /* end if */ - if(MPI_File_close(mpifh_p) != MPI_SUCCESS) { - printf("MPI_File_close for file1 failed\n"); - goto error; - } /* end if */ - /* close file2 */ - if(H5Fget_vfd_handle(file2, fapl, (void **)&mpifh_p) < 0) { - printf("H5Fget_vfd_handle for file2 failed\n"); - goto error; - } /* end if */ - if(MPI_File_close(mpifh_p) != MPI_SUCCESS) { - printf("MPI_File_close for file2 failed\n"); - goto error; - } /* end if */ - - fflush(stdout); - fflush(stderr); - HD_exit(0); + /* Close file 1 */ + if(H5Fget_vfd_handle(fid1, fapl_id, (void **)&mpifh_p) < 0) + goto error; + if(MPI_File_close(mpifh_p) != MPI_SUCCESS) + goto error; + + /* Close file 2 */ + if(H5Fget_vfd_handle(fid2, fapl_id, (void **)&mpifh_p) < 0) + goto error; + if(MPI_File_close(mpifh_p) != MPI_SUCCESS) + goto error; + + HDfflush(stdout); + HDfflush(stderr); + + /* Always exit with a failure code! + * + * In accordance with the standard, not having all processes + * call MPI_Finalize() can be considered an error, so mpiexec + * et al. may indicate failure on return. It's much easier to + * always ignore the failure condition than to handle some + * platforms returning success and others failure. + */ + HD_exit(EXIT_FAILURE); error: - fflush(stdout); - fflush(stderr); - HD_exit(1); -} + HDfflush(stdout); + HDfflush(stderr); + HDprintf("*** ERROR ***\n"); + HDprintf("THERE WAS A REAL ERROR IN t_pflush1.\n"); + HD_exit(EXIT_FAILURE); +} /* end main() */ diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index 2051f4e..f58e5a5 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -30,116 +30,124 @@ const char *FILENAME[] = { NULL }; -static double the_data[100][100]; +static int data_g[100][100]; +#define N_GROUPS 100 /*------------------------------------------------------------------------- - * Function: check_file + * Function: check_test_file * - * Purpose: Part 2 of a two-part H5Fflush() test. + * Purpose: Part 2 of a two-part H5Fflush() test. * - * Return: Success: 0 + * Return: SUCCEED/FAIL * - * Failure: 1 - * - * Programmer: Leon Arber + * Programmer: Leon Arber * Sept. 26, 2006. * *------------------------------------------------------------------------- */ -static int -check_file(char* name, hid_t fapl) +static herr_t +check_test_file(char* name, hid_t fapl_id) { - hid_t file, space, dset, groups, grp, plist; - hsize_t ds_size[2]; - double error; - hsize_t i, j; - - plist = H5Pcreate(H5P_DATASET_XFER); - H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE); - if((file = H5Fopen(name, H5F_ACC_RDONLY, fapl)) < 0) goto error; + hid_t fid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t top_level_gid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t dxpl_id = H5I_INVALID_HID; + hsize_t dims[2]; + int val; + hsize_t i, j; + + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + if(H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0) + goto error; + if((fid = H5Fopen(name, H5F_ACC_RDONLY, fapl_id)) < 0) + goto error; /* Open the dataset */ - if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) goto error; - if((space = H5Dget_space(dset)) < 0) goto error; - if(H5Sget_simple_extent_dims(space, ds_size, NULL) < 0) goto error; - assert(100==ds_size[0] && 100==ds_size[1]); + if((did = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) + goto error; + if((sid = H5Dget_space(did)) < 0) + goto error; + if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0) + goto error; + HDassert(100 == dims[0] && 100 == dims[1]); /* Read some data */ - if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, plist, - the_data) < 0) goto error; - for (i=0; i<ds_size[0]; i++) { - for (j=0; j<ds_size[1]; j++) { - /* - * The extra cast in the following statement is a bug workaround - * for the Win32 version 5.0 compiler. - * 1998-11-06 ptl - */ - error = fabs(the_data[i][j]-(double)(hssize_t)i/((hssize_t)j+1)); - if (error>0.0001) { - H5_FAILED(); - printf(" dset[%lu][%lu] = %g\n", - (unsigned long)i, (unsigned long)j, the_data[i][j]); - printf(" should be %g\n", - (double)(hssize_t)i/(hssize_t)(j+1)); - goto error; - } - } + if(H5Dread(did, H5T_NATIVE_INT, sid, sid, dxpl_id, data_g) < 0) + goto error; + for(i = 0; i < dims[0]; i++) { + for(j = 0; j < dims[1]; j++) { + val = (int)(i + (i * j) + j); + if(data_g[i][j] != val) { + H5_FAILED(); + HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j, data_g[i][j]); + HDprintf(" should be %d\n", val); + } + } } /* Open some groups */ - if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error; - for(i = 0; i < 100; i++) { - sprintf(name, "grp%02u", (unsigned)i); - if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error; - if(H5Gclose(grp) < 0) goto error; + if((top_level_gid = H5Gopen2(fid, "some_groups", H5P_DEFAULT)) < 0) + goto error; + for(i = 0; i < N_GROUPS; i++) { + HDsprintf(name, "grp%02u", (unsigned)i); + if((gid = H5Gopen2(top_level_gid, name, H5P_DEFAULT)) < 0) + goto error; + if(H5Gclose(gid) < 0) + goto error; } - if(H5Gclose(groups) < 0) goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Fclose(file) < 0) goto error; - if(H5Pclose(plist) < 0) goto error; - if(H5Sclose(space) < 0) goto error; + if(H5Gclose(top_level_gid) < 0) + goto error; + if(H5Dclose(did) < 0) + goto error; + if(H5Fclose(fid) < 0) + goto error; + if(H5Pclose(dxpl_id) < 0) + goto error; + if(H5Sclose(sid) < 0) + goto error; - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Pclose(plist); - H5Gclose(groups); - H5Dclose(dset); - H5Fclose(file); - H5Sclose(space); + H5Pclose(dxpl_id); + H5Gclose(top_level_gid); + H5Dclose(did); + H5Fclose(fid); + H5Sclose(sid); + H5Gclose(gid); } H5E_END_TRY; - return 1; -} + return FAIL; +} /* end check_test_file() */ /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Part 2 of a two-part H5Fflush() test. + * Purpose: Part 2 of a two-part H5Fflush() test. * - * Return: Success: 0 + * Return: EXIT_SUCCESS/EXIT_FAIL * - * Failure: 1 - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 23, 1998 * - * Modifications: - * Leon Arber - * Sept. 26, 2006, expand to check for case where the was file not flushed. - * *------------------------------------------------------------------------- */ int -main(int argc, char* argv[]) +main(int argc, char *argv[]) { + hid_t fapl_id1 = H5I_INVALID_HID; + hid_t fapl_id2 = H5I_INVALID_HID; H5E_auto2_t func; - char name[1024]; + char name[1024]; const char *envval = NULL; - int mpi_size, mpi_rank; + int mpi_size; + int mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; @@ -148,69 +156,70 @@ main(int argc, char* argv[]) MPI_Comm_rank(comm, &mpi_rank); if(mpi_rank == 0) - TESTING("H5Fflush (part2 with flush)"); + TESTING("H5Fflush (part2 with flush)"); - /* Don't run this test using the core or split file drivers */ + /* Don't run using the split VFD */ envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) + if(envval == NULL) envval = "nomatch"; - if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split")) { - hid_t fapl1, fapl2; - - fapl1 = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_fapl_mpio(fapl1, comm, info); - - fapl2 = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_fapl_mpio(fapl2, comm, info); - - /* Check the case where the file was flushed */ - h5_fixname(FILENAME[0], fapl1, name, sizeof name); - if(check_file(name, fapl1)) - { - H5_FAILED() - goto error; - } - else if(mpi_rank == 0) - { - PASSED() - } - - /* Check the case where the file was not flushed. This should give an error - * so we turn off the error stack temporarily */ - if(mpi_rank == 0) - TESTING("H5Fflush (part2 without flush)"); - H5Eget_auto2(H5E_DEFAULT,&func,NULL); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - h5_fixname(FILENAME[1], fapl2, name, sizeof name); - if(check_file(name, fapl2)) - { - if(mpi_rank == 0) - { - PASSED() - } - } - else - { - H5_FAILED() - goto error; - } - H5Eset_auto2(H5E_DEFAULT, func, NULL); - - - h5_clean_files(&FILENAME[0], fapl1); - h5_clean_files(&FILENAME[1], fapl2); + + if(!HDstrcmp(envval, "split")) { + if(mpi_rank == 0) { + SKIPPED(); + HDputs(" Test not compatible with current Virtual File Driver"); + } + MPI_Finalize(); + HDexit(EXIT_FAILURE); + } + + if((fapl_id1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + if(H5Pset_fapl_mpio(fapl_id1, comm, info) < 0) + goto error; + + if((fapl_id2 = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + if(H5Pset_fapl_mpio(fapl_id2, comm, info) < 0) + goto error; + + /* Check the case where the file was flushed */ + h5_fixname(FILENAME[0], fapl_id1, name, sizeof(name)); + if(check_test_file(name, fapl_id1)) { + H5_FAILED() + goto error; } - else - { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); + else if(mpi_rank == 0) { + PASSED() } + /* Check the case where the file was not flushed. This should give an error + * so we turn off the error stack temporarily. + */ + if(mpi_rank == 0) + TESTING("H5Fflush (part2 without flush)"); + H5Eget_auto2(H5E_DEFAULT,&func, NULL); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + + h5_fixname(FILENAME[1], fapl_id2, name, sizeof(name)); + if(check_test_file(name, fapl_id2)) { + if(mpi_rank == 0) + PASSED() + } + else { + H5_FAILED() + goto error; + } + + H5Eset_auto2(H5E_DEFAULT, func, NULL); + + h5_clean_files(&FILENAME[0], fapl_id1); + h5_clean_files(&FILENAME[1], fapl_id2); + MPI_Finalize(); - return 0; - error: - return 1; -} + HDexit(EXIT_SUCCESS); + +error: + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/testpar/t_pread.c b/testpar/t_pread.c index 0905d44..74feeb6 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -17,6 +17,7 @@ */ #include "testpar.h" +#include "H5Dprivate.h" /* The collection of files is included below to aid * an external "cleanup" process if required. @@ -34,6 +35,8 @@ const char *FILENAMES[NFILENAME + 1]={"reloc_t_pread_data_file", #define COUNT 1000 +#define LIMIT_NPROC 6 + hbool_t pass = true; static const char *random_hdf5_text = "Now is the time for all first-time-users of HDF5 to read their \ @@ -46,7 +49,7 @@ completely foolproof is to underestimate the ingenuity of complete\n\ fools.\n"; static int generate_test_file(MPI_Comm comm, int mpi_rank, int group); -static int test_parallel_read(MPI_Comm comm, int mpi_rank, int group); +static int test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group); static char *test_argv0 = NULL; @@ -108,6 +111,9 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) hid_t fapl_id = -1; hid_t dxpl_id = -1; hid_t dset_id = -1; + hid_t dset_id_ch = -1; + hid_t dcpl_id = H5P_DEFAULT; + hsize_t chunk[1]; float nextValue; float *data_slice = NULL; @@ -272,6 +278,55 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) } } + + /* create a chunked dataset */ + chunk[0] = COUNT/8; + + if ( pass ) { + if ( (dcpl_id = H5Pcreate (H5P_DATASET_CREATE)) < 0 ) { + pass = false; + failure_mssg = "H5Pcreate() failed.\n"; + } + } + + if ( pass ) { + if ( (H5Pset_chunk (dcpl_id, 1, chunk) ) < 0 ) { + pass = false; + failure_mssg = "H5Pset_chunk() failed.\n"; + } + } + + if ( pass ) { + + if ( (dset_id_ch = H5Dcreate2(file_id, "dataset0_chunked", H5T_NATIVE_FLOAT, + filespace, H5P_DEFAULT, dcpl_id, + H5P_DEFAULT)) < 0 ) { + pass = false; + failure_mssg = "H5Dcreate2() failed.\n"; + } + } + + if ( pass ) { + if ( (H5Dwrite(dset_id_ch, H5T_NATIVE_FLOAT, memspace, + filespace, dxpl_id, data_slice)) < 0 ) { + pass = false; + failure_mssg = "H5Dwrite() failed.\n"; + } + } + if ( pass || (dcpl_id != -1)) { + if ( H5Pclose(dcpl_id) < 0 ) { + pass = false; + failure_mssg = "H5Pclose(dcpl_id) failed.\n"; + } + } + + if ( pass || (dset_id_ch != -1)) { + if ( H5Dclose(dset_id_ch) < 0 ) { + pass = false; + failure_mssg = "H5Dclose(dset_id_ch) failed.\n"; + } + } + /* close file, etc. */ if ( pass || (dset_id != -1)) { if ( H5Dclose(dset_id) < 0 ) { @@ -413,7 +468,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) * Function: test_parallel_read * * Purpose: This actually tests the superblock optimization - * and covers the two primary cases we're interested in. + * and covers the three primary cases we're interested in. * 1). That HDF5 files can be opened in parallel by * the rank 0 process and that the superblock * offset is correctly broadcast to the other @@ -423,6 +478,10 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) * subgroups of MPI_COMM_WORLD and that each * subgroup operates as described in (1) to * collectively read the data. + * 3). Testing proc0-read-and-MPI_Bcast using + * sub-communicators, and reading into + * a memory space that is different from the + * file space, and chunked datasets. * * The global MPI rank is used for reading and * writing data for process specific data in the @@ -444,7 +503,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) *------------------------------------------------------------------------- */ static int -test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) +test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id) { const char *failure_mssg; const char *fcn_name = "test_parallel_read()"; @@ -457,8 +516,13 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) hid_t fapl_id = -1; hid_t file_id = -1; hid_t dset_id = -1; + hid_t dset_id_ch = -1; + hid_t dxpl_id = H5P_DEFAULT; hid_t memspace = -1; hid_t filespace = -1; + hid_t filetype = -1; + size_t filetype_size; + hssize_t dset_size; hsize_t i; hsize_t offset; hsize_t count = COUNT; @@ -552,6 +616,14 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) } } + /* open the chunked data set */ + if ( pass ) { + if ( (dset_id_ch = H5Dopen2(file_id, "dataset0_chunked", H5P_DEFAULT)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Dopen2() failed\n"; + } + } + /* setup memspace */ if ( pass ) { dims[0] = count; @@ -606,14 +678,6 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) } } - /* close file, etc. */ - if ( pass || (dset_id != -1) ) { - if ( H5Dclose(dset_id) < 0 ) { - pass = false; - failure_mssg = "H5Dclose(dset_id) failed.\n"; - } - } - if ( pass || (memspace != -1) ) { if ( H5Sclose(memspace) < 0 ) { pass = false; @@ -628,6 +692,330 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) } } + /* free data_slice if it has been allocated */ + if ( data_slice != NULL ) { + HDfree(data_slice); + data_slice = NULL; + } + + /* + * Test reading proc0-read-and-bcast with sub-communicators + */ + + /* Don't test with more than LIMIT_NPROC processes to avoid memory issues */ + + if( group_size <= LIMIT_NPROC ) { +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + hbool_t prop_value; +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + if ( (filespace = H5Dget_space(dset_id )) < 0 ) { + pass = FALSE; + failure_mssg = "H5Dget_space failed.\n"; + } + + if ( (dset_size = H5Sget_simple_extent_npoints(filespace)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Sget_simple_extent_npoints failed.\n"; + } + + if ( (filetype = H5Dget_type(dset_id)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Dget_type failed.\n"; + } + + if ( (filetype_size = H5Tget_size(filetype)) == 0 ) { + pass = FALSE; + failure_mssg = "H5Tget_size failed.\n"; + } + + if ( H5Tclose(filetype) < 0 ) { + pass = FALSE; + failure_mssg = "H5Tclose failed.\n"; + }; + + if ( (data_slice = (float *)HDmalloc((size_t)dset_size*filetype_size)) == NULL ) { + pass = FALSE; + failure_mssg = "malloc of data_slice failed.\n"; + } + + if ( pass ) { + if ( (dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Pcreate(H5P_DATASET_XFER) failed.\n"; + } + } + + if ( pass ) { + if ( (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Pset_dxpl_mpio() failed.\n"; + } + } + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + if ( pass ) { + prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; + if(H5Pinsert2(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value, + NULL, NULL, NULL, NULL, NULL, NULL) < 0) { + pass = FALSE; + failure_mssg = "H5Pinsert2() failed\n"; + } + } +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + /* read H5S_ALL section */ + if ( pass ) { + if ( (H5Dread(dset_id, H5T_NATIVE_FLOAT, H5S_ALL, + H5S_ALL, dxpl_id, data_slice)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Dread() failed\n"; + } + } + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + if ( pass ) { + prop_value = FALSE; + if(H5Pget(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) { + pass = FALSE; + failure_mssg = "H5Pget() failed\n"; + } + if (pass) { + if(prop_value != TRUE) { + pass = FALSE; + failure_mssg = "rank 0 Bcast optimization was mistakenly not performed\n"; + } + } + } +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + /* verify the data */ + if ( pass ) { + + if ( comm == MPI_COMM_WORLD ) /* test 1 */ + nextValue = 0; + else if ( group_id == 0 ) /* test 2 group 0 */ + nextValue = 0; + else /* test 2 group 1 */ + nextValue = (float)((hsize_t)( mpi_size / 2 )*count); + + i = 0; + while ( ( pass ) && ( i < (hsize_t)dset_size ) ) { + /* what we really want is data_slice[i] != nextValue -- + * the following is a circumlocution to shut up the + * the compiler. + */ + if ( ( data_slice[i] > nextValue ) || + ( data_slice[i] < nextValue ) ) { + pass = FALSE; + failure_mssg = "Unexpected dset contents.\n"; + } + nextValue += 1; + i++; + } + } + + /* read H5S_ALL section for the chunked dataset */ + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + if ( pass ) { + prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; + if(H5Pset(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) { + pass = FALSE; + failure_mssg = "H5Pset() failed\n"; + } + } +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + for ( i = 0; i < (hsize_t)dset_size; i++) { + data_slice[i] = 0; + } + if ( pass ) { + if ( (H5Dread(dset_id_ch, H5T_NATIVE_FLOAT, H5S_ALL, + H5S_ALL, dxpl_id, data_slice)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Dread() failed\n"; + } + } + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + if ( pass ) { + prop_value = FALSE; + if(H5Pget(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) { + pass = FALSE; + failure_mssg = "H5Pget() failed\n"; + } + if (pass) { + if(prop_value == TRUE) { + pass = FALSE; + failure_mssg = "rank 0 Bcast optimization was mistakenly performed for chunked dataset\n"; + } + } + } +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + /* verify the data */ + if ( pass ) { + + if ( comm == MPI_COMM_WORLD ) /* test 1 */ + nextValue = 0; + else if ( group_id == 0 ) /* test 2 group 0 */ + nextValue = 0; + else /* test 2 group 1 */ + nextValue = (float)((hsize_t)( mpi_size / 2 )*count); + + i = 0; + while ( ( pass ) && ( i < (hsize_t)dset_size ) ) { + /* what we really want is data_slice[i] != nextValue -- + * the following is a circumlocution to shut up the + * the compiler. + */ + if ( ( data_slice[i] > nextValue ) || + ( data_slice[i] < nextValue ) ) { + pass = FALSE; + failure_mssg = "Unexpected chunked dset contents.\n"; + } + nextValue += 1; + i++; + } + } + + if ( pass || (filespace != -1) ) { + if ( H5Sclose(filespace) < 0 ) { + pass = false; + failure_mssg = "H5Sclose(filespace) failed.\n"; + } + } + + /* free data_slice if it has been allocated */ + if ( data_slice != NULL ) { + HDfree(data_slice); + data_slice = NULL; + } + + /* + * Read an H5S_ALL filespace into a hyperslab defined memory space + */ + + if ( (data_slice = (float *)HDmalloc((size_t)(dset_size*2)*filetype_size)) == NULL ) { + pass = FALSE; + failure_mssg = "malloc of data_slice failed.\n"; + } + + /* setup memspace */ + if ( pass ) { + dims[0] = (hsize_t)dset_size*2; + if ( (memspace = H5Screate_simple(1, dims, NULL)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Screate_simple(1, dims, NULL) failed\n"; + } + } + if ( pass ) { + offset = (hsize_t)dset_size; + if ( (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, + &offset, NULL, &offset, NULL)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Sselect_hyperslab() failed\n"; + } + } + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + if ( pass ) { + prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; + if(H5Pset(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) { + pass = FALSE; + failure_mssg = "H5Pset() failed\n"; + } + } +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + /* read this processes section of the data */ + if ( pass ) { + if ( (H5Dread(dset_id, H5T_NATIVE_FLOAT, memspace, + H5S_ALL, dxpl_id, data_slice)) < 0 ) { + pass = FALSE; + failure_mssg = "H5Dread() failed\n"; + } + } + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + if ( pass ) { + prop_value = FALSE; + if(H5Pget(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) { + pass = FALSE; + failure_mssg = "H5Pget() failed\n"; + } + if (pass) { + if(prop_value != TRUE) { + pass = FALSE; + failure_mssg = "rank 0 Bcast optimization was mistakenly not performed\n"; + } + } + } +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + /* verify the data */ + if ( pass ) { + + if ( comm == MPI_COMM_WORLD ) /* test 1 */ + nextValue = 0; + else if ( group_id == 0 ) /* test 2 group 0 */ + nextValue = 0; + else /* test 2 group 1 */ + nextValue = (float)((hsize_t)(mpi_size / 2)*count); + + i = (hsize_t)dset_size; + while ( ( pass ) && ( i < (hsize_t)dset_size ) ) { + /* what we really want is data_slice[i] != nextValue -- + * the following is a circumlocution to shut up the + * the compiler. + */ + if ( ( data_slice[i] > nextValue ) || + ( data_slice[i] < nextValue ) ) { + pass = FALSE; + failure_mssg = "Unexpected dset contents.\n"; + } + nextValue += 1; + i++; + } + } + + if ( pass || (memspace != -1) ) { + if ( H5Sclose(memspace) < 0 ) { + pass = false; + failure_mssg = "H5Sclose(memspace) failed.\n"; + } + } + + /* free data_slice if it has been allocated */ + if ( data_slice != NULL ) { + HDfree(data_slice); + data_slice = NULL; + } + + if ( pass || (dxpl_id != -1) ) { + if ( H5Pclose(dxpl_id) < 0 ) { + pass = false; + failure_mssg = "H5Pclose(dxpl_id) failed.\n"; + } + } + } + + /* close file, etc. */ + if ( pass || (dset_id != -1) ) { + if ( H5Dclose(dset_id) < 0 ) { + pass = false; + failure_mssg = "H5Dclose(dset_id) failed.\n"; + } + } + + if ( pass || (dset_id_ch != -1) ) { + if ( H5Dclose(dset_id_ch) < 0 ) { + pass = false; + failure_mssg = "H5Dclose(dset_id_ch) failed.\n"; + } + } + if ( pass || (file_id != -1) ) { if ( H5Fclose(file_id) < 0 ) { pass = false; @@ -668,17 +1056,9 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", fcn_name, failure_mssg); } - HDremove(reloc_data_filename); } - /* free data_slice if it has been allocated */ - if ( data_slice != NULL ) { - HDfree(data_slice); - data_slice = NULL; - } - - return( ! pass ); } /* test_parallel_read() */ @@ -803,7 +1183,7 @@ main( int argc, char **argv) } /* Now read the generated test file (stil using MPI_COMM_WORLD) */ - nerrs += test_parallel_read( MPI_COMM_WORLD, mpi_rank, which_group); + nerrs += test_parallel_read( MPI_COMM_WORLD, mpi_rank, mpi_size, which_group); if ( nerrs > 0 ) { if ( mpi_rank == 0 ) { @@ -819,7 +1199,7 @@ main( int argc, char **argv) } /* run the 2nd set of tests */ - nerrs += test_parallel_read(group_comm, mpi_rank, which_group); + nerrs += test_parallel_read(group_comm, mpi_rank, mpi_size, which_group); if ( nerrs > 0 ) { if ( mpi_rank == 0 ) { diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 8ac0d32..e7e017f 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -561,6 +561,8 @@ herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table) { + herr_t ret_value = SUCCEED; + /* Initialize the tables */ init_table(group_table); init_table(dset_table); @@ -573,7 +575,20 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, info->dset_table = *dset_table; /* Find all shared objects */ - return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)); + if((ret_value = h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "finding shared objects failed") + +done: + /* Release resources */ + if(ret_value < 0) { + free_table(*group_table); + info->group_table = NULL; + free_table(*type_table); + info->type_table = NULL; + free_table(*dset_table); + info->dset_table = NULL; + } + return ret_value; } diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 0092abc..3d9472a 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -338,12 +338,14 @@ int apply_filters(const char* name, /* object name from traverse list */ sm_nbytes = msize; for (i = rank; i > 0; --i) { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + hsize_t size = 0; + if(sm_nbytes == 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "number of bytes per stripmine must be > 0"); + size = H5TOOLS_BUFSIZE / sm_nbytes; if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ size = 1; sm_size[i - 1] = MIN(dims[i - 1], size); sm_nbytes *= sm_size[i - 1]; - HDassert(sm_nbytes > 0); } for (i = 0; i < rank; i++) { diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 2d2b289..84140f2 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 2d2b289..84140f2 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 2d2b289..84140f2 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 2d2b289..84140f2 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index aaf3144..3f77f38 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -32,9 +32,6 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' - major: File accessibility - minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header @@ -69,6 +66,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index ce31ced..caeef27 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index ce31ced..caeef27 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index cbbbcfa..946ca04 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -9529,15 +9529,13 @@ gent_intattrscalars(void) } /*------------------------------------------------------------------------- - * Function: gent_packedbits + * Function: gent_intsattrs * - * Purpose: Generate a file to be used in the h5dump packed bits tests. + * Purpose: Generate a file to be used in the h5dump tests. * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created. * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created. * Fill them with raw data such that no bit will be all zero in a dataset. * A dummy dataset of double type is created for failure test. - * Created: Albert Cheng, 2010/5/10. - * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes *------------------------------------------------------------------------- */ static void diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 830de11..8edd243 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -71,30 +71,37 @@ family_to_single.h5 family_to_sec2.h5 ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPART-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5REPART-clearall-objects") + set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart) # repartition family member size to 20,000 bytes. add_test (NAME H5REPART-h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5) - set_tests_properties (H5REPART-h5repart_20K PROPERTIES DEPENDS H5REPART-clearall-objects) + set_tests_properties (H5REPART-h5repart_20K PROPERTIES + FIXTURES_REQUIRED clear_testrepart + ) # repartition family member size to 5 KB. add_test (NAME H5REPART-h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5) - set_tests_properties (H5REPART-h5repart_5K PROPERTIES DEPENDS H5REPART-clearall-objects) + set_tests_properties (H5REPART-h5repart_5K PROPERTIES + FIXTURES_REQUIRED clear_testrepart + ) # convert family file to sec2 file of 20,000 bytes add_test (NAME H5REPART-h5repart_single COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) - set_tests_properties (H5REPART-h5repart_single PROPERTIES DEPENDS H5REPART-clearall-objects) + set_tests_properties (H5REPART-h5repart_single PROPERTIES + FIXTURES_REQUIRED clear_testrepart + ) # convert family file to sec2 file of 20,000 bytes (old argument) add_test (NAME H5REPART-h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) - set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES DEPENDS H5REPART-clearall-objects) + set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES + FIXTURES_REQUIRED clear_testrepart + ) # test the output files repartitioned above. add_test (NAME H5REPART-h5repart_test COMMAND $<TARGET_FILE:h5repart_test>) - set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-clearall-objects;H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_sec2") + set_tests_properties (H5REPART-h5repart_test PROPERTIES + DEPENDS "H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_single;H5REPART-h5repart_sec2" + ) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repart_test diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 450667a..5abd038 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -66,7 +66,7 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT 1800) +set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) set_tests_properties (PERFORM_h5perf_serial PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") if (HDF5_BUILD_PERFORM_STANDALONE) |