CUDA compiler unknown on 9.2
With CMake 3.14.5, and my CMakeLists.txt only containing project(test LANGUAGES CXX CUDA)
, upon running cmake, I get
-- The CXX compiler identification is GNU 5.4.0
-- The CUDA compiler identification is unknown
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/bin/nvcc
-- Check for working CUDA compiler: /usr/bin/nvcc -- broken
CMake Error at /usr/share/cmake-3.14/Modules/CMakeTestCUDACompiler.cmake:46 (message):
The CUDA compiler
"/usr/bin/nvcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/emmett/code/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_72b91/fast
/usr/bin/make -f CMakeFiles/cmTC_72b91.dir/build.make CMakeFiles/cmTC_72b91.dir/build
make[1]: Entering directory '/home/emmett/code/CMakeFiles/CMakeTmp'
Building CUDA object CMakeFiles/cmTC_72b91.dir/main.cu.o
/usr/bin/nvcc -x cu -c /home/emmett/code/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_72b91.dir/main.cu.o
ptxas fatal : Value 'sm_20' is not defined for option 'gpu-name'
CMakeFiles/cmTC_72b91.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_72b91.dir/main.cu.o' failed
make[1]: *** [CMakeFiles/cmTC_72b91.dir/main.cu.o] Error 255
make[1]: Leaving directory '/home/emmett/code/CMakeFiles/CMakeTmp'
Makefile:121: recipe for target 'cmTC_72b91/fast' failed
make: *** [cmTC_72b91/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
The sm_20 problem is because CUDA 9.2 no longer supports sm_20, but I think the root cause is that CUDA compiler is unknown. I'm on Ubuntu 16.04.6, I have sudo apt-get install cuda-9-2
, and nvcc --version
returns
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Tue_Jun_12_23:07:04_CDT_2018
Cuda compilation tools, release 9.2, V9.2.148
I've tried various reinstallations of CUDA and restarts to no avail. What's really annoying is that it used to work, in fact I have a project that I can still update and build, but if I remove its build directory it starts giving me this error now. Probably started after some Ubuntu system update...
Any ideas on how I can get this system up and running again? Or tell what CMake is missing?