有谁能帮我一下吗?提前谢谢了。
我尝试为我的程序制作 Makefile(通常我在带有 cuda 7.5 的 ubuntu 16.04 上做得很好)但这次,我遇到了以下问题:
nvcc -O3 -m64 -arch=sm_20 -I/usr/local/include -I/usr/local/cuda/include -I/usr/include/gdal -c src/cuda_kde.cu -o obj/cuda_kde.o
nvcc fatal : Value 'sm_20' is not defined for option 'gpu-architecture'
Makefile:91: recipe for target 'obj/cuda_kde.o' failed
make: *** [obj/cuda_kde.o] Error 1"
有人说我应该尝试将 -arch=sm_20 更改为该值,或者只是将值更改为 30 或更高,但我不知道该怎么做。有人能帮我吗?谢谢!
我的计算机系统如下。
$ uname -a
Linux fankao 4.18.0-25-generic #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -crid
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
$ dpkg -l | grep -i nvidia
ii libnvidia-cfg1-418:amd64 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA binary OpenGL/GLX configuration library
ii libnvidia-common-418 418.56-0ubuntu0~gpu18.04.1 all Shared files used by the NVIDIA libraries
rc libnvidia-compute-390:amd64 390.116-0ubuntu0.18.04.1 amd64 NVIDIA libcompute package
rc libnvidia-compute-390:i386 390.116-0ubuntu0.18.04.1 i386 NVIDIA libcompute package
ii libnvidia-compute-418:amd64 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA libcompute package
ii libnvidia-compute-418:i386 418.56-0ubuntu0~gpu18.04.1 i386 NVIDIA libcompute package
rc libnvidia-compute-430:amd64 430.26-0ubuntu0~gpu18.04.1 amd64 NVIDIA libcompute package
ii libnvidia-decode-418:amd64 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA Video Decoding runtime libraries
ii libnvidia-decode-418:i386 418.56-0ubuntu0~gpu18.04.1 i386 NVIDIA Video Decoding runtime libraries
ii libnvidia-encode-418:amd64 418.56-0ubuntu0~gpu18.04.1 amd64 NVENC Video Encoding runtime library
ii libnvidia-encode-418:i386 418.56-0ubuntu0~gpu18.04.1 i386 NVENC Video Encoding runtime library
ii libnvidia-fbc1-418:amd64 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA OpenGL-based Framebuffer Capture runtime library
ii libnvidia-fbc1-418:i386 418.56-0ubuntu0~gpu18.04.1 i386 NVIDIA OpenGL-based Framebuffer Capture runtime library
ii libnvidia-gl-418:amd64 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii libnvidia-gl-418:i386 418.56-0ubuntu0~gpu18.04.1 i386 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii libnvidia-ifr1-418:amd64 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA OpenGL-based Inband Frame Readback runtime library
ii libnvidia-ifr1-418:i386 418.56-0ubuntu0~gpu18.04.1 i386 NVIDIA OpenGL-based Inband Frame Readback runtime library
ii nvidia-compute-utils-418 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA compute utilities
ii nvidia-dkms-418 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA DKMS package
ii nvidia-driver-418 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA driver metapackage
ii nvidia-kernel-common-418 418.56-0ubuntu0~gpu18.04.1 amd64 Shared files used with the kernel module
ii nvidia-kernel-source-418 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA kernel source package
ii nvidia-prime 0.8.8.2 all Tools to enable NVIDIA's Prime
ii nvidia-settings 418.56-0ubuntu0~gpu18.04.1 amd64 Tool for configuring the NVIDIA graphics driver
ii nvidia-utils-418 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA driver support binaries
ii xserver-xorg-video-nvidia-418 418.56-0ubuntu0~gpu18.04.1 amd64 NVIDIA binary Xorg driver
$ sudo lshw -C display
*-display
description: VGA compatible controller
product: GP107 [GeForce GTX 1050]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:01:00.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
configuration: driver=nvidia latency=0
resources: irq:139 memory:a3000000-a3ffffff memory:90000000-9fffffff memory:a0000000-a1ffffff ioport:3000(size=128) memory:a4000000-a407ffff
*-display
description: VGA compatible controller
product: Intel Corporation
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:138 memory:a2000000-a2ffffff memory:80000000-8fffffff ioport:4000(size=64) memory:c0000-dffff
答案1
请考虑安装 nvcc
sudo apt-get install nvidia-cuda-toolkit
而是从源头。
但稍微猜测一下:
- cuda9不支持sm_20。
- GTX1050 及更高版本需要 sm_30 或更高版本。GTX1080 = sm_60。这是包含卡片和匹配 sm 的列表。
如果这些都正确,请参见第 55 行CMakeLists.txt:
IF (CUDA_FOUND)
LIST(APPEND CUDA_NVCC_FLAGS "-arch=sm_XX")
它将在 XX 处列出一个值。
尝试将 -arch=sm_20 更改为该值,或者只是将您的值改为 30 或更高。