tensorflow2.2.0 + Cuda11.0 GPU 测试 returns 错误
tensorflow2.2.0 + Cuda11.0 GPU test returns False
我正在 windows-10
电脑上使用 GeForce GTX-980Ti
。
我安装了最新的 Nvidia 驱动 451.67
、Visual Studio 2019 版 16.6.4
、tensorflow-gpu 2.2.0
。然后我为 cuda11.0
.
下载并安装了 cuda 11.0
和 cuDNN8.0.1 RC2
我能够验证安装和 运行 示例程序。
当我尝试在 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 网站安装了 python 3.8.4
,但是 anaconda
给了我这个:
(base) PS C:\Windows\system32> python --version
Python 3.7.6.
可能不相关,只是想提一下。谢谢!
请注意 windows
上的 Tensorflow-2.2.0
不支持 CUDA-11.0
和 CuDNN-8.0
,它支持 CUDA-10.1
和 CuDNN-7.4
,如中所示他们的文档。
我建议你做以下事情:
- 卸载
tensorflow-gpu
- 删除
CUDA
和 CuDNN
的所有版本
- 安装
CUDA-10.1
和CuDNN-7.4
- 安装
tensorflow-gpu
From documentation => In particular, TensorFlow will not load without the cuDNN64_7.dll
file.
注:
- 参考此安装
Tensorflow
和 pip
on windows - https://www.tensorflow.org/install/pip#1.-install-the-python-development-environment-on-your-system
- 如果您在
anaconda
环境中需要有关 Tensorflow
的任何帮助,请参阅此 - https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/
我正在 windows-10
电脑上使用 GeForce GTX-980Ti
。
我安装了最新的 Nvidia 驱动 451.67
、Visual Studio 2019 版 16.6.4
、tensorflow-gpu 2.2.0
。然后我为 cuda11.0
.
cuda 11.0
和 cuDNN8.0.1 RC2
我能够验证安装和 运行 示例程序。
当我尝试在 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 网站安装了 python 3.8.4
,但是 anaconda
给了我这个:
(base) PS C:\Windows\system32> python --version
Python 3.7.6.
可能不相关,只是想提一下。谢谢!
请注意 windows
上的 Tensorflow-2.2.0
不支持 CUDA-11.0
和 CuDNN-8.0
,它支持 CUDA-10.1
和 CuDNN-7.4
,如中所示他们的文档。
我建议你做以下事情:
- 卸载
tensorflow-gpu
- 删除
CUDA
和CuDNN
的所有版本
- 安装
CUDA-10.1
和CuDNN-7.4
- 安装
tensorflow-gpu
From documentation => In particular, TensorFlow will not load without the
cuDNN64_7.dll
file.
注:
- 参考此安装
Tensorflow
和pip
on windows - https://www.tensorflow.org/install/pip#1.-install-the-python-development-environment-on-your-system - 如果您在
anaconda
环境中需要有关Tensorflow
的任何帮助,请参阅此 - https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/