【问题标题】:TensorFlow GPU, CUDA_ERROR_LAUNCH_FAILED on tf.one_hot()TensorFlow GPU,tf.one_hot() 上的 CUDA_ERROR_LAUNCH_FAILED
【发布时间】:2016-12-13 07:14:55
【问题描述】:

我尝试运行 tf.one_hot,得到 CUDA_ERROR_LAUNCH_FAILED 错误。详情如下:

示例代码:

import tensorflow as tf
idx_0 = tf.placeholder(tf.int64, [None])
mask = tf.one_hot(idx_0, 3, axis=-1)
sess = tf.Session()
sess.run(tf.global_variables_initializer())
a = sess.run([mask],feed_dict={idx_0:[0,1,2]})
print(a)

预期结果:

[array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]], dtype=float32)]

实际结果:

E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_driver.cc:1177] could not synchronize on CUDA context: CUDA_ERROR_LAUNCH_FAILED :: No stack trace available
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_event.cc:49] Error polling for event status: failed to query event: CUDA_ERROR_LAUNCH_FAILED
F c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_util.cc:370] GPU sync failed

电脑配置:

  • TensorFlow 0.12.0-rc1
  • Python 3.5
  • CUDA 8.0
  • cuDNN 5.1
  • 操作系统:Windows 10
  • GPU:GeForce GTX 970

tf.one_hot 在 Linux CPU、Linux GPU (GeForce GTX 660)、Windows 10 CPU 上运行正常。在 Windows 10 GPU 上不行。

在 Windows 10 GPU 上,tf.matmul、tf.reduce_mean、tf.reduce_sum 运行正常。但是 tf.one_hot 不行。

这是一个错误,还是我错过了什么?谢谢。

(编辑 2016-12-16)

我已经在 GPU 的 Xubuntu 中的同一台机器上运行了代码。代码运行良好。所以我认为这是 TensorFlow-Windows 中的一个问题。

【问题讨论】:

    标签: tensorflow


    【解决方案1】:

    在我的情况下,也留下评论作为答案,因为我没有足够的声誉来发表评论。

    您是否在 GitHub 上将此报告为错误?我也可以使用相同的 Tensorflow/OS/Graphics Card/etc 来确认这种行为

    只需将 tf.one_hot() 移至 CPU 即可解决我的问题,即类似

    with tf.device('/cpu:0'): b = tf.one_hot(a, 123)

    【讨论】:

    【解决方案2】:

    我将评论作为“答案”,因为我的反馈作为评论过于详细。

    我运行了您的样本并得到了以下结果:

    I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:906] DMA: 0 
    I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:916] 0:   Y 
    I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 745, pci bus id: 0000:01:00.0)
    E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_event.cc:49] Error polling for event status: failed to query event: CUDA_ERROR_LAUNCH_FAILED
    F c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_event_mgr.cc:198] Unexpected Event status: 1
    

    我的配置:

    • 用于 GPU 的 TensorFlow 0.12.0-rc1
    • Python 3.5.2/Anaconda 4.2.0
    • CUDA 8.0
    • cuDNN 5.1
    • 操作系统:Windows 10
    • GPU:GeForce GTX 745 (OEM)

    我还有其他产生上述错误的代码。在另一台具有类似配置但仅用于 CPU 的 TensorFlow 0.12.0-rc1 版本的计算机上运行它运行良好。我建议您使用该版本的 TensorFlow 测试您的代码。

    【讨论】:

      猜你喜欢
      • 2019-05-30
      • 2017-07-18
      • 1970-01-01
      • 1970-01-01
      • 2019-11-06
      • 2020-01-14
      • 1970-01-01
      • 2018-06-13
      • 2019-01-03
      相关资源
      最近更新 更多