
我使用的是 Ubuntu 14.04 LTS,而且已經使用 NVIDIA 和 CUDA 幾個月了。今天早上,在 ubuntu 更新後,我收到「未找到 CUDA」錯誤。啊,我已經使用 .run 檔案在這台機器上安裝了 NVIDA 工具包、驅動程式和 CUDA 幾次。再次閱讀「Linux 版 NVIDIA CUDA 入門指南」文檔,我決定嘗試安裝套件管理器,因此按照文檔中的指示卸載了先前的 .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
希望這可以幫助!