Commit 74efba3e authored by Philipp Fensch's avatar Philipp Fensch Committed by Niklas Eiling
Browse files

Adjusted CMake-Files

parent 8e4eb83a
......@@ -140,6 +140,8 @@ endif()
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_EXAMPLES "Build C++ examples" ON )
option(GET_GRID_DATA "Download grid data" ON )
# WITH_SPARSE and WITH_CUDA can be combined
option(WITH_SPARSE "Use sparse matrices in MNA-Solver" ON )
option(PYBIND "Build pybind module" OFF)
......@@ -155,7 +157,7 @@ cmake_dependent_option(WITH_RT "Enable real-time features" ON "
cmake_dependent_option(WITH_PYTHON "Enable Python support" ON "Python_FOUND" OFF)
cmake_dependent_option(WITH_CIM "Enable support for parsing CIM" ON "CIMpp_FOUND" OFF)
cmake_dependent_option(WITH_OPENMP "Enable OpenMP-based parallelisation" ON "OPENMP_FOUND" OFF)
cmake_dependent_option(WITH_CUDA "Enable CUDA-based parallelisation" OFF "CUDA_FOUND" OFF)
cmake_dependent_option(WITH_CUDA "Enable CUDA-based parallelisation" ON "CUDA_FOUND" OFF)
cmake_dependent_option(WITH_GRAPHVIZ "Enable Graphviz Graphs" ON "GRAPHVIZ_FOUND" OFF)
if(WITH_CUDA)
......
......@@ -54,12 +54,21 @@ if(WITH_SHMEM)
endif()
if(WITH_CUDA)
list(APPEND DPSIM_SOURCES
MNASolverGpuDense.cpp
)
list(APPEND DPSIM_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS} ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
list(APPEND DPSIM_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_cusolver_LIBRARY})
if(WITH_SPARSE)
list(APPEND DPSIM_SOURCES
MNASolverGpuSparse.cpp
)
list(APPEND DPSIM_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_cusparse_LIBRARY})
else()
list(APPEND DPSIM_SOURCES
MNASolverGpuDense.cpp
)
list(APPEND DPSIM_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_cusolver_LIBRARY})
endif()
endif()
if(WITH_OPENMP)
......
......@@ -41,7 +41,11 @@
#endif
#ifdef WITH_CUDA
#include <dpsim/MNASolverGpu.h>
#ifdef WITH_SPARSE
#include <dpsim/MNASolverGpuSparse.h>
#else
#include <dpsim/MNASolverGpuDense.h>
#endif
#endif
using namespace CPS;
......@@ -188,8 +192,13 @@ void Simulation::createMNASolver() {
else {
// Default case with precomputed system matrices for different configurations
#ifdef WITH_CUDA
solver = std::make_shared<MnaSolverGpu<VarType>>(
#ifdef WITH_SPARSE
solver = std::make_shared<MnaSolverGpuSparse<VarType>>(
mName + copySuffix, mDomain, mLogLevel);
#else
solver = std::make_shared<MnaSolverGpuDense<VarType>>(
mName + copySuffix, mDomain, mLogLevel);
#endif
#else
solver = std::make_shared<MnaSolver<VarType>>(
mName + copySuffix, mDomain, mLogLevel);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment