summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-07-26 21:20:16 (GMT)
committerGitHub <noreply@github.com>2022-07-26 21:20:16 (GMT)
commit213eac2588369f75a11df6bb1788dde33c4b82e2 (patch)
treecd2ca57125ea1555d331f2c3c7d08aef7b289064
parent96edaa304cbc771a36372725c395b9c2e1bd81dd (diff)
downloadhdf5-213eac2588369f75a11df6bb1788dde33c4b82e2.zip
hdf5-213eac2588369f75a11df6bb1788dde33c4b82e2.tar.gz
hdf5-213eac2588369f75a11df6bb1788dde33c4b82e2.tar.bz2
Subfiling VFD misc fixes (#1938)
* Remove generated file h5fuse.sh * Link pthreads library when Subfiling VFD is built
-rw-r--r--CMakeLists.txt12
-rw-r--r--src/CMakeLists.txt5
-rwxr-xr-xutils/subfiling_vfd/h5fuse.sh89
3 files changed, 15 insertions, 91 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d27962d..4e42153 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -758,6 +758,18 @@ if (HDF5_ENABLE_SUBFILING_VFD)
if (NOT HDF5_ENABLE_PARALLEL)
message (FATAL_ERROR "Subfiling VFD requires a parallel HDF5 build")
endif()
+
+ if (NOT DEFINED Threads_FOUND)
+ set (THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package (Threads REQUIRED)
+ endif ()
+
+ # For now, make sure we're using pthreads. Once Subfiling can be
+ # supported on Windows, we should allow Win32 threads as well
+ if (NOT ${Threads_FOUND} OR NOT ${CMAKE_USE_PTHREADS_INIT})
+ message (FATAL_ERROR "Subfiling requires pthreads for system thread library")
+ endif ()
+
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H)
if (NOT HAVE_STDATOMIC_H)
message (FATAL_ERROR "Subfiling VFD requires atomic operations support. C11 stdatomic.h NOT available.")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9818004..3b98874 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1235,7 +1235,7 @@ if (NOT ONLY_SHARED_LIBS)
)
if (NOT WIN32)
target_link_libraries (${HDF5_LIB_TARGET}
- PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PRIVATE $<$<OR:$<BOOL:${HDF5_ENABLE_THREADSAFE}>,$<BOOL:${HDF5_ENABLE_SUBFILING_VFD}>>:Threads::Threads>
)
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
@@ -1272,7 +1272,8 @@ if (BUILD_SHARED_LIBS)
)
TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_LIBSH_TARGET}
- PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ $<$<OR:$<BOOL:${HDF5_ENABLE_THREADSAFE}>,$<BOOL:${HDF5_ENABLE_SUBFILING_VFD}>>:Threads::Threads>
PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>
)
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}")
diff --git a/utils/subfiling_vfd/h5fuse.sh b/utils/subfiling_vfd/h5fuse.sh
deleted file mode 100755
index 8170586..0000000
--- a/utils/subfiling_vfd/h5fuse.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/bash
-#
-# Copyright by The HDF Group.
-# All rights reserved.
-#
-# This file is part of HDF5. The full HDF5 copyright notice, including
-# terms governing use, modification, and redistribution, is contained in
-# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://www.hdfgroup.org/licenses.
-# If you do not have access to either file, you may request a copy from
-# help@hdfgroup.org.
-#
-
-# Purpose: Combine subfiles into a single HDF5 file. Requires the subfiling
-# configuration file either as a command-line argument, or the script will
-# search for the *.config file in the current directory.
-
-GRN='\033[0;32m'
-RED='\033[0;31m'
-PUR='\033[0;35m'
-NC='\033[0m' # No Color
-
-## CONFIG FILE CHECKS ##
-
-if [ $# -eq 0 ]; then
- nfiles=$(find . -maxdepth 1 -type f -iname "*.config" -printf '.' | wc -m)
- if [[ "$nfiles" != "1" ]]; then
- echo -e "$RED More than one .config file found in current directory. $NC"
- exit 1
- fi
- file_config=$(find . -maxdepth 1 -type f -iname "*.config")
-else
- file_config=$1
-fi
-
-if [ ! -f "$file_config" ]; then
- echo -e "$RED $file_config does not exist. $NC"
- exit 1
-fi
-
-stripe_size=$(grep "stripe_size=" $file_config | cut -d "=" -f2)
-if test -z "$stripe_size"; then
- echo -e "$RED failed to find stripe_size in $file_config $NC"
- exit 1
-fi
-
-subfiles=( $( sed -e '1,/hdf5_file=/d' $file_config ) )
-#for i in "${subfiles[@]}"; do
-# echo "$i"
-#done
-if test -z "$subfiles"; then
- echo -e "$RED failed to find subfiles list in $file_config $NC"
- exit 1
-fi
-
-hdf5_file=$(grep "hdf5_file=" $file_config | cut -d "=" -f2)
-if test -z "$hdf5_file"; then
- echo -e "$RED failed to find hdf5 output file in $file_config $NC"
- exit 1
-fi
-
-rm -f $hdf5_file
-
-## COMBINE SUBFILES INTO AN HDF5 FILE ##
-
-skip=0
-status=$nfiles
-START="$(date +%s%N)"
-while [ $status -gt 0 ]; do
- icnt=0
- for i in "${subfiles[@]}"; do
- fsize=$(wc -c $i | awk '{print $1}')
- if [ $(($skip*$stripe_size)) -le $fsize ]; then
- EXEC="dd count=1 bs=$stripe_size if=$i of=$hdf5_file skip=$skip oflag=append conv=notrunc"
- echo -e "$GRN $EXEC $NC"
- err="$( $EXEC 2>&1 > /dev/null &)"
- icnt=$(($icnt+1))
- else
- subfiles=("${subfiles[@]:0:$icnt}" "${subfiles[@]:$(($icnt+1))}")
- status=${#subfiles[@]}
- fi
- done; wait
- skip=$(($skip+1))
-done
-END=$[ $(date +%s%N) - ${START} ]
-DURATION_SEC=$(awk -vp=$END -vq=0.000000001 'BEGIN{printf "%.4f" ,p * q}')
-echo -e "$PUR COMPLETION TIME = $DURATION_SEC s $NC"
-
-