注:这个问题最初是在github上问的 https://github.com/tensorflow/tensorflow/issues/7648#issuecomment-280866214,但被要求改为在这里
我在 GPU 上运行 Tensorflow 时遇到问题,这似乎不是常见的 cuda 配置问题,因为一切似乎都表明 cuda 设置正确。
主要症状:运行tensorflow时,未检测到我的gpu(正在运行的代码 https://gist.github.com/oelmekki/cafda411bf5c2ea695d984fa98e0995b, and 它的输出 https://gist.github.com/oelmekki/77235c6b0dde99b3438f190eb557f40f).
与常见问题不同的是,cuda 似乎已正确安装并运行./deviceQuery
从 cuda 样本中成功(output https://gist.github.com/oelmekki/fe65a15daec45aa90ec33b10b51d3aae).
我有两个显卡:
- 一台旧的 GTX 650 用于我的显示器(我不想将其与张量流一起使用)
- 我想专用于张量流的 GTX 1060
I use:
- 张量流-1.0.0 https://pypi.python.org/pypi/tensorflow
- cuda-8.0(ls -l /usr/local/cuda/lib64/libcud* https://gist.github.com/oelmekki/6e5e9d7d1ea871e1d73efae307efe9ce)
- cudnn-5.1.10
- python-2.7.12
- nvidia-drivers-375.26(这是由 cuda 安装并替换了我的发行版驱动程序包)
我试过了:
- adding
/usr/local/cuda/bin/
to $PATH
- 使用以下命令强制将 GPU 放置在张量流脚本中
with tf.device('/gpu:1'):
(and with tf.device('/gpu:0'):
当它失败时,作为一个很好的措施)
- 将我想要使用的 GPU 列入白名单
CUDA_VISIBLE_DEVICES
,以防我的旧的不受支持的卡的存在确实引起了问题
- 使用 sudo 运行脚本(因为为什么不呢)
这是的输出英伟达-SMI https://gist.github.com/oelmekki/7bdcb5cc2f791cea561a60f8b21e87b5 and nvidia-debugdump -l https://gist.github.com/oelmekki/b83a5a0a72e8924aeb44b70b3598f9b4,以防万一有用。
此时,我觉得我已经遵循了所有的面包屑,并且不知道我还可以尝试什么。我什至不确定我是否正在考虑错误或配置问题。任何有关如何调试此问题的建议将不胜感激。谢谢!
Update:在 github 上 Yaroslav 的帮助下,我通过提高日志级别收集了更多调试信息,但它似乎并没有说明太多有关设备选择的信息:https://gist.github.com/oelmekki/760a37ca50bf58d4f03f46d104b798bb https://gist.github.com/oelmekki/760a37ca50bf58d4f03f46d104b798bb
Update 2:使用 theano 可以正确检测 GPU,但有趣的是,它抱怨 cuDNN 太新,然后回退到 cpu (code ran https://gist.github.com/oelmekki/34b6e41a0ff2b17ff9f39bcf56d0635a, output https://gist.github.com/oelmekki/11626d6b34058337dae64f1915e5a9fe)。也许这也可能是张量流的问题?