Skip to content

Commit

Permalink
Merge pull request #164 from sbastrakov/fix-nvccComputeCapability
Browse files Browse the repository at this point in the history
Choose the value for the -arch nvcc flag depending on CUDA version
  • Loading branch information
psychocoderHPC committed Sep 25, 2019
2 parents e2533d1 + 450c73d commit efd20bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ endif()
# CUDA
###############################################################################
find_package(CUDA REQUIRED)
set(CUDA_NVCC_FLAGS "-arch=sm_20;-use_fast_math;")
if(CUDA_VERSION VERSION_LESS 9.0)
set(COMPUTE_CAPABILITY "20")
else()
set(COMPUTE_CAPABILITY "30")
endif()
set(CUDA_NVCC_FLAGS "-arch=sm_${COMPUTE_CAPABILITY};-use_fast_math;")
set(CUDA_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CUDA_INCLUDE_DIRS})
cuda_include_directories(${CUDA_INCLUDE_DIRS})
Expand Down

0 comments on commit efd20bc

Please sign in to comment.