安装 CUDA、cuDNN

2024-01-17  本文已影响0人  iVikings

卸载 CUDA

cd /usr/local/cuda-11.8/bin
sudo ./cuda-uninstaller
cd /usr/local
sudo rm -rf cuda-11.8

下载 CUDA

https://developer.nvidia.com/cuda-toolkit-archive
https://developer.nvidia.com/cuda-11-8-0-download-archive

CentOS8-cuda_11.8.png Ubuntu-22.04-cuda_12.2.png

更新 CUDA

sudo sh ./cuda_11.8.0_520.61.05_linux.run --toolkit --silent --override

修改环境变量

vim ~/.bashrc

# 或 sudo gedit ~/.bashrc

export PATH=/usr/local/cuda-11.8/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH
# centos
export PATH=$PATH:/opt/xxx/ffmpeg-6.1-amd64-static/
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.8/lib64
export PATH=$PATH:/usr/local/cuda-11.8/bin
export CUDA_HOME=/usr/local/cuda-11.8
source ~/.bashrc

检验

nvcc -V

安装 cuDNN

https://developer.nvidia.com/rdp/cudnn-archive
cuDNN.png
tar -xvf cudnn-linux-x86_64-8.9.6.50_cuda11-archive.tar.xz
cd cudnn-linux-x86_64-8.9.6.50_cuda11-archive
ls
include  lib  LICENSE
sudo cp include/cudnn*.h /usr/local/cuda-11.8/include
sudo cp lib/libcudnn* /usr/local/cuda-11.8/lib64
sudo chmod a+r /usr/local/cuda-11.8/include/cudnn*.h /usr/local/cuda-11.8/lib64/libcudnn*
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
上一篇下一篇

猜你喜欢

热点阅读