CUDA
命令查詢地址:https://developer.nvidia.com/cuda-downloads
Terminal(快捷鍵Ctrl+Alt+t)裡輸入一下命令:
wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run
sudo sh cuda_12.1.0_530.30.02_linux.run
馬上顯示一個問題,Do you accept the above EULA?(accept/decline/quit):
輸入:accept
然後會有一個CUDA Installer 的多項選擇,如果裝過了Driver則回車改選項去掉,預設選擇CUDA Toolkit、CUDA Demo、CUDA Documentation。
接著,移動到Install安裝。
接下來配置環境變數:
vim ~/.bashrc
export PATH=$PATH:/usr/local/cuda-12.1/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.1/lib64
Vim 中按Esc 再按:,輸入wq (write and quit)
重新整理檔案
source ~/.bashrc
輸入nvcc-V
驗證安裝
cuDNN
官網(https://developer.nvidia.com/cudnn-downloads)登陸註冊,下載對應版本的deb檔案。
sudo dpkg -i cudnn-local-repo-ubuntu2204-8.9.1.23_1.0-1_amd64.deb
報錯:
The public cudnn-local-repo-ubuntu2204-8.9.1.23 GPG key does not appear to be installed. To install the key, run this command: sudo cp /var/cudnn-local-repo-ubuntu2204-8.9.1.23/cudnn-local-E7A7D88D-keyring.gpg /usr/share/keyrings/
按照提示,你需要安裝 cuDNN 倉庫的 GPG 金鑰。執行以下命令來安裝金鑰:
sudo cp /var/cudnn-local-repo-ubuntu2204-8.9.1.23/cudnn-local-E7A7D88D-keyring.gpg /usr/share/keyrings/
然後,你可以更新包列表: