我和那个人犯了同样的错误这个问题但是,当我尝试该解决方案(只需删除 compute_20 的目标)时,即使清理了项目后,仍然会出现错误。
具体来说:我试图按照以下步骤安装 caffe这些说明一步一步来。更具体地说,这是我的步骤。
我运行sudo cmake ..
,并得到以下信息:
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
注意:配置明确指出它正在编译为 sm_20 计算版本,但这不是我想要的。我搜索了我拥有的所有文件中的这个“sm_20”标记,结果全部为/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/
,这意味着它们不包含在 make 文件中。
我搜索了相同的文件以查找 compute_20 的提及,再次发现,唯一的提及位于上面的目录中。我删除它们,保持语法检查,然后运行,make -j"$(nproc)"
结果出现以下错误:
[ 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
如果在任何 makefile 中提到 compute_20 或 sm_20,这是什么原因造成的?
答案1
我已经通过修改/caffe/cmake/cuda.cmake
第 7 行解决了这个问题:
set(Caffe_known_gpu_archs "20 21(20) 30 35 50")
到:
set(Caffe_known_gpu_archs "30 35 50")
这改变了结果sudo cmake ..
:
-- NVIDIA CUDA:
-- Target GPU(s) : Auto
-- GPU arch(s) : sm_20 sm_21 sm_30 sm_35 sm_50
到:
-- NVIDIA CUDA:
-- Target GPU(s) : Auto
-- GPU arch(s) : sm_30 sm_35 sm_50
然后命令make -j"$(nproc)"
就成功运行了。