cuda
sudo /bin/sh cuda_11.7.0_515.43.04_linux.run
cudnn
cuDNN Archive | NVIDIA Developer
Linux 系统 CUDA 多版本共存以及切换 – 颢天
安装cuda
# 如果已经安装过驱动,驱动不需要再安装,取消勾选
安装cuDNN,cuda-cuDNN对应关系见上,相应的从上面的下载,
解压
tar -xvf xxx.tar.xz
sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda-12.1/include
sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda-12.1/lib64
sudo chmod a+r /usr/local/cuda-12.1/include/cudnn*.h /usr/local/cuda-12.1/lib64/libcudnn*
vim ~/.bashrc
文件尾部添加下面内容
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
function switch_cuda {
if [[ $1 =~ ^[0-9]+\.[0-9]+$ ]]; then
sudo rm /usr/local/cuda
sudo ln -s /usr/local/cuda-$1 /usr/local/cuda
nvcc --version
else
echo invalid version
fi
}
source .bashrc