(背景环境:linux+anaconda,CUDA Version: 11.2,无root权限,虚拟环境命名为vitstr)

import torch

print('cuDNN version: ', torch.backends.cudnn.version()) # Corresponding cuDNN version

运行上述代码,报错:

RuntimeError: cuDNN version incompatibility: PyTorch was compiled  against (8, 5, 0) but found runtime version (8, 1, 1). PyTorch already comes bundled with cuDNN. One option to resolving this error is to ensure PyTorch can find the bundled cuDNN.Looks like your LD_LIBRARY_PATH contains incompatible version of cudnnPlease either remove it from the path or install cudnn (8, 5, 0)

解决步骤:

1、 下载cuDNN v8.5.0版本。 

下载链接:cuDNN Archive | NVIDIA Developer

参考:Ubuntu 22.04+cuda11.3+cudnn8.5配置 保姆级教程

2、输入下述解压代码 

$ tar -xvf cudnn-linux-x86_64-8.5.0.96_cuda11-archive.tar.xz
cp cudnn-linux-x86_64-8.5.0.96_cuda11-archive/include/cudnn*.h /raid/anaconda3/envs/vitstr/include 
cp -P cudnn-linux-x86_64-8.5.0.96_cuda11-archive/lib/libcudnn* /raid/anaconda3/envs/vitstr/lib
chmod a+r /raid/anaconda3/envs/vitstr/include/cudnn*.h 

 3、环境配置

vim ~/.bashrc

键入"i"进行修改,添加以下内容:

export  LD_LIBRARY_PATH=/raid/anaconda3/envs/vitstr/lib:$LD_LIBRARY_PATH

点击esc按键,输入“:wq”保存。再输入:

source ~/.bashrc

验证是否成功:

Logo

更多推荐