1. 安装cudatoolkit
先查看cuda版本:nvidia-smi
然后到 CUDA Toolkit 12.1 Update 1 Downloads | NVIDIA Developer 下载对应版本
wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run
sudo sh cuda_11.1.0_455.23.05_linux.run
accept 然后取消Driver,一路回车
配置环境变量:
vim ~/.bashrc
文末添加
export PATH=/usr/local/cuda-11.1/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source ~/.bashrc
然后切换cuda
ln -snf /usr/local/cuda-11.1 /usr/local/cuda
2. 下载cuDNN Archive | NVIDIA Developer,解压后将cudnn.h移到cuda路径的include中,将libcudnn*移动到cuda路径的lib64中:
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
网友评论