首页 > 解决方案 > 为什么没有 CuDNN?

问题描述

我在 Ubuntu 20.04 上使用 Nvidia GeForce GTX 1660 进行机器学习。我遵循了设置过程,似乎我的 tensorflow 正在使用 GPU,因为我得到了以下输出。

$ python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.config.list_physical_devices(device_type='GPU')
2021-10-22 15:02:49.664511: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-10-22 15:02:49.672338: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-10-22 15:02:49.675114: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
>>> from tensorflow.python.platform import build_info as build
>>> print(f"tensorflow version: {tf.__version__}")
tensorflow version: 2.6.0
>>> print(f"Cuda Version: {build.build_info['cuda_version']}")
Cuda Version: 11.2
>>> print(f"Cudnn version: {build.build_info['cudnn_version']}")
Cudnn version: 8
>>> 

但是,如果我尝试验证我的 CuDNN 安装,它似乎不存在。

$ cat /usr/local/cuda/include/cudnn_version.h
$ cat: /usr/local/cuda/include/cudnn_version.h: No such file or directory
$ nvcc --version
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

虽然我像这样运行安装

apt-get --assume-yes install cuda nvidia-cuda-toolkit

基本上,我遵循了一些程序,但从未全面了解组件是什么以及组件如何相互依赖,例如 Cuda、CuDNN、NVCC、Nvidia 驱动程序、Tensorflow 等。所以关于 tensorflow 如何工作的任何帮助虽然没有 CuDNN,但将不胜感激。

需要注意的是,即使是 NVCC 和 Cuda 似乎也从不同的界面显示了完全不同的版本。

标签: tensorflow2.0cudnn

解决方案


推荐阅读