2016-12-13 111 views
3

我尝试运行tf.one_hot,得到CUDA_ERROR_LAUNCH_FAILED错误。下面是详细信息:TensorFlow GPU,CUDA_ERROR_LAUNCH_FAILED on tf.one_hot()

示例代码:

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 

PC的配置:

  • 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日)

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

回答

0

我评论为'答案',因为我的反馈太过于详细,如评论。

我跑你的样品,并得到这些结果:

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 

我的配置:

  • TensorFlow 0.12.0-RC1的GPU
  • 的Python 3.5.2/4.2.0蟒蛇
  • CUDA 8.0
  • cuDNN 5.1
  • 操作系统:Windows 10
  • GPU:的GeForce GTX 745(OEM)

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

3

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

你是否曾经报告过这是GitHub上的一个bug?我也可以确认/这种行为具有相同Tensorflow/OS /显卡等

只是移动tf.one_hot()的CPU解决了我的问题,即像

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

+0

谢谢。发布到https://github.com/tensorflow/tensorflow/issues/6783。 – luzi82