My system :
Ubuntu 20.04 , CUDA 12.3 , CMake 3.22.5 , RTX A2000.
Device 0: “NVIDIA RTX A2000 Laptop GPU”
CUDA Driver Version / Runtime Version 12.3 / 12.3
CUDA Capability Major/Minor version number: 8.6
…
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 12.3, CUDA Runtime Version = 12.3, NumDevs = 1
Result = PASS
$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Nov__3_17:16:49_PDT_2023
Cuda compilation tools, release 12.3, V12.3.103
Build cuda_12.3.r12.3/compiler.33492891_0
Background:
I downloaded the example of using CMake with CUDA that is found at :
This for me works fine, I can also write the following in CMakeLists and it works fine:
set(CMAKE_CUDA_COMPILER_WORKS 1)
set(CMAKE_CUDA_FLAGS “-gencode arch=compute_86,code=sm_86”)
project(cmake_cuda LANGUAGES CUDA)
add_executable(cmake_cuda
src/knn.cu)
set_target_properties(cmake_cuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(cmake_cuda PROPERTIES CUDA_ARCHITECTURES “86”)
install (TARGETS cmake_cuda)
Note that I am disabling the CUDA compiler test, which persistently wants to compile for sm_30 and triggers an error.
Problem:
Now the problem is when I go to build Ceres solver. This comes with a lengthy CMakeLists which includes a switch USE_CUDA. Surprisingly, it’s not as easy as that.
On the ‘cmake --build’ step, I get a message (which is not correct) :
nvcc fatal : Unsupported gpu architecture ‘compute_80’
I then decide to go a step further and compile for my actual architecture, which is compute_86.
Ceres has 2 CMakeLists – one in its root, one ‘internal’. Attached my versions.
My modifications to the outer Ceres CMakeLists look like :
set(CMAKE_CUDA_COMPILER_WORKS 1)
set(CMAKE_CUDA_FLAGS “-gencode arch=compute_86,code=sm_86”)
and my modifications to the inner one look like:
set(CMAKE_CUDA_COMPILER_WORKS 1)
set(CMAKE_CUDA_FLAGS “-gencode arch=compute_86,code=sm_86”)
…
add_library(ceres $<TARGET_OBJECTS:ceres_internal> ${CERES_LIBRARY_SOURCE})
set_target_properties(ceres PROPERTIES CUDA_ARCHITECTURES “86”)
…
Accordingly, I get
nvcc fatal : Unsupported gpu architecture ‘compute_86’
Ceres CMakeLists can be found in the repo at https://github.com/ceres-solver/ceres-solver and I downloaded this recently (December 2023).
In summary:
We know full well that the architecture 86 is supported, only CUDA 12.3 is installed. It works fine for a simple example build. For Ceres, CMake gives an error and says compute_86 is not supported
I realize that debugging this is probably not going to be easy. Any suggestions welcome.
Any suggestions to improve the question also welcome.