diff --git a/CMakeLists.txt b/CMakeLists.txt index d8e51a8cf..e8f3fd922 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,6 +152,11 @@ if (VTKm_ENABLE_HDF5_IO) find_package(HDF5 REQUIRED COMPONENTS HL) endif() +# If the linked HDF5 is parallel, we need to add the MPI include directory +# for its dependencies +vtkm_option(VTKm_HDF5_IS_PARALLEL "HDF5 library is parallel" OFF) +mark_as_advanced(VTKm_HDF5_IS_PARALLEL) + # VTK-m will turn on logging by default, but will set the default # logging level to WARN. This option should not be visible by default # in the GUI, as ERROR and WARN level logging should not interfere diff --git a/examples/contour_tree_distributed/CMakeLists.txt b/examples/contour_tree_distributed/CMakeLists.txt index ac605eeed..39079abca 100644 --- a/examples/contour_tree_distributed/CMakeLists.txt +++ b/examples/contour_tree_distributed/CMakeLists.txt @@ -64,7 +64,6 @@ if (VTKm_ENABLE_MPI AND TARGET vtkm::filter_scalar_topology AND TARGET vtkm::io) vtkm_add_target_information(ContourTree_Distributed MODIFY_CUDA_FLAGS DEVICE_SOURCES ContourTreeApp.cxx) - target_compile_definitions(ContourTree_Distributed PRIVATE "WITH_MPI") option (VTKM_EXAMPLE_CONTOURTREE_ENABLE_DEBUG_PRINT Off) mark_as_advanced(VTKM_EXAMPLE_CONTOURTREE_ENABLE_DEBUG_PRINT) @@ -77,18 +76,22 @@ if (VTKm_ENABLE_MPI AND TARGET vtkm::filter_scalar_topology AND TARGET vtkm::io) target_compile_definitions(ContourTree_Distributed PRIVATE "ENABLE_SET_NUM_THREADS") endif() if (VTKm_ENABLE_HDF5_IO) - target_compile_definitions(ContourTree_Distributed PRIVATE "ENABLE_HDFIO") - target_include_directories(ContourTree_Distributed PRIVATE ${HDF5_INCLUDE_DIR}) - target_link_libraries(ContourTree_Distributed ${HDF5_LIBRARIES}) + if(VTKm_HDF5_IS_PARALLEL) + target_compile_definitions(ContourTree_Distributed PRIVATE "ENABLE_HDFIO") + target_include_directories(ContourTree_Distributed PRIVATE ${HDF5_INCLUDE_DIR}) + target_link_libraries(ContourTree_Distributed ${HDF5_LIBRARIES}) + else() + message(FATAL_ERROR "Compiling distributed contour tree example with HDF5 support requires using a parallel HDF5 library and enabling VTKm_HDF5_IS_PARALLEL") + endif() endif () add_executable(TreeCompiler TreeCompilerApp.cxx) target_link_libraries(TreeCompiler vtkm::filter_core) - vtkm_add_target_information(TreeCompiler DROP_UNUSED_SYMBOLS) + vtkm_add_target_information(TreeCompiler DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS DEVICE_SOURCES TreeCompilerApp.cxx) add_executable(BranchCompiler BranchCompilerApp.cxx) target_link_libraries(BranchCompiler vtkm::filter_scalar_topology) - vtkm_add_target_information(BranchCompiler DROP_UNUSED_SYMBOLS) + vtkm_add_target_information(BranchCompiler DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS DEVICE_SOURCES BranchCompilerApp.cxx) configure_file(split_data_2d.py split_data_2d.py COPYONLY) configure_file(split_data_3d.py split_data_3d.py COPYONLY) diff --git a/examples/contour_tree_distributed/ContourTreeApp.cxx b/examples/contour_tree_distributed/ContourTreeApp.cxx index 293ce2dbb..cb73dcf14 100644 --- a/examples/contour_tree_distributed/ContourTreeApp.cxx +++ b/examples/contour_tree_distributed/ContourTreeApp.cxx @@ -99,7 +99,7 @@ VTKM_THIRDPARTY_POST_INCLUDE #include #include -using ValueType = vtkm::Float32; +using ValueType = vtkm::Float64; #define SINGLE_FILE_STDOUT_STDERR diff --git a/vtkm/io/CMakeLists.txt b/vtkm/io/CMakeLists.txt index 3aab645a5..7506ae684 100644 --- a/vtkm/io/CMakeLists.txt +++ b/vtkm/io/CMakeLists.txt @@ -88,6 +88,9 @@ vtkm_library( if (VTKm_ENABLE_HDF5_IO) target_include_directories(vtkm_io PRIVATE $) target_link_libraries(vtkm_io PRIVATE ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES}) + if (VTKm_HDF5_IS_PARALLEL) + target_link_libraries(vtkm_io PRIVATE MPI::MPI_CXX) + endif() endif() add_subdirectory(internal)