【发布时间】:2019-10-01 15:05:13
【问题描述】:
我使用 tensorflow 已经有一段时间了,一切正常,直到我尝试切换到 gpu 版本。
卸载之前的tensorflow, pip 安装了 tensorflow-gpu (v2.0) 下载并安装了 Visual Studio Community 2019 下载并安装了 CUDA 10.1 下载并安装cuDNN
使用 CUDA 样本“deviceQuery_vs2019”进行测试,结果为阳性。 考试通过了 英伟达 GeForce rtx 2070
使用以前的工作文件运行测试并得到错误 tensorflow.python.framework.errors_impl.InternalError: cudaGetDevice() 失败。状态:未找到 cudaGetErrorString 符号。
经过一些研究,我发现支持的 CUDA 版本是 10.0 所以我降级了版本,更改了 CUDA 路径,但没有任何改变
使用此代码
import tensorflow as tf
print("Num GPUs Available: ",
len(tf.config.experimental.list_physical_devices('GPU')))
我明白了
2019-10-01 16:55:03.317232: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2019-10-01 16:55:03.420537: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
Num GPUs Available: 1
name: GeForce RTX 2070 major: 7 minor: 5 memoryClockRate(GHz): 1.62
pciBusID: 0000:01:00.0
2019-10-01 16:55:03.421029: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2019-10-01 16:55:03.421849: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
[Finished in 2.01s]
CUDA 似乎可以识别卡,tensorflow 也是如此,但我无法摆脱错误: tensorflow.python.framework.errors_impl.InternalError: cudaGetDevice() 失败。状态:未找到 cudaGetErrorString 符号。
我做错了什么?我应该坚持使用 cuda 10.0 吗?我错过了一部分安装吗?
【问题讨论】:
-
tensorflow.org/install/gpu (含蓄地)说需要 CUDA 10.0,我在其他地方(github?)看到使用 10.0 而不是 10.1 的说明。不幸的是,我有 10.0 并且我有完全相同的错误,所以我也会对有用的解释性答案感兴趣。
标签: python tensorflow