I am configuring the project using CMakeLists.txt generated nvcc compile options for gencode, it contains almost all the arch options like the below.
-gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90
I want only -gencode arch=compute_80,code=sm_80 How can I prevent adding other options?
My CMakeLists.txt is like the below
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(MyCudaProject LANGUAGES CXX CUDA)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
file(GLOB_RECURSE ALL_SOURCE_FILES "src/*.cpp" "src/*.cu")
enable_language(CUDA)
include_directories("${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
include_directories(
${CUDA_INCLUDE_DIRS}
"${PROJECT_SOURCE_DIR}/src"
)
add_executable(cuda_app ${ALL_SOURCE_FILES})
target_include_directories(cuda_app PRIVATE
${CUDA_INCLUDE_DIRS}
"${PROJECT_SOURCE_DIR}/src"
)
target_link_libraries(cuda_app PRIVATE ${CUDA_LIBRARIES})
target_include_directories(cuda_app PRIVATE ${CUDA_INCLUDE_DIRS})
$ cmake --version cmake version 3.24.1
I tried to force the CUDA_NVCC_FLAGS but it does not affect the compile options. ex> set(CUDA_NVCC_FLAGS "-DONNX_NAMESPACE=onnx_c2 -gencode arch=compute_80,code=sm_80 -Xcudafe
I exected only -gencode arch=compute_80,code=sm_80.