繁体   English   中英

tensorflow-gpu 找不到 GPU

[英]tensorflow-gpu cannot find GPU

经过多次尝试,即使我做了在此链接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。


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

蟒蛇

从 Anaconda 安装 tensorflow-gpu

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM