diff --git a/cmake/DetectOptions.cmake b/cmake/DetectOptions.cmake index 0270429313..89bc23ed71 100644 --- a/cmake/DetectOptions.cmake +++ b/cmake/DetectOptions.cmake @@ -155,21 +155,13 @@ endif() # HDF5 if(ADIOS2_USE_HDF5 STREQUAL AUTO) find_package(HDF5 COMPONENTS C) - if(HDF5_FOUND AND - ((ADIOS2_HAVE_MPI AND HDF5_IS_PARALLEL) OR - (NOT ADIOS2_HAVE_MPI AND NOT HDF5_IS_PARALLEL))) + if(HDF5_FOUND AND (NOT HDF5_IS_PARALLEL OR ADIOS2_HAVE_MPI)) set(ADIOS2_HAVE_HDF5 TRUE) endif() elseif(ADIOS2_USE_HDF5) find_package(HDF5 REQUIRED COMPONENTS C) - if(ADIOS2_HAVE_MPI) - if(NOT HDF5_IS_PARALLEL) - message(FATAL_ERROR "MPI is enabled but serial HDF5 is detected.") - endif() - else() - if(HDF5_IS_PARALLEL) - message(FATAL_ERROR "MPI is disabled but parallel HDF5 is detected.") - endif() + if(HDF5_IS_PARALLEL AND NOT ADIOS2_HAVE_MPI) + message(FATAL_ERROR "MPI is disabled but parallel HDF5 is detected.") endif() set(ADIOS2_HAVE_HDF5 TRUE) endif() diff --git a/examples/heatTransfer/write/CMakeLists.txt b/examples/heatTransfer/write/CMakeLists.txt index cab9204b1c..dfa76e0732 100644 --- a/examples/heatTransfer/write/CMakeLists.txt +++ b/examples/heatTransfer/write/CMakeLists.txt @@ -37,18 +37,20 @@ if(ADIOS2_HAVE_HDF5) ${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT} ) - add_executable(heatTransfer_write_ph5 - main.cpp - HeatTransfer.cpp - Settings.cpp - IO_ph5.cpp - ) - target_include_directories(heatTransfer_write_ph5 - PRIVATE ${HDF5_C_INCLUDE_DIRS} - ) - target_link_libraries(heatTransfer_write_ph5 - ${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT} - ) + if(HDF5_IS_PARALLEL) + add_executable(heatTransfer_write_ph5 + main.cpp + HeatTransfer.cpp + Settings.cpp + IO_ph5.cpp + ) + target_include_directories(heatTransfer_write_ph5 + PRIVATE ${HDF5_C_INCLUDE_DIRS} + ) + target_link_libraries(heatTransfer_write_ph5 + ${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT} + ) + endif() if(NOT (HDF5_VERSION VERSION_LESS 1.11)) add_executable(heatTransfer_write_h5mixer diff --git a/source/utils/adios_iotest/CMakeLists.txt b/source/utils/adios_iotest/CMakeLists.txt index 3ab3cdad4e..5fb7a3b086 100644 --- a/source/utils/adios_iotest/CMakeLists.txt +++ b/source/utils/adios_iotest/CMakeLists.txt @@ -13,7 +13,8 @@ if(WIN32) target_link_libraries(adios_iotest getopt) endif() -if(ADIOS2_HAVE_HDF5) +if(ADIOS2_HAVE_HDF5 AND HDF5_IS_PARALLEL) + target_compile_definitions(adios_iotest PRIVATE ADIOS2_HAVE_HDF5_PARALLEL) if(HDF5_C_INCLUDE_DIRS) target_include_directories(adios_iotest PRIVATE ${HDF5_C_INCLUDE_DIRS}) else() diff --git a/source/utils/adios_iotest/ioGroup.cpp b/source/utils/adios_iotest/ioGroup.cpp index 6c4f0579a3..5e025e565b 100644 --- a/source/utils/adios_iotest/ioGroup.cpp +++ b/source/utils/adios_iotest/ioGroup.cpp @@ -7,7 +7,7 @@ #include "ioGroup.h" #include "adios2/common/ADIOSConfig.h" -#ifdef ADIOS2_HAVE_HDF5 +#ifdef ADIOS2_HAVE_HDF5_PARALLEL #include "hdf5.h" #endif @@ -20,7 +20,7 @@ std::shared_ptr createGroup(const std::string &name, IOLib iolib, case IOLib::ADIOS: gp = std::make_shared(name, adiosobj); break; -#ifdef ADIOS2_HAVE_HDF5 +#ifdef ADIOS2_HAVE_HDF5_PARALLEL case IOLib::HDF5: gp = std::make_shared(name); break; diff --git a/source/utils/adios_iotest/settings.cpp b/source/utils/adios_iotest/settings.cpp index 060bc9b231..3b0e997258 100644 --- a/source/utils/adios_iotest/settings.cpp +++ b/source/utils/adios_iotest/settings.cpp @@ -24,7 +24,7 @@ struct option options[] = {{"help", no_argument, NULL, 'h'}, {"strong-scaling", no_argument, NULL, 's'}, {"weak-scaling", no_argument, NULL, 'w'}, {"timer", no_argument, NULL, 't'}, -#ifdef ADIOS2_HAVE_HDF5 +#ifdef ADIOS2_HAVE_HDF5_PARALLEL {"hdf5", no_argument, NULL, 'H'}, #endif {NULL, 0, NULL, 0}}; @@ -53,7 +53,7 @@ void Settings::displayHelp() << " -s OR -w: strong or weak scaling. \n" << " Dimensions in config are treated accordingly\n" << " -x file ADIOS configuration XML file\n" -#ifdef ADIOS2_HAVE_HDF5 +#ifdef ADIOS2_HAVE_HDF5_PARALLEL << " --hdf5 Use native Parallel HDF5 instead of ADIOS for I/O\n" #endif << " -v increase verbosity\n" @@ -105,7 +105,7 @@ int Settings::processArgs(int argc, char *argv[]) displayHelp(); } return 1; -#ifdef ADIOS2_HAVE_HDF5 +#ifdef ADIOS2_HAVE_HDF5_PARALLEL case 'H': iolib = IOLib::HDF5; break; diff --git a/source/utils/adios_iotest/settings.h b/source/utils/adios_iotest/settings.h index 416e9de3cc..15d43cf941 100644 --- a/source/utils/adios_iotest/settings.h +++ b/source/utils/adios_iotest/settings.h @@ -22,7 +22,7 @@ enum class IOLib { ADIOS -#ifdef ADIOS2_HAVE_HDF5 +#ifdef ADIOS2_HAVE_HDF5_PARALLEL , HDF5 #endif diff --git a/source/utils/adios_iotest/stream.cpp b/source/utils/adios_iotest/stream.cpp index ececb6dc54..8081349177 100644 --- a/source/utils/adios_iotest/stream.cpp +++ b/source/utils/adios_iotest/stream.cpp @@ -10,7 +10,7 @@ #include "adiosStream.h" #include "stream.h" -#ifdef ADIOS2_HAVE_HDF5 +#ifdef ADIOS2_HAVE_HDF5_PARALLEL #include "hdf5Stream.h" #endif @@ -65,7 +65,7 @@ std::shared_ptr openStream(const std::string &streamName, sp = std::make_shared(s); break; } -#ifdef ADIOS2_HAVE_HDF5 +#ifdef ADIOS2_HAVE_HDF5_PARALLEL case IOLib::HDF5: { auto s = hdf5Stream(streamName, mode, comm); diff --git a/testing/adios2/engine/common/CMakeLists.txt b/testing/adios2/engine/common/CMakeLists.txt index 31e4292c9c..d65606281f 100644 --- a/testing/adios2/engine/common/CMakeLists.txt +++ b/testing/adios2/engine/common/CMakeLists.txt @@ -20,7 +20,7 @@ gtest_add_tests_helper(Common ${test_mpi} "" Engine. .File EXTRA_ARGS "File" "1" ) -if(ADIOS2_HAVE_HDF5) +if(ADIOS2_HAVE_HDF5 AND HDF5_IS_PARALLEL) gtest_add_tests_helper(Common ${test_mpi} "" Engine. .HDF5 EXTRA_ARGS "HDF5" "1" ) diff --git a/testing/adios2/engine/hdf5/CMakeLists.txt b/testing/adios2/engine/hdf5/CMakeLists.txt index 1a41311312..addce13ca7 100644 --- a/testing/adios2/engine/hdf5/CMakeLists.txt +++ b/testing/adios2/engine/hdf5/CMakeLists.txt @@ -3,18 +3,25 @@ # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -gtest_add_tests_helper(WriteReadAsStream ${test_mpi} HDF5 Engine.HDF5. "") -gtest_add_tests_helper(StreamWriteReadHighLevelAPI ${test_mpi} +if(ADIOS2_HAVE_MPI AND HDF5_IS_PARALLEL) + set(hdf5_mpi TRUE) + add_definitions(-DTEST_HDF5_MPI) +else() + set(hdf5_mpi FALSE) +endif() + +gtest_add_tests_helper(WriteReadAsStream ${hdf5_mpi} HDF5 Engine.HDF5. "") +gtest_add_tests_helper(StreamWriteReadHighLevelAPI ${hdf5_mpi} HDF5 Engine.HDF5. "" ) -gtest_add_tests_helper(WriteReadAttributesADIOS2 ${test_mpi} +gtest_add_tests_helper(WriteReadAttributesADIOS2 ${hdf5_mpi} HDF5 Engine.HDF5. "" ) -gtest_add_tests_helper(WriteMemorySelectionRead ${test_mpi} +gtest_add_tests_helper(WriteMemorySelectionRead ${hdf5_mpi} HDF5 Engine.HDF5. "" ) -gtest_add_tests_helper(NativeHDF5WriteRead ${test_mpi} "" Engine.HDF5. "") +gtest_add_tests_helper(NativeHDF5WriteRead ${hdf5_mpi} "" Engine.HDF5. "") if(HDF5_C_INCLUDE_DIRS) target_include_directories(Test.Engine.HDF5.NativeHDF5WriteRead PRIVATE ${HDF5_C_INCLUDE_DIRS} diff --git a/testing/adios2/engine/hdf5/TestHDF5StreamWriteReadHighLevelAPI.cpp b/testing/adios2/engine/hdf5/TestHDF5StreamWriteReadHighLevelAPI.cpp index 610300d52f..599c174246 100644 --- a/testing/adios2/engine/hdf5/TestHDF5StreamWriteReadHighLevelAPI.cpp +++ b/testing/adios2/engine/hdf5/TestHDF5StreamWriteReadHighLevelAPI.cpp @@ -39,14 +39,14 @@ TEST_F(StreamWriteReadHighLevelAPI_HDF5, ADIOS2H5writeRead1D8) // Number of steps const size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // write test data using H5 { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::fstream oStream(fname, adios2::fstream::out, MPI_COMM_WORLD, "HDF5"); #else @@ -101,7 +101,7 @@ TEST_F(StreamWriteReadHighLevelAPI_HDF5, ADIOS2H5writeRead1D8) adios2::fstream iStream; EXPECT_FALSE(iStream); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI iStream.open(fname, adios2::fstream::in, MPI_COMM_WORLD, "HDF5"); #else iStream.open(fname, adios2::fstream::in, "HDF5"); @@ -272,14 +272,14 @@ TEST_F(StreamWriteReadHighLevelAPI_HDF5, ADIOS2H5writeRead2D2x4) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // write test data using ADIOS2 { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::fstream oStream(fname, adios2::fstream::out, MPI_COMM_WORLD, "HDF5"); #else @@ -316,7 +316,7 @@ TEST_F(StreamWriteReadHighLevelAPI_HDF5, ADIOS2H5writeRead2D2x4) // READ { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::fstream iStream(fname, adios2::fstream::in, MPI_COMM_WORLD, "HDF5"); #else @@ -391,14 +391,14 @@ TEST_F(StreamWriteReadHighLevelAPI_HDF5, ADIOS2H5writeRead2D4x2) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // write test data using ADIOS2 { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::fstream oStream(fname, adios2::fstream::out, MPI_COMM_WORLD, "HDF5"); #else @@ -437,7 +437,7 @@ TEST_F(StreamWriteReadHighLevelAPI_HDF5, ADIOS2H5writeRead2D4x2) } { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::fstream iStream(fname, adios2::fstream::in, MPI_COMM_WORLD, "HDF5"); #else @@ -501,7 +501,7 @@ TEST_F(StreamWriteReadHighLevelAPI_HDF5, DoubleOpenException) const std::string fname("ADIOS2H5_hl_exception.h5"); { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::fstream oStream(fname, adios2::fstream::out, MPI_COMM_WORLD, "HDF5"); EXPECT_THROW(oStream.open("second", adios2::fstream::out, @@ -519,7 +519,7 @@ TEST_F(StreamWriteReadHighLevelAPI_HDF5, DoubleOpenException) int main(int argc, char **argv) { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Init(nullptr, nullptr); #endif @@ -527,7 +527,7 @@ int main(int argc, char **argv) ::testing::InitGoogleTest(&argc, argv); result = RUN_ALL_TESTS(); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Finalize(); #endif diff --git a/testing/adios2/engine/hdf5/TestHDF5WriteMemorySelectionRead.cpp b/testing/adios2/engine/hdf5/TestHDF5WriteMemorySelectionRead.cpp index bffc661060..a44d251267 100644 --- a/testing/adios2/engine/hdf5/TestHDF5WriteMemorySelectionRead.cpp +++ b/testing/adios2/engine/hdf5/TestHDF5WriteMemorySelectionRead.cpp @@ -249,12 +249,12 @@ void HDF5Steps1D(const size_t ghostCells) // Number of steps const size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -331,7 +331,7 @@ void HDF5Steps1D(const size_t ghostCells) } h5Writer.Close(); } -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Barrier(MPI_COMM_WORLD); #endif // Reader @@ -485,12 +485,12 @@ void HDF5Steps2D4x2(const size_t ghostCells) // Number of steps const size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -567,7 +567,7 @@ void HDF5Steps2D4x2(const size_t ghostCells) } h5Writer.Close(); } -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Barrier(MPI_COMM_WORLD); #endif // Reader @@ -733,12 +733,12 @@ void HDF5Steps3D8x2x4(const size_t ghostCells) // Number of steps const size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -825,7 +825,7 @@ void HDF5Steps3D8x2x4(const size_t ghostCells) } h5Writer.Close(); } -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Barrier(MPI_COMM_WORLD); #endif // Reader @@ -1042,7 +1042,7 @@ INSTANTIATE_TEST_CASE_P(ghostCells, HDF5WriteMemSelReadVector, int main(int argc, char **argv) { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Init(nullptr, nullptr); #endif @@ -1058,7 +1058,7 @@ int main(int argc, char **argv) result = RUN_ALL_TESTS(); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Finalize(); #endif diff --git a/testing/adios2/engine/hdf5/TestHDF5WriteReadAsStream.cpp b/testing/adios2/engine/hdf5/TestHDF5WriteReadAsStream.cpp index 8f67dfeb64..04e6109c02 100644 --- a/testing/adios2/engine/hdf5/TestHDF5WriteReadAsStream.cpp +++ b/testing/adios2/engine/hdf5/TestHDF5WriteReadAsStream.cpp @@ -35,14 +35,14 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead1D8) // Number of steps const size_t NSteps = 5; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using HDF5 -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -384,14 +384,14 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead2D2x4) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using ADIOS2 -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -632,14 +632,14 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ADIOS2HDF5WriteRead2D4x2) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using ADIOS2 -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -884,14 +884,14 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ReaderWriterDefineVariable) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using ADIOS2 -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -921,7 +921,7 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ReaderWriterDefineVariable) h5Writer.Close(); } -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Barrier(MPI_COMM_WORLD); #endif { @@ -954,7 +954,7 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ReaderWriterDefineVariable) writer.Close(); reader.Close(); } -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Barrier(MPI_COMM_WORLD); #endif { @@ -975,7 +975,7 @@ TEST_F(HDF5WriteReadAsStreamTestADIOS2, ReaderWriterDefineVariable) int main(int argc, char **argv) { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Init(nullptr, nullptr); #endif @@ -983,7 +983,7 @@ int main(int argc, char **argv) ::testing::InitGoogleTest(&argc, argv); result = RUN_ALL_TESTS(); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Finalize(); #endif diff --git a/testing/adios2/engine/hdf5/TestHDF5WriteReadAttributesADIOS2.cpp b/testing/adios2/engine/hdf5/TestHDF5WriteReadAttributesADIOS2.cpp index 9630f95cb5..663537b18b 100644 --- a/testing/adios2/engine/hdf5/TestHDF5WriteReadAttributesADIOS2.cpp +++ b/testing/adios2/engine/hdf5/TestHDF5WriteReadAttributesADIOS2.cpp @@ -49,7 +49,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadSingleTypes) generateNewSmallTestData(m_TestData, 0, 0, 0); // Write test data using BP -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -190,7 +190,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypes) const std::string fName = "." + std::string(&adios2::PathSeparator, 1) + "ADIOS2BPWriteAttributeReadArrayTypes.h5"; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI int mpiRank = 0, mpiSize = 1; MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); @@ -216,7 +216,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypes) generateNewSmallTestData(m_TestData, 0, 0, 0); // Write test data using BP -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -391,7 +391,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, BPWriteReadSingleTypesVar) const std::string separator = "/"; // Write test data using BP -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -538,7 +538,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypesVar) const std::string fName = "." + std::string(&adios2::PathSeparator, 1) + "BPWriteAttributeReadArrayTypesVar.h5"; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI int mpiRank = 0, mpiSize = 1; MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); @@ -563,7 +563,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypesVar) generateNewSmallTestData(m_TestData, 0, 0, 0); // Write test data using BP -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -724,7 +724,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypesVar) int main(int argc, char **argv) { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Init(nullptr, nullptr); #endif @@ -732,7 +732,7 @@ int main(int argc, char **argv) ::testing::InitGoogleTest(&argc, argv); result = RUN_ALL_TESTS(); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Finalize(); #endif diff --git a/testing/adios2/engine/hdf5/TestNativeHDF5WriteRead.cpp b/testing/adios2/engine/hdf5/TestNativeHDF5WriteRead.cpp index 6b2238a95d..3713322ee4 100644 --- a/testing/adios2/engine/hdf5/TestNativeHDF5WriteRead.cpp +++ b/testing/adios2/engine/hdf5/TestNativeHDF5WriteRead.cpp @@ -54,7 +54,7 @@ class HDF5NativeReader class HDF5NativeWriter { public: -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI HDF5NativeWriter(const std::string &fileName, MPI_Comm comm); #else HDF5NativeWriter(const std::string &fileName); @@ -85,7 +85,7 @@ class HDF5NativeWriter hid_t m_FileId; hid_t m_GroupId; }; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI HDF5NativeWriter::HDF5NativeWriter(const std::string &fileName, MPI_Comm comm) #else HDF5NativeWriter::HDF5NativeWriter(const std::string &fileName) @@ -94,7 +94,7 @@ HDF5NativeWriter::HDF5NativeWriter(const std::string &fileName) { m_FilePropertyListId = H5Pcreate(H5P_FILE_ACCESS); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI H5Pset_fapl_mpio(m_FilePropertyListId, comm, MPI_INFO_NULL); #endif @@ -182,7 +182,7 @@ void HDF5NativeWriter::CreateAndStoreScalar(std::string const &variableName, // write scalar hid_t filespaceID = H5Screate(H5S_SCALAR); hid_t plistID = H5Pcreate(H5P_DATASET_XFER); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI H5Pset_dxpl_mpio(plistID, H5FD_MPIO_COLLECTIVE); #endif @@ -252,7 +252,7 @@ void HDF5NativeWriter::CreateAndStoreVar(std::string const &variableName, // Create property list for collective dataset write. hid_t plistID = H5Pcreate(H5P_DATASET_XFER); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI H5Pset_dxpl_mpio(plistID, H5FD_MPIO_COLLECTIVE); #endif herr_t status = @@ -288,7 +288,7 @@ HDF5NativeReader::HDF5NativeReader(const std::string fileName) { m_FilePropertyListId = H5Pcreate(H5P_FILE_ACCESS); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI // read a file collectively H5Pset_fapl_mpio(m_FilePropertyListId, MPI_COMM_WORLD, MPI_INFO_NULL); #endif @@ -493,14 +493,14 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read1D8) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using ADIOS2 -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -734,14 +734,14 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteADIOS2HDF5Read1D8) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using ADIOS2 -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -1017,7 +1017,7 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read1D8) const std::size_t NSteps = 3; { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); @@ -1077,7 +1077,7 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read1D8) // Write test data using ADIOS2 -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -1267,14 +1267,14 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D2x4) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using ADIOS2 { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -1530,12 +1530,12 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteADIOS2HDF5Read2D2x4) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -1829,7 +1829,7 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read2D2x4) const std::size_t NSteps = 3; { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); @@ -1886,12 +1886,12 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read2D2x4) } { // read back -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -2087,14 +2087,14 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D4x2) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using ADIOS2 { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -2347,12 +2347,12 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteADIOS2HDF5Read2D4x2) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -2642,7 +2642,7 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read2D4x2) const std::size_t NSteps = 3; { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); @@ -2699,12 +2699,12 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read2D4x2) } { // read back -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -2893,14 +2893,14 @@ TEST_F(HDF5WriteReadTest, /*DISABLE_*/ ATTRTESTADIOS2vsHDF5) // Number of steps const std::size_t NSteps = 3; -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); #endif // Write test data using ADIOS2 -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); #else adios2::ADIOS adios(true); @@ -3150,7 +3150,7 @@ TEST_F(HDF5WriteReadTest, /*DISABLE_*/ ATTRTESTADIOS2vsHDF5) int main(int argc, char **argv) { -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Init(nullptr, nullptr); #endif @@ -3158,7 +3158,7 @@ int main(int argc, char **argv) ::testing::InitGoogleTest(&argc, argv); result = RUN_ALL_TESTS(); -#ifdef ADIOS2_HAVE_MPI +#ifdef TEST_HDF5_MPI MPI_Finalize(); #endif diff --git a/testing/adios2/engine/staging-common/CMakeLists.txt b/testing/adios2/engine/staging-common/CMakeLists.txt index 668dd48f72..86ba36b9bd 100644 --- a/testing/adios2/engine/staging-common/CMakeLists.txt +++ b/testing/adios2/engine/staging-common/CMakeLists.txt @@ -291,7 +291,7 @@ endif() # # Setup tests for HDF5 engine # -if(NOT MSVC AND ADIOS2_HAVE_HDF5) # not on windows and only if we have HDF5 +if(NOT MSVC AND ADIOS2_HAVE_HDF5 AND (NOT ADIOS2_HAVE_MPI OR HDF5_IS_PARALLEL)) # not on windows and only if we have HDF5 set (HDF5_TESTS ${ALL_SIMPLE_TESTS}) # Delayed reader not worth testing on file engines list (FILTER HDF5_TESTS EXCLUDE REGEX "DelayedReader") diff --git a/testing/utils/iotest/CMakeLists.txt b/testing/utils/iotest/CMakeLists.txt index 7171697b12..6813209484 100644 --- a/testing/utils/iotest/CMakeLists.txt +++ b/testing/utils/iotest/CMakeLists.txt @@ -68,7 +68,7 @@ SetupTestPipeline( FALSE ) -if(ADIOS2_HAVE_HDF5) +if(ADIOS2_HAVE_HDF5 AND HDF5_IS_PARALLEL) #------------------------------------------ # Pipe2 HDF5 Write #------------------------------------------