ubuntu如何安装cudnn
时间: 2023-11-22 12:44:41 浏览: 216
首先,您需要先下载对应版本的cudnn,然后按照以下步骤进行安装:
1. 解压下载的cudnn文件,将解压后的文件夹复制到/usr/local/cuda目录下。
2. 进入cudnn文件夹,执行以下命令:
```
sudo cp -P include/cudnn.h /usr/local/cuda/include
sudo cp -P lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
```
3. 配置环境变量,执行以下命令:
```
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
```
4. 验证是否安装成功,执行以下命令:
```
nvcc -V && cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
```
如果输出类似于以下内容,则说明安装成功:
```
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0
#define CUDNN_MAJOR 8
#define CUDNN_MINOR 2
#define CUDNN_PATCHLEVEL 0
```
阅读全文