修改与之前修改nvcc、cuda这些的原理是一样的。
国内镜像
检查系统版本
source /etc/os-release && echo $VERSION_ID
导入apt仓库和其GPG key
# 第一步若输出 16.04,请用下面的命令
curl -fsSL https://mirrors.cloud.tencent.com/nvidia-machine-learning/ubuntu1604/x86_64/7fa2af80.pub | apt-key add -
echo "deb https://mirrors.cloud.tencent.com/nvidia-machine-learning/ubuntu1604/x86_64/ /" > /etc/apt/sources.list.d/cuda.list
# 第一步若输出 18.04,请用下面的命令
curl -fsSL https://mirrors.cloud.tencent.com/nvidia-machine-learning/ubuntu1804/x86_64/7fa2af80.pub | apt-key add -
echo "deb https://mirrors.cloud.tencent.com/nvidia-machine-learning/ubuntu1804/x86_64/ /" > /etc/apt/sources.list.d/cuda.list
用命令安装cudnn
https://mirrors.cloud.tencent.com/nvidia-machine-learning/ubuntu1804/x86_64/
从镜像中找到对应版本
# 这里以8.0.3.33版本为例
apt-get update && apt-get install -y --no-install-recommends \
libcudnn8=8.0.3.33-1+cuda10.2 \
&& apt-mark hold libcudnn8 && \
rm -rf /var/lib/apt/lists/*