Skip to content
Snippets Groups Projects
Commit 79bebc0f authored by Rafael Ravedutti's avatar Rafael Ravedutti
Browse files

Fix CUDA compilation in CMakeLists.txt


Signed-off-by: default avatarRafael Ravedutti <rafaelravedutti@gmail.com>
parent f6891449
Branches
Tags
No related merge requests found
...@@ -12,6 +12,12 @@ if(NOT TESTCASE) ...@@ -12,6 +12,12 @@ if(NOT TESTCASE)
set(TESTCASE md CACHE STRING "Select the testcase from the following: md, dem" FORCE) set(TESTCASE md CACHE STRING "Select the testcase from the following: md, dem" FORCE)
endif() endif()
set(CUDA_ARCH ${CUDA_ARCH} CACHE STRING "CUDA_ARCH environment variable must be set.")
if(NOT CUDA_ARCH)
set(CUDA_ARCH sm_80)
endif()
string(TOLOWER "${TESTCASE}" TESTCASE) string(TOLOWER "${TESTCASE}" TESTCASE)
message(STATUS "Selected testcase: ${TESTCASE}") message(STATUS "Selected testcase: ${TESTCASE}")
...@@ -63,6 +69,7 @@ add_dependencies(${CPU_BIN} gen_cpu) ...@@ -63,6 +69,7 @@ add_dependencies(${CPU_BIN} gen_cpu)
if(COMPILE_CUDA) if(COMPILE_CUDA)
find_package(CUDA REQUIRED) find_package(CUDA REQUIRED)
enable_language(CUDA)
if(USE_WALBERLA) if(USE_WALBERLA)
waLBerla_add_executable( waLBerla_add_executable(
...@@ -81,6 +88,14 @@ if(COMPILE_CUDA) ...@@ -81,6 +88,14 @@ if(COMPILE_CUDA)
target_compile_features(runtime_gpu PUBLIC cxx_std_11) target_compile_features(runtime_gpu PUBLIC cxx_std_11)
set_target_properties(runtime_gpu PROPERTIES CUDA_SEPARABLE_COMPILATION ON) set_target_properties(runtime_gpu PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_compile_options(${GPU_BIN} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-arch=${CUDA_ARCH}>)
target_include_directories(${GPU_BIN} PRIVATE ${CUDA_INCLUDE_DIRS})
set_target_properties(${GPU_BIN} PROPERTIES CUDA_ARCHITECTURES ${CUDA_ARCH})
target_compile_options(runtime_gpu PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-arch=${CUDA_ARCH}>)
target_include_directories(runtime_gpu PRIVATE ${CUDA_INCLUDE_DIRS})
set_target_properties(runtime_gpu PROPERTIES CUDA_ARCHITECTURES ${CUDA_ARCH})
#set_property(TARGET ${GPU_BIN} PROPERTY CUDA_SEPARABLE_COMPILATION ON) #set_property(TARGET ${GPU_BIN} PROPERTY CUDA_SEPARABLE_COMPILATION ON)
#target_link_libraries(${GPU_BIN} runtime_gpu) #target_link_libraries(${GPU_BIN} runtime_gpu)
......
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