Skip to content

Commit

Permalink
Remove hard coding of cuda_architectures (#52)
Browse files Browse the repository at this point in the history
* Remove hard coding of cmake_cuda_architectures.

* Add EXAWIND_CUDA_ARCH variable.
  • Loading branch information
jrood-nrel authored Jul 31, 2023
1 parent 20610d1 commit b984950
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
project(exawind CXX C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(exawind-utils)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand All @@ -18,6 +17,7 @@ option(EXAWIND_ENABLE_UMPIRE "Enable Umpire GPU memory pools" OFF)
if(EXAWIND_ENABLE_CUDA)
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
set(EXAWIND_CUDA_ARCH "70" CACHE STRING "CUDA architecture (Use 'Auto' for automatic detection)")
endif()

if(EXAWIND_ENABLE_ROCM)
Expand Down Expand Up @@ -70,6 +70,7 @@ add_executable(${EXAWIND_EXE_NAME})
add_subdirectory(app/exawind)

if(EXAWIND_ENABLE_CUDA)
include(exawind-utils)
set(ewtargets "${EXAWIND_LIB_NAME};${EXAWIND_EXE_NAME}")
foreach(tgt IN LISTS ewtargets)
set_cuda_build_properties(${tgt})
Expand Down
2 changes: 1 addition & 1 deletion cmake/exawind-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function(set_cuda_build_properties target)
list(FILTER _tgt_src INCLUDE REGEX "\\.cpp")
set_source_files_properties(${_tgt_src} PROPERTIES LANGUAGE CUDA)
set_target_properties(${target} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(${target} PROPERTIES CUDA_ARCHITECTURES "70")
set_target_properties(${target} PROPERTIES CUDA_ARCHITECTURES "${EXAWIND_CUDA_ARCH")
set_target_properties(${target} PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
#set_target_properties(${target} PROPERTIES LINKER_LANGUAGE CUDA)
endfunction(set_cuda_build_properties)

0 comments on commit b984950

Please sign in to comment.