From a753ca92f2a58bf07b76e884171750214641ae4a Mon Sep 17 00:00:00 2001 From: jpekkila Date: Sat, 30 May 2020 22:02:39 +0300 Subject: [PATCH] Made cmake handle MPI linking. Potentially a bad idea (usually better to use mpicc and mpicxx wrappers) --- CMakeLists.txt | 5 +++++ src/core/CMakeLists.txt | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59a371a..a5a514b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,11 @@ include_directories(src/common) # Common headers include_directories(${CMAKE_BINARY_DIR}) # DSL headers include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) # CUDA headers +if (MPI_ENABLED) + find_package(MPI REQUIRED) + include_directories(${MPI_CXX_INCLUDE_DIRS}) +endif() + ## Subdirectories add_subdirectory(src/utils) add_subdirectory(src/core/kernels) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 7d93fd2..757cbfe 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -6,9 +6,10 @@ target_link_libraries(astaroth_core astaroth_utils astaroth_kernels CUDA::cudart ## Options if (MPI_ENABLED) - find_package(MPI) - find_package(OpenMP) - target_link_libraries(astaroth_core MPI::MPI_CXX OpenMP::OpenMP_CXX) + #find_package(MPI REQUIRED) + #find_package(OpenMP) + #target_link_libraries(astaroth_core MPI::MPI_CXX OpenMP::OpenMP_CXX) + target_link_libraries(astaroth_core MPI::MPI_CXX) endif() if (MULTIGPU_ENABLED)