如果你還沒裝driver可以參考:
CUDA段落
如果你不想那麼麻煩,其實裝CUDA時,他會幫你裝driver的.........(有點覺得OOXX對吧),開始安裝CUDA,先到官網找你要的版本,這邊示範12.3.2:
https://developer.nvidia.com/cuda-toolkit-archive
wget https://developer.download.nvidia.com/compute/cuda/12.3.2/local_installers/cuda_12.3.2_545.23.08_linux.run
sudo sh cuda_12.3.2_545.23.08_linux.run
裝好後:
接著請執行:
echo 'export PATH=/usr/local/cuda-12.3/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
sudo ldconfig
請參考你安裝後,提示的路徑,不要照著上面輸入喔。
nvcc -V
看到這個.......成功了,We did it........
cuDNN段落
到這邊下載:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cudnn
如果想指定版本可以參考:
sudo apt-get -y install cudnn-cuda-11
sudo apt-get -y install cudnn-cuda-12
置換掉上面的最後一行就好