系统信息:
OS: Ubuntu 22.04.1 LTS x86_64
Kernel: 5.15.0-47-generic
Uptime: 19 mins
Packages: 2225 (dpkg), 11 (snap)
Shell: bash 5.1.16
Resolution: 3840x2160
DE: GNOME 42.4
WM: Mutter
WM Theme: Adwaita
Theme: Yaru [GTK2/3]
Icons: Yaru [GTK2/3]
Terminal: gnome-terminal
CPU: Intel i9-9900K (16) @ 5.000GHz
GPU: NVIDIA GeForce RTX 2080
Memory: 2164MiB / 64225MiB
使用以下代码安装 Cuda:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda-repo-ubuntu2204-11-7-local_11.7.1-515.65.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-11-7-local_11.7.1-515.65.01-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda
似乎 cuda 已成功安装在我的设备上,因为运行时nvidia-smi
它显示:
Sat Sep 17 23:31:20 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.65.01 Driver Version: 515.65.01 CUDA Version: 11.7 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... On | 00000000:01:00.0 On | N/A |
| 0% 52C P8 27W / 215W | 675MiB / 8192MiB | 7% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1214 G /usr/lib/xorg/Xorg 275MiB |
| 0 N/A N/A 1449 G /usr/bin/gnome-shell 104MiB |
| 0 N/A N/A 2620 G ...5/usr/lib/firefox/firefox 293MiB |
+-----------------------------------------------------------------------------+
但是当我从 nvidia 下载 cuDNN 并安装它时,sudo dpkg -i cudnn-local-repo-ubuntu2204-8.5.0.96_1.0-1_amd64.deb
它显示:
prepare to decompress cudnn-local-repo-ubuntu2204-8.5.0.96_1.0-1_amd64.deb ...
decompressing cudnn-local-repo-ubuntu2204-8.5.0.96 (1.0-1) and overriding (1.0-1) ...
setup cudnn-local-repo-ubuntu2204-8.5.0.96 (1.0-1) ...
The public CUDA GPG key does not appear to be installed.
To install the key, run this command:
sudo cp /var/cudnn-local-repo-ubuntu2204-8.5.0.96/cudnn-local-7ED72349-keyring.gpg /usr/share/keyrings/
当然,我运行了上述代码。并且做了一些研究:
(base) desmond@PlanckUbuntu:~$ ls /var/cudnn-local-repo-ubuntu2204-8.5.0.96/
7ED72349.pub libcudnn8_8.5.0.96-1+cuda11.7_amd64.deb Local.md5 Packages.gz
cudnn-local-7ED72349-keyring.gpg libcudnn8-dev_8.5.0.96-1+cuda11.7_amd64.deb Local.md5.gpg Release
InRelease libcudnn8-samples_8.5.0.96-1+cuda11.7_amd64.deb Packages Release.gpg
(base) desmond@PlanckUbuntu:~$ ls /usr/share/keyrings/
cuda-F83D2C4C-keyring.gpg ubuntu-advantage-esm-infra-trusty.gpg ubuntu-archive-removed-keys.gpg
cudnn-local-7ED72349-keyring.gpg ubuntu-advantage-fips.gpg ubuntu-cloudimage-keyring.gpg
ubuntu-advantage-cc-eal.gpg ubuntu-advantage-realtime-kernel.gpg ubuntu-cloudimage-removed-keys.gpg
ubuntu-advantage-cis.gpg ubuntu-advantage-ros.gpg ubuntu-master-keyring.gpg
ubuntu-advantage-esm-apps.gpg ubuntu-archive-keyring.gpg
然后我重新运行安装脚本。它不起作用。我重新启动并重试。仍然没有运气。
你知道在这种情况下如何安装 cuDNN 吗?
答案1
复制密钥并将其重命名为 CUDA 包所期望的cuda-archive-keyring.gpg
。
sudo cp /var/cudnn-local-repo-ubuntu2204-8.5.0.96/cudnn-local-7ED72349-keyring.gpg /usr/share/keyrings/cuda-archive-keyring.gpg
该解决方案源自nvidia 论坛上有类似的帖子。