tensorflow - tensorflow2.2.0 + Cuda11.0 GPU 测试返回 False
问题描述
我正在windows-10
使用 GeForce 的 PC 上工作GTX-980Ti
。
我安装了最新的 Nvidia 驱动程序451.67
,Visual Studio 2019 版本16.6.4
,tensorflow-gpu 2.2.0
. 然后我下载并cuda 11.0
安装cuDNN8.0.1 RC2
了cuda11.0
.
我能够验证安装并运行示例程序。
当我尝试在 anaconda 中测试它时出现问题:
>>> import tensorflow as tf
2020-07-20 23:29:09.430847: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
>>> tf.__version__
'2.2.0'
>>> print(tf.test.is_gpu_available())
WARNING:tensorflow:From <stdin>:1: 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-07-20 23:29:13.406332: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-07-20 23:29:13.418916: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2706c6031b0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-20 23:29:13.422382: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-07-20 23:29:13.425719: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-07-20 23:29:13.456071: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:03:00.0 name: GeForce GTX 980 Ti computeCapability: 5.2
coreClock: 1.228GHz coreCount: 22 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 313.37GiB/s
2020-07-20 23:29:13.461916: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-07-20 23:29:13.467883: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found
2020-07-20 23:29:13.474696: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2020-07-20 23:29:13.479956: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2020-07-20 23:29:13.490763: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2020-07-20 23:29:13.493807: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found
2020-07-20 23:29:13.498571: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found
2020-07-20 23:29:13.501335: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] 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-07-20 23:29:13.601860: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-07-20 23:29:13.606065: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] 0
2020-07-20 23:29:13.609379: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0: N
2020-07-20 23:29:13.615932: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2707213a850 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-07-20 23:29:13.618721: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce GTX 980 Ti, Compute Capability 5.2
False
和:
>>> tf.config.list_physical_devices('GPU')
2020-07-21 13:18:04.066692: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-07-21 13:18:04.096830: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:03:00.0 name: GeForce GTX 980 Ti computeCapability: 5.2
coreClock: 1.228GHz coreCount: 22 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 313.37GiB/s
2020-07-21 13:18:04.101741: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-07-21 13:18:07.858480: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found
2020-07-21 13:18:07.937031: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2020-07-21 13:18:07.981968: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2020-07-21 13:18:08.309451: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2020-07-21 13:18:08.314100: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found
2020-07-21 13:18:08.320636: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found
2020-07-21 13:18:08.325392: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] 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...
[]
>>>
有人能告诉我为什么它在寻找过时的 dll 吗?我读过我可以手动添加 dll,但不建议这样做。有人对此有解决方案吗?
我python 3.8.4
从 python 网站安装,但anaconda
给了我这个:
(base) PS C:\Windows\system32> python --version
Python 3.7.6.
可能不相关,只是想提一下。谢谢!
解决方案
请注意,Tensorflow-2.2.0
onwindows
不支持CUDA-11.0
and CuDNN-8.0
,它支持CUDA-10.1
andCuDNN-7.4
在他们的文档中给出。
我建议你做以下事情:
- 卸载
tensorflow-gpu
- 删除所有版本的
CUDA
和CuDNN
- 安装
CUDA-10.1
和CuDNN-7.4
- 安装
tensorflow-gpu
从文档=> 特别是,TensorFlow 不会在没有
cuDNN64_7.dll
文件的情况下加载。
笔记:
- 请参阅此在 Windows上
Tensorflow
安装- https://www.tensorflow.org/install/pip#1.-install-the-python-development-environment-on-your-systempip
Tensorflow
如果您在环境方面需要任何帮助,anaconda
请参阅 - https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/
推荐阅读
- ruby-on-rails - Rails - collection_check_boxes 未触发连接模型上的回调
- grafana - 以编程方式导出 grafana 仪表板数据
- excel - MS Query 在 OBDC 查询中将十进制作为参数传递
- javascript - (ASP.NET) args.IsValid 如何阻止表单被提交?
- r - 将读取为字符的对比列表传递给R中的线性模式
- ios - Firebase 中生产的 APNs 身份验证密钥失败
- javascript - 基于另一个文本框值隐藏文本框的 Javascript 代码
- postgresql - 如何使用键和列名称以及更新列值将表数据中的更改记录到另一个表
- node.js - 在 NightwatchJS 中将测试输出写入文件
- c++ - 制作共享对象时不能使用针对未定义符号的重定位 R_X86_64_PC32;使用 -fPIC 重新编译