Cmake giving error "compute_20", even though the architecture is explicitly unstated in the make file

by tuskiomi   Last Updated August 14, 2019 19:02 PM

I have the same error as the person in this question, however, when I tried the solution (Just delete the target for compute_20), I'm still getting the error, even after cleaning the project.

To be specific: I'm trying to install caffe by following these instructions, step by step. Even more specifically, here is my steps.

I run sudo cmake .., and I get the following information:

CMake Warning (dev) at cmake/Misc.cmake:32 (set):
  implicitly converting 'BOOLEAN' to 'STRING' type.
Call Stack (most recent call first):
  CMakeLists.txt:24 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Boost: /usr/include (found suitable version "1.65.1", minimum required is "1.46") found components:  system thread filesystem chrono date_time atomic 
-- Found gflags  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found glog    (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
-- Found PROTOBUF Compiler: /usr/bin/protoc
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- Found lmdb    (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/liblmdb.so)
-- Found LevelDB (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libleveldb.so)
-- Found Snappy  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libsnappy.so)
-- CUDA detected: 10.1
-- Automatic GPU detection failed. Building for all known architectures.
-- Added CUDA NVCC flags for: sm_20 sm_21 sm_30 sm_35 sm_50
-- OpenCV found (/usr/share/OpenCV)
-- Found OpenBLAS libraries: /usr/lib/x86_64-linux-gnu/libopenblas.so
-- Found OpenBLAS include: /usr/include/x86_64-linux-gnu
-- NumPy ver. 1.11.0 found (include: /usr/local/lib/python2.7/dist-packages/numpy/core/include)
-- Found Boost: /usr/include (found suitable version "1.65.1", minimum required is "1.46") found components:  python 
-- Found NCCL (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libnccl.so)
-- Detected Doxygen OUTPUT_DIRECTORY: ./doxygen/
-- 
-- ******************* Caffe Configuration Summary *******************
-- General:
--   Version           :   0.15.14
--   Git               :   v0.15.14-16-g4b8d54d8-dirty
--   System            :   Linux
--   C++ compiler      :   /usr/bin/c++
--   Release CXX flags :   -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
--   Debug CXX flags   :   -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
--   Build type        :   Release
-- 
--   BUILD_SHARED_LIBS :   ON
--   BUILD_python      :   ON
--   BUILD_matlab      :   OFF
--   BUILD_docs        :   ON
--   CPU_ONLY          :   OFF
--   USE_OPENCV        :   ON
--   USE_LEVELDB       :   ON
--   USE_LMDB          :   ON
--   ALLOW_LMDB_NOLOCK :   OFF
-- 
-- Dependencies:
--   BLAS              :   Yes (open)
--   Boost             :   Yes (ver. 1.65)
--   glog              :   Yes
--   gflags            :   Yes
--   protobuf          :   Yes (ver. 3.0.0)
--   lmdb              :   Yes (ver. 0.9.21)
--   LevelDB           :   Yes (ver. 1.20)
--   Snappy            :   Yes (ver. ..)
--   OpenCV            :   Yes (ver. 3.2.0)
--   CUDA              :   Yes (ver. 10.1)
-- 
-- NVIDIA CUDA:
--   Target GPU(s)     :   Auto
--   GPU arch(s)       :   sm_20 sm_21 sm_30 sm_35 sm_50
--   cuDNN             :   Not found
--   NCCL              :   Yes
-- 
-- Python:
--   Interpreter       :   /usr/bin/python2.7 (ver. 2.7.15)
--   Libraries         :   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.15+)
--   NumPy             :   /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
-- 
-- Documentaion:
--   Doxygen           :   /usr/bin/doxygen (1.8.13)
--   config_file       :   /home/par/caffe/.Doxyfile
-- 
-- Install:
--   Install path      :   /home/par/caffe/build/install
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/par/caffe/build

NOTE: The configuration says specifically that it's compiling to sm_20 compute version, which is not what I want to do. I searched all files that I have for this "sm_20" token, and the results are all in /caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/, meaning that they are not contained within a make file.

I searched the same files for a compute_20 mention, and once again, the only mentions are in the directory above. I remove them, keeping syntax in check, and then run make -j"$(nproc)" to which I get the following error:

[  6%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_crop_layer.cu.o
nvcc fatal   : Unsupported gpu architecture 'compute_20'
CMake Error at cuda_compile_1_generated_math_functions.cu.o.Release.cmake:219 (message):
  Error generating
  /home/par/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/./cuda_compile_1_generated_math_functions.cu.o

What is the cause of this, if compute_20 nor sm_20 are mentioned in any makefile?



Answers 1


I've solved this issue by altering /caffe/cmake/cuda.cmake on line 7 from:
set(Caffe_known_gpu_archs "20 21(20) 30 35 50")

to:

set(Caffe_known_gpu_archs "30 35 50")

This changed the result of sudo cmake .. to change from:

-- NVIDIA CUDA:
--   Target GPU(s)     :   Auto
--   GPU arch(s)       :   sm_20 sm_21 sm_30 sm_35 sm_50

to:

-- NVIDIA CUDA:
--   Target GPU(s)     :   Auto
--   GPU arch(s)       :   sm_30 sm_35 sm_50

The command make -j"$(nproc)" then ran successfully.

tuskiomi
tuskiomi
August 14, 2019 18:35 PM

Related Questions



Error on make caffe

Updated February 13, 2018 13:02 PM



Ubuntu can not run caffe model in multigpu mode

Updated December 10, 2017 11:02 AM