diff --git a/CMakeLists.txt b/CMakeLists.txt index ef0a0f4fa7116cc405e128afc7446d371ebe527c..220eaf48888f486a693a77ab8b14d1007b30c170 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,18 +227,20 @@ set(PUGS_ENABLE_HDF5 AUTO CACHE STRING if (PUGS_ENABLE_HDF5 MATCHES "^(AUTO|ON)$") # May be risky. (make to show pugs build options) find_package(HDF5) - - # HighFive - set(HIGHFIVE_USE_BOOST OFF) # no Boost - set(HIGHFIVE_BUILD_DOCS OFF) # no doc - set(HIGHFIVE_UNIT_TESTS OFF) # no unit tests - set(HIGHFIVE_UNIT_TESTS OFF) # no unit tests - set(HIGHFIVE_EXAMPLES OFF) # no examples - set(HIGHFIVE_PARALLEL_HDF5 ON) # activate parallel HDF5 - add_subdirectory(${PUGS_SOURCE_DIR}/packages/HighFive/) - + if (HDF5_FOUND) + # HighFive + set(HIGHFIVE_USE_BOOST OFF) # no Boost + set(HIGHFIVE_BUILD_DOCS OFF) # no doc + set(HIGHFIVE_UNIT_TESTS OFF) # no unit tests + set(HIGHFIVE_UNIT_TESTS OFF) # no unit tests + set(HIGHFIVE_EXAMPLES OFF) # no examples + set(HIGHFIVE_PARALLEL_HDF5 ON) # activate parallel HDF5 + add_subdirectory(${PUGS_SOURCE_DIR}/packages/HighFive/) + set(HIGHFIVE_TARGET HighFive) + endif() set(PUGS_HAS_HDF5 ${HDF5_FOUND}) else() + unset(HIGHFIVE_TARGET) unset(PUGS_HAS_HDF5) endif() @@ -615,7 +617,7 @@ target_link_libraries( ${KOKKOS_CXX_FLAGS} ${OPENMP_LINK_FLAGS} ${PUGS_STD_LINK_FLAGS} - HighFive + ${HIGHFIVE_TARGET} stdc++fs ) diff --git a/src/algebra/CMakeLists.txt b/src/algebra/CMakeLists.txt index 6310f48dcf69eb93e2c1178e05d32dbc7fe5afad..74f40290a2f9250cc2296ec62358b44c366ffc85 100644 --- a/src/algebra/CMakeLists.txt +++ b/src/algebra/CMakeLists.txt @@ -11,4 +11,5 @@ target_link_libraries( PugsAlgebra ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES} + ${HIGHFIVE_TARGET} ) diff --git a/src/analysis/CMakeLists.txt b/src/analysis/CMakeLists.txt index b675ea696e20afb930e0163fc451d72111cf6f0a..4ab57395b9b153ea416299b600c168e8f6e2015c 100644 --- a/src/analysis/CMakeLists.txt +++ b/src/analysis/CMakeLists.txt @@ -12,6 +12,11 @@ add_library( TetrahedronGaussQuadrature.cpp TriangleGaussQuadrature.cpp) +target_link_libraries( + PugsAnalysis + ${HIGHFIVE_TARGET} +) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.0.0")) # Deactivated since it produces false positive warning in this file only ... diff --git a/src/dev_utils/CMakeLists.txt b/src/dev_utils/CMakeLists.txt index 7d709b9f70df018205fe8bfdfb7e9576268bfedd..c603f0d1da3c87fe0986c4f705207acd7c300907 100644 --- a/src/dev_utils/CMakeLists.txt +++ b/src/dev_utils/CMakeLists.txt @@ -7,5 +7,5 @@ add_library( target_link_libraries( PugsDevUtils - HighFive + ${HIGHFIVE_TARGET} ) diff --git a/src/dev_utils/ParallelChecker.hpp b/src/dev_utils/ParallelChecker.hpp index 4db7c33b7874cb9f6f9665147c293bca9166620b..82525d00fe227993c6f8fa54590eb3d975bf56cc 100644 --- a/src/dev_utils/ParallelChecker.hpp +++ b/src/dev_utils/ParallelChecker.hpp @@ -1,7 +1,11 @@ #ifndef PARALLEL_CHECKER_HPP #define PARALLEL_CHECKER_HPP +#include <utils/pugs_config.hpp> +#ifdef PUGS_HAS_HDF5 #include <highfive/H5File.hpp> +#endif // PUGS_HAS_HDF5 + #include <mesh/Connectivity.hpp> #include <mesh/ItemArrayVariant.hpp> #include <mesh/ItemValueVariant.hpp> @@ -33,7 +37,17 @@ class ParallelChecker write }; -#ifdef PUGS_HAS_HDF5 + private: + static ParallelChecker* m_instance; + + Mode m_mode = Mode::automatic; + size_t m_tag = 0; + + std::string m_filename = "testme/parallel_checker.h5"; + + ParallelChecker() = default; + + public: template <typename DataType, ItemType item_type, typename ConnectivityPtr> friend void parallel_check(const ItemValue<DataType, item_type, ConnectivityPtr>& item_value, const std::string& name, @@ -44,6 +58,7 @@ class ParallelChecker const std::string& name, const SourceLocation& source_location); +#ifdef PUGS_HAS_HDF5 private: template <typename T> struct TinyVectorDataType; @@ -73,15 +88,6 @@ class ParallelChecker } }; - static ParallelChecker* m_instance; - - Mode m_mode = Mode::automatic; - size_t m_tag = 0; - - std::string m_filename = "testme/parallel_checker.h5"; - - ParallelChecker() = default; - HighFive::File _createOrOpenFileRW() const { @@ -332,6 +338,7 @@ class ParallelChecker const std::string& name, const SourceLocation& source_location) { + HighFive::SilenceHDF5 m_silence_hdf5{true}; this->_printHeader(name, source_location); try { @@ -368,6 +375,7 @@ class ParallelChecker const std::string& name, const SourceLocation& source_location) { + HighFive::SilenceHDF5 m_silence_hdf5{true}; this->_printHeader(name, source_location); try { @@ -404,6 +412,7 @@ class ParallelChecker const std::string& name, const SourceLocation& source_location) { + HighFive::SilenceHDF5 m_silence_hdf5{true}; this->_printHeader(name, source_location); try { @@ -524,6 +533,7 @@ class ParallelChecker const std::string& name, const SourceLocation& source_location) { + HighFive::SilenceHDF5 m_silence_hdf5{true}; this->_printHeader(name, source_location); try { @@ -709,7 +719,6 @@ parallel_check(const ItemArray<DataType, item_type, ConnectivityPtr>& item_array const std::string& name, const SourceLocation& source_location) { - HighFive::SilenceHDF5 m_silence_hdf5{true}; if (ParallelChecker::instance().isWriting()) { ParallelChecker::instance().write(item_array, name, source_location); } else { @@ -723,7 +732,6 @@ parallel_check(const ItemValue<DataType, item_type, ConnectivityPtr>& item_value const std::string& name, const SourceLocation& source_location) { - HighFive::SilenceHDF5 m_silence_hdf5{true}; if (ParallelChecker::instance().isWriting()) { ParallelChecker::instance().write(item_value, name, source_location); } else { diff --git a/src/language/modules/CMakeLists.txt b/src/language/modules/CMakeLists.txt index 2e92ff89840661912a12a9b861f3109a1adb2e92..5f87dcf34f5b8652f976a2f88d851eb381d8385b 100644 --- a/src/language/modules/CMakeLists.txt +++ b/src/language/modules/CMakeLists.txt @@ -19,7 +19,7 @@ add_library( target_link_libraries( PugsLanguageModules - HighFive + ${HIGHFIVE_TARGET} ) add_dependencies( diff --git a/src/language/utils/CMakeLists.txt b/src/language/utils/CMakeLists.txt index 9cf233850f6fdf6786a2f869c43f2583742fa39e..33a41962e8f954ef214e0c6a50eefde1d8e29f7f 100644 --- a/src/language/utils/CMakeLists.txt +++ b/src/language/utils/CMakeLists.txt @@ -48,5 +48,5 @@ add_dependencies(PugsLanguageUtils target_link_libraries( PugsLanguageUtils - HighFive + ${HIGHFIVE_TARGET} ) diff --git a/src/mesh/CMakeLists.txt b/src/mesh/CMakeLists.txt index 55dffcca0a8a344de64d645548426a879d674aaa..9b82b62f1818e9dc785c62618b5878f71ab7db35 100644 --- a/src/mesh/CMakeLists.txt +++ b/src/mesh/CMakeLists.txt @@ -45,5 +45,5 @@ add_library( target_link_libraries( PugsMesh - HighFive + ${HIGHFIVE_TARGET} ) diff --git a/src/output/CMakeLists.txt b/src/output/CMakeLists.txt index 12b22d01f672d9e02dac0170bcdc3fc91cfec5da..051e96480431aaa733059e2cf9c9518b29216812 100644 --- a/src/output/CMakeLists.txt +++ b/src/output/CMakeLists.txt @@ -9,5 +9,5 @@ add_library( target_link_libraries( PugsOutput - HighFive + ${HIGHFIVE_TARGET} ) diff --git a/src/scheme/CMakeLists.txt b/src/scheme/CMakeLists.txt index 5d49a9177d50b7a6e785cde0bc63ac201d29f108..dadbe73bb24ad84e491248b89016baf85f0dbc31 100644 --- a/src/scheme/CMakeLists.txt +++ b/src/scheme/CMakeLists.txt @@ -14,5 +14,5 @@ add_library( target_link_libraries( PugsScheme - HighFive + ${HIGHFIVE_TARGET} ) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 8a32abb368921ab9d9b82b1381a822d37d58cd60..ca07c7dc6882942600e2c5e9b216ca1998fbbd71 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -24,7 +24,7 @@ target_link_libraries( PugsUtils ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES} - HighFive + ${HIGHFIVE_TARGET} ) # --------------- get git revision info --------------- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c47e8883729d021c9528b455487df3248b3faa60..04a7ae9e9a8014d59f3b2f7880cc044ed3cf9355 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -232,7 +232,7 @@ target_link_libraries (unit_tests ${PETSC_LIBRARIES} Catch2 ${PUGS_STD_LINK_FLAGS} - HighFive + ${HIGHFIVE_TARGET} stdc++fs ) @@ -261,7 +261,7 @@ target_link_libraries (mpi_unit_tests ${PETSC_LIBRARIES} Catch2 ${PUGS_STD_LINK_FLAGS} - HighFive + ${HIGHFIVE_TARGET} stdc++fs )