Tensorflow GPU 无法加载动态库“cusolver64_10.dll”; dlerror: 未找到 cusolver64_10.dll

Posted

技术标签:

【中文标题】Tensorflow GPU 无法加载动态库“cusolver64_10.dll”; dlerror: 未找到 cusolver64_10.dll【英文标题】:Tensorflow GPU Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found 【发布时间】:2021-04-12 23:07:24 【问题描述】:

当我跑步时

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

我收到以下错误

【问题讨论】:

【参考方案1】:

对于 TensorFlow 2.4.1,如果需要安装 CUDA 11.2,重命名 hack 将起作用。我建议为 TF 2.4.1 安装 CUDA 11.0 + cuDNN 8.0.4,正如@lineage 上面写的那样,然后就不需要重命名了,你的 GPU 会被识别。

对于 TensorFlow 2.5.0,我刚刚使用 CUDA 11.2.2 + cuDNN 8.1.1 识别了我的 GPU。在这种情况下,请勿重命名 cusolver 文件。 TF 2.5.0 需要“cusolver64_11.dll”文件名。

c> python
Python 3.9.4 | packaged by conda-forge | (default, May 10 2021, 22:10:34) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2021-05-28 08:11:24.517894: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll
>>> print(tf.version.VERSION)
2.5.0
>>> print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')),
...       '\nDevice: ', tf.config.list_physical_devices('GPU'))
2021-05-28 08:12:19.501812: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library nvcuda.dll
2021-05-28 08:12:19.530869: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1733] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 1080 with Max-Q Design computeCapability: 6.1
coreClock: 1.468GHz coreCount: 20 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 298.32GiB/s
2021-05-28 08:12:19.531377: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll
2021-05-28 08:12:19.597785: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cublas64_11.dll
2021-05-28 08:12:19.597992: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cublasLt64_11.dll
2021-05-28 08:12:19.618849: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cufft64_10.dll
2021-05-28 08:12:19.634321: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library curand64_10.dll
2021-05-28 08:12:19.677539: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library **cusolver64_11.dll**
2021-05-28 08:12:19.731541: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cusparse64_11.dll
2021-05-28 08:12:19.746271: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudnn64_8.dll
2021-05-28 08:12:19.746674: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1871] Adding visible gpu devices: 0
Num GPUs Available:  1
Device:  [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
>>>

【讨论】:

第一个答案可以看我的cmets。 @Hong Cheng,是的,我在 TF 2.5.0 上的经历和你一样。我认为在之前尝试获得对 TF 2.4.1 的 GPU 支持时,我已将该文件重命名为“cusolver64_10.dll”名称。使用 CUDA Toolkit 11+,TF 2.4.1 使用“cusolver64_10.dll”,TF 2.5.0 保留原始文件名“cusolver64_11.dll”。【参考方案2】:

TL;DR 对于Windows 上的TensorFlow ver >= 2.4.0,请安装下面突出显示的CUDA ToolkitcuDNN 的版本,即官方要求中列出的版本。(v11.0 与v11.2)


Windows 上,TensorFlow^ 在撰写本文时的安装要求如 here 所述

    NVIDIA® GPU 驱动程序 —CUDA® 11.0 需要 450.x 或更高版本。

    CUDA® Toolkit —TensorFlow 支持 CUDA® 11 (TensorFlow >= 2.4.0)

    CUPTI 附带 CUDA® 工具包。

    cuDNN SDK 8.0.4

    (可选)TensorRT 6.0 可改善某些模型的推理延迟和吞吐量。

您面临的问题可能与 CUDA® Toolkit 的版本有关。 Tensorflow 对依赖的版本很挑剔。看看里面C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin**。您应该能够在那里找到TensorFlow 所需的大多数 ^^ dll。您可能会注意到它包含 cusolver64_11.dll,而不是输出中所述的预期 cusolver64_10.dll

尽管上述答案中提到的重命名技巧有效,但不能保证始终可靠地工作。简单而正确的解决方案是首先安装正确的依赖项。

在撰写本文时,CUDA ToolkitcuDNN 的兼容版本是

CUDA Toolkit 11.0 (May 2020)
cuDNN v8.0.4 (September 28th, 2020), for CUDA 11.0 

从众多可用版本中,列出了here 和here。

尚不支持更新的版本(我从 v11.0 开始测试)。我记得几年前使用早期版本的 TensorFlow 时遇到过同样的问题。


^ 对于版本 >1.15,TensorFlow 默认包含 GPU 支持,因此需要 CUDA。当不可用时,TensorFlow 工作正常 - 它只是恢复到 CPU 执行。 ** 或安装工具包的任何位置 ^^cudnn64_8.dll自带cuDNN SDK

【讨论】:

【参考方案3】:

我遇到了同样的问题。事实证明,CUDA 11.0 包含 cusolver64_10.dll(这可能是他们在此处的 tensorflow 构建指南https://www.tensorflow.org/install/source_windows 中指出 CUDA v11.0 的原因)。确保也下载 cudnn!

【讨论】:

【参考方案4】: 第 1 步
 Move to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin
第 2 步
Rename file cusolver64_11.dll  To  cusolver64_10.dll 

 cusolver64_10.dll 

【讨论】:

使用 powershell 创建符号链接也可以,并且可能是首选:New-Item -ItemType SymbolicLink -Path .\cusolver64_10.dll -Target .\cusolver64_11.dll @DouglasMarttinen 谢谢它会帮助别人 为什么它不能与 cusolver64_11 一起使用?即使在更新了我的 tensorflow 之后,我也遇到了同样的问题...... 似乎不是太专业的答案,但它的工作原理。谢谢你:) 这会导致本题出现问题***.com/questions/53698035/…

以上是关于Tensorflow GPU 无法加载动态库“cusolver64_10.dll”; dlerror: 未找到 cusolver64_10.dll的主要内容,如果未能解决你的问题,请参考以下文章

tensorflow:无法加载动态库“cudart64_110.dll”; dlerror: 未找到 cudart64_110.dll

如何在 tensorflow 服务 (gpu) 中加载自定义动态库 (*.so)?

在 Ubuntu 20.4 LTS 上使用 GPU (CUDA-11.0) 运行代码时的 TensorFlow 问题

TensorFlow GPU:cudnn 是可选的吗?无法打开 CUDA 库 libcudnn.so

无法使用自定义容器在 Google AI Platform 上加载动态库 libcuda.so.1 错误

Tensorflow 2.2 GPU - 安装哪个 cuDNN 库?