【问题标题】:nvcc fatal : Value 'sm_20' is not defined for option 'gpu-architecture'nvcc 致命:未为选项“gpu-architecture”定义值“sm_20”
【发布时间】:2018-05-19 16:04:36
【问题描述】:

我查看了很多页面,要么无法理解他们所说的内容,因为它们不清楚和/或我的知识还不够。

我正在尝试运行:

luarocks install https://raw.githubusercontent.com/qassemoquab/stnbhwd/master/stnbhwd-scm-1.rockspec

这样我就可以使用 GPU 加速在某些图像上运行 DenseCap。当我运行它时,我得到了这个错误:

$ luarocks install https://raw.githubusercontent.com/qassemoquab/stnbhwd/master/stnbhwd-scm-1.rockspec
Using https://raw.githubusercontent.com/qassemoquab/stnbhwd/master/stnbhwd-scm-1.rockspec... switching to 'build' mode
Cloning into 'stnbhwd'...
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 24 (delta 0), reused 14 (delta 0), pack-reused 0
Receiving objects: 100% (24/24), 19.42 KiB | 0 bytes/s, done.
Checking connectivity... done.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/tex/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1" && make

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- 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
-- Found Torch7 in /home/tex/torch/install
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp  
-- Compiling with OpenMP support
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA: /usr/local/cuda (found suitable version "9.0", minimum required is "5.5") 
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_stnbhwd-scm-1-4197/stnbhwd/build
Scanning dependencies of target stn
[ 25%] Building C object CMakeFiles/stn.dir/init.c.o
[ 50%] Linking C shared module libstn.so
[ 50%] Built target stn
[ 75%] Building NVCC (Device) object CMakeFiles/custn.dir/custn_generated_init.cu.o
nvcc fatal   : Value 'sm_20' is not defined for option 'gpu-architecture'
CMake Error at custn_generated_init.cu.o.cmake:207 (message):
  Error generating
  /tmp/luarocks_stnbhwd-scm-1-4197/stnbhwd/build/CMakeFiles/custn.dir//./custn_generated_init.cu.o


CMakeFiles/custn.dir/build.make:63: recipe for target 'CMakeFiles/custn.dir/custn_generated_init.cu.o' failed
make[2]: *** [CMakeFiles/custn.dir/custn_generated_init.cu.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/custn.dir/all' failed
make[1]: *** [CMakeFiles/custn.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Error: Build error: Failed building.

我可以luarocks install cutorchluarocks install cunnluarocks install cudnn 很好。

我在 GTX 1080ti 上运行 Ubuntu 16.04。

$ nvidia-smi
Tue Dec  5 16:25:42 2017       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.90                 Driver Version: 384.90                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:29:00.0  On |                  N/A |
|  0%   47C    P8    16W / 250W |    716MiB / 11169MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1128      G   /usr/lib/xorg/Xorg                           479MiB |
|    0      1782      G   compiz                                       234MiB |
+-----------------------------------------------------------------------------+

由于某种原因,当我运行 $ nvcc -V 时,我得到:

    The program 'nvcc' is currently not installed. You can install it by typing:
sudo apt install nvidia-cuda-toolkit

..这是我面临的另一个大问题。当我安装 nvcc 时,它会安装 Cuda 7.5 的工具包,但我有 Cuda 9.0。我使用来自Cuda's website 的.deb 文件安装了它。

$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree       
Reading state information... Done
cuda is already the newest version (9.0.176-1).
The following packages were automatically installed and are no longer required:
  libcublas7.5 libcudart7.5 libcufft7.5 libcufftw7.5 libcuinj64-7.5
  libcurand7.5 libcusolver7.5 libcusparse7.5 libnppc7.5 libnppi7.5 libnpps7.5
  libnvblas7.5 libnvrtc7.5 libnvtoolsext1 libnvvm3 libthrust-dev libvdpau-dev
  nvidia-cuda-dev nvidia-cuda-doc nvidia-cuda-gdb nvidia-opencl-dev
  nvidia-profiler nvidia-visual-profiler opencl-headers
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 222 not upgraded.

老实说,我希望我需要安装 nvcc,但就像我说的,它安装了错误的版本,我终生无法弄清楚如何为正确的版本安装它,我真的很困惑为什么我得到这个错误现在即使我已经安装了 cutorch、cudnn 和 cunn 就好了。任何帮助表示赞赏...

谢谢

【问题讨论】:

  • 这不是为错误的版本安装nvcc。您的安装输出表明您已经安装了 CUDA 9,并且您有一些来自 CUDA 7.5 的旧垃圾,它可以为您自动删除。你找不到nvcc,因为你没有正确遵循linux安装指南中的安装说明,即你应该在安装CUDA 9之后设置你的PATH环境变量。给出的答案描述了该怎么做关于sm_20,CUDA 9 不支持它并且无论如何都不匹配您的 GPU。

标签: cuda nvidia torch nvcc luarocks


【解决方案1】:

尝试将代码架构(例如sm_20)更改为您尝试安装的stnbhwd 的CMakeLists.txt 中的某个更高版本。

发件人:

IF (CUDA_FOUND)
   LIST(APPEND CUDA_NVCC_FLAGS "-arch=sm_20")

到:

IF (CUDA_FOUND)
   LIST(APPEND CUDA_NVCC_FLAGS "-arch=sm_30")

【讨论】:

  • 你能看看this吗?
  • 上述建议是正确的——为了更快地找到,它是 CMakeLists.txt 中的第 55 行
【解决方案2】:

正如你所说:

但我有 Cuda 9.0

Cuda 9.0 不支持 SM_20 架构 (more info)。

你有相当新的 gpu:

我在 GTX 1080ti 上运行 Ubuntu 16.04。

它基于 Pascal 架构 (SM_60)。所以你可能不需要对 SM_20 架构的支持。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-02
    • 1970-01-01
    • 2019-08-02
    • 2021-09-08
    • 2021-02-14
    • 2021-12-20
    • 1970-01-01
    • 2012-03-08
    相关资源
    最近更新 更多