Added out-of-the-box support for MPI (though not enabled by default). Previously the user had to pass mpicxx explicitly as the cmake compiler in order to compile MPI code, but this was bad practice and it's better to let cmake handle the include and compilation flags.

This commit is contained in:
jpekkila
2020-01-28 15:59:20 +02:00
parent 85d4de24e3
commit 6dfe3ed4d6
2 changed files with 11 additions and 8 deletions

View File

@@ -70,14 +70,6 @@ endif ()
add_definitions(-DAC_DEFAULT_CONFIG="${CMAKE_SOURCE_DIR}/config/astaroth.conf")
if (MULTIGPU_ENABLED) # Deprecated
add_definitions(-DAC_MULTIGPU_ENABLED=1)
endif ()
if (MPI_ENABLED)
add_definitions(-DAC_MPI_ENABLED=1)
endif()
## Includes
include_directories(include) # Library headers
include_directories(src/common) # Common headers

View File

@@ -1,3 +1,14 @@
## Astaroth Core
add_library(astaroth_core STATIC device.cc node.cc astaroth.cc)
target_link_libraries(astaroth_core astaroth_utils astaroth_kernels cudart)
## Options
if (MPI_ENABLED)
find_package(MPI)
target_link_libraries(astaroth_core MPI::MPI_CXX)
target_compile_definitions(astaroth_core PRIVATE -DAC_MPI_ENABLED=1)
endif()
if (MULTIGPU_ENABLED)
target_compile_definitions(astaroth_core PRIVATE -DAC_MULTIGPU_ENABLED=1)
endif ()