我使用的是 Ubuntu 14.04 LTS,几个月来一直在使用 NVIDIA 和 CUDA。今天早上,在 ubuntu 更新后,我收到“未找到 CUDA”错误。啊,我已经使用 .run 文件在这台机器上安装了几次 NVIDA 工具包、驱动程序和 CUDA。再次阅读“NVIDIA CUDA Linux 入门指南”文档后,我决定尝试安装包管理器,因此按照文档中的指示卸载了以前的 .run 安装文件。手册说我应该先给出这个命令。
sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb
但我不知道如何替换distro
version
和architecture
。
查看 uname 和 lsb_release 结果。
ckim@abnc:~$ uname -a
Linux abnc 4.4.0-34-generic #53~14.04.1-Ubuntu SMP Wed Jul 27 16:56:40 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
ckim@abnc:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
我试过了sudo dpkg -i cuda-repo-14.04_7.5_x86_64.deb
,但没用。命令应该是什么?(我试过 amd64 而不是 x86_64,但徒劳无功)。来自http://www.r-tutor.com/gpu-computing/cuda-installation/cuda7.5-ubuntu,我猜是的,sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_x86_64.deb
但它也失败了。(我之前使用.run文件安装了cuda7.5-18)
编辑:问题是我没有按照文档中预安装步骤的指示下载实际的 .deb 文件。请参阅下面的评论。有关 .run 文件安装,请参阅 @Terrance 的回答。
答案1
为了安装 DEB 文件,您需要实际下载它。该指南有一个 CUDA 下载站点的链接:http://developer.nvidia.com/cuda-downloads
答案2
以下是我最近做的一件事情,希望对你有帮助。
NVIDIA-370
ppa中的驱动程序实际上graphics-drivers
带有 CUDA 库。
首先,设置graphics-drivers
ppa:
sudo add-apt-repository ppa:graphics-drivers/ppa
然后更新并安装驱动程序:
sudo apt update
sudo apt install nvidia-370
转到你的~/Downloads/
文件夹,然后下载 cuda 运行包:
cd ~/Downloads
wget https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda_8.0.44_linux-run
重命名新下载的文件:
mv cuda_8.0.44_linux-run cuda_8.0.44_linux.run
然后创建一个用于 cuda 工具箱的目录:
mkdir ~/Downloads/nvidia_installers
然后将安装程序的不同部分提取到文件夹中(必须是完整的目录名):
sh cuda_8.0.44_linux.run -extract=/home/<username>/Downloads/nvidia_installers/
转到 nvidia 文件夹:
cd nvidia_installers/
安装示例和运行时:
sudo sh cuda-linux64-rel-8.0.44-21122537.run
sudo sh cuda-samples-linux-8.0.44-21122537.run
您不需要驱动程序,因为它们已经安装好了。
然后测试您的安装,请访问:
cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery
将所有文件更改为您拥有:
sudo chown $USER:$USER *
然后运行 make 来编译 deviceQuery:
sudo make
然后您应该能够运行来deviceQuery
显示以下信息:
terrance@terrance-ubuntu:/usr/local/cuda-8.0/samples/1_Utilities/deviceQuery$ ./deviceQuery
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 560 Ti"
CUDA Driver Version / Runtime Version 8.0 / 8.0
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 959 MBytes (1005387776 bytes)
( 8) Multiprocessors, ( 48) CUDA Cores/MP: 384 CUDA Cores
GPU Max Clock rate: 1700 MHz (1.70 GHz)
Memory Clock rate: 2100 Mhz
Memory Bus Width: 256-bit
L2 Cache Size: 524288 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 2 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 560 Ti
Result = PASS
希望这可以帮助!