【问题标题】:tensorflow-gpu cannot find GPUtensorflow-gpu 找不到 GPU
【发布时间】:2020-10-07 16:58:51
【问题描述】:

经过多次尝试,即使我完成了此链接https://www.tensorflow.org/install/gpu; 上写的所有内容,我也无法使用我的 GPU。我尝试了许多版本的 Cuda(11.0 11.1,最后一个是 10.1),但 TensorFlow 没有检测到 GPU(Geforce Gtx 1050 ti)。

import tensorflow as tf
tf.test.is_built_with_cuda()

返回真。

tf.test.is_gpu_available(cuda_only=False, min_cuda_compute_capability=None)

输出:

2020-10-07 20:14:11.242732: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
WARNING:tensorflow:From C:/Users/Lenovo/PycharmProjects/AI/test.py:2: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2020-10-07 20:14:13.554045: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-10-07 20:14:13.563910: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1e9683ca5f0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-10-07 20:14:13.564367: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-10-07 20:14:13.565594: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2020-10-07 20:14:13.586511: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: GeForce GTX 1050 Ti computeCapability: 6.1
coreClock: 1.62GHz coreCount: 6 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 104.43GiB/s
2020-10-07 20:14:13.587248: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-10-07 20:14:13.592223: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cublas64_10.dll
2020-10-07 20:14:13.596083: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll
2020-10-07 20:14:13.597794: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll
2020-10-07 20:14:13.602129: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll
2020-10-07 20:14:13.604848: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2020-10-07 20:14:13.607078: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found
2020-10-07 20:14:13.607657: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1753] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-10-07 20:14:13.686263: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-10-07 20:14:13.686660: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]      0 
2020-10-07 20:14:13.686904: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0:   N 
2020-10-07 20:14:13.689990: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1e97492faf0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-10-07 20:14:13.690470: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): GeForce GTX 1050 Ti, Compute Capability 6.1

3 天后,我别无选择,我也不知道。你能帮我解决这个问题吗?


编辑:我解决了这个问题。 TensorFlow 搜索“cudnn64_7.dll”文件名。如果找不到搜索的文件名,则 cuDNN 不起作用(即使您将 cuDNN 文件添加到 Cuda 文件中)。我下载的 CuDNN 有一个名为“cudnn64_8.dll”的文件。我找到了文件并重命名了它。所以TensorFlow可以找到GPU。


【问题讨论】:

  • 你有哪个 GPU,你能把 tensorflow 产生的完整输出包括进来吗?
  • 这不是 TensorFlow 的全部输出,有几行提到 GPU 库、CUDA 等
  • 我用的是 jupyter notebook 但我可以试试 pycharm。
  • 在 jupyter 中可能显示在终端中
  • 好的,我找到了输出

标签: python tensorflow


【解决方案1】:

你可以试试 Anaconda。它是python的包管理器。它允许您安装 tensorflow 以准备使用您的 gpu 进行处理,而不会遇到 CUDA 和 cuDNN 版本的问题。我将在此处留下 Anaconda 安装程序的链接以及如何从中安装 tensorflow-gpu 包。

Anaconda

Installing tensorflow-gpu from Anaconda

【讨论】:

  • 不使用 Anaconda 吗?那么,请检查nvidia驱动是否安装正确,你是在windows下吗?
  • 现在我明白问题所在了。我认为这与 Cuda 版本无关,因为 Cuda 正在工作。问题是 cuDNN。我安装成功。但我必须在添加到 Path 或添加到 Cuda 文件时遇到问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-10-15
  • 2020-03-12
  • 2021-03-21
  • 1970-01-01
  • 1970-01-01
  • 2018-08-30
相关资源
最近更新 更多