Skip to content

Commit

Permalink
create a mpi addon oject lib for mpi errors
Browse files Browse the repository at this point in the history
  • Loading branch information
balos1 committed Nov 6, 2023
1 parent a6f9327 commit d74c002
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/nvector/manyvector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if(BUILD_NVECTOR_MANYVECTOR)
nvector
OBJECT_LIBRARIES
sundials_generic_obj
sundials_core_mpi_addons_obj
OUTPUT_NAME
sundials_nvecmanyvector
VERSION
Expand Down
1 change: 1 addition & 0 deletions src/nvector/mpiplusx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sundials_add_library(sundials_nvecmpiplusx
nvector
OBJECT_LIBRARIES
sundials_generic_obj
sundials_core_mpi_addons_obj
sundials_nvecmpimanyvector_obj
OUTPUT_NAME
sundials_nvecmpiplusx
Expand Down
1 change: 1 addition & 0 deletions src/nvector/parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sundials_add_library(sundials_nvecparallel
nvector
OBJECT_LIBRARIES
sundials_generic_obj
sundials_core_mpi_addons_obj
OUTPUT_NAME
sundials_nvecparallel
VERSION
Expand Down
1 change: 1 addition & 0 deletions src/nvector/parhyp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sundials_add_library(sundials_nvecparhyp
nvector
OBJECT_LIBRARIES
sundials_generic_obj
sundials_core_mpi_addons_obj
LINK_LIBRARIES
PUBLIC
SUNDIALS::HYPRE
Expand Down
1 change: 1 addition & 0 deletions src/nvector/petsc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sundials_add_library(sundials_nvecpetsc
nvector
OBJECT_LIBRARIES
sundials_generic_obj
sundials_core_mpi_addons_obj
LINK_LIBRARIES
PUBLIC SUNDIALS::PETSC
OUTPUT_NAME
Expand Down
1 change: 1 addition & 0 deletions src/nvector/trilinos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sundials_add_library(sundials_nvectrilinos
nvector
OBJECT_LIBRARIES
sundials_generic_obj
sundials_core_mpi_addons_obj
LINK_LIBRARIES
PUBLIC SUNDIALS::TRILINOS
OUTPUT_NAME
Expand Down
29 changes: 24 additions & 5 deletions src/sundials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,24 @@ endif()
# Add prefix with complete path to the source files
add_prefix(${SUNDIALS_SOURCE_DIR}/src/sundials/ sundials_SOURCES)

if(ENABLE_MPI AND MPI_C_FOUND)
# Create a library out of the generic sundials modules
sundials_add_library(sundials_core_mpi_addons
SOURCES
sundials_mpi_errors.c
HEADERS
${SUNDIALS_SOURCE_DIR}/include/sundials/sundials_mpi_errors.h
INCLUDE_SUBDIR
sundials
INCLUDE_DIRECTORIES
PUBLIC ${MPI_C_INCLUDE_DIRS}
LINK_LIBRARIES
PUBLIC ${MPI_C_LIBRARIES}
OBJECT_LIB_ONLY
)
endif()

if(SUNDIALS_BUILD_WITH_PROFILING OR SUNDIALS_LOGGING_ENABLE_MPI)
if(ENABLE_MPI AND MPI_C_FOUND)
# Workaround bug in CMake < 3.17.3 when using MPI::MPI_CXX and CUDA
set(_include_mpi_if_needed PUBLIC ${MPI_C_INCLUDE_DIRS})
set(_link_mpi_if_needed PUBLIC ${MPI_C_LIBRARIES})
endif()
if(ENABLE_CALIPER)
set(_link_caliper_if_needed PUBLIC caliper)
endif()
Expand All @@ -121,6 +133,13 @@ if(SUNDIALS_BUILD_WITH_PROFILING OR SUNDIALS_LOGGING_ENABLE_MPI)
endif()
endif()

if(SUNDIALS_LOGGING_ENABLE_MPI)
if(ENABLE_MPI AND MPI_C_FOUND)
set(_include_mpi_if_needed PUBLIC ${MPI_C_INCLUDE_DIRS})
set(_link_mpi_if_needed PUBLIC ${MPI_C_LIBRARIES})
endif()
endif()

# Create a library out of the generic sundials modules
sundials_add_library(sundials_generic
SOURCES
Expand Down

0 comments on commit d74c002

Please sign in to comment.