Repository navigation
Description
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
Ubuntu 16.04 - TensorFlow installed from (source or binary):
source - TensorFlow version (use command below):
('v1.2.0-2479-g88abddb', '1.3.0-rc0') - Python version:
2.7.12 - Bazel version (if compiling from source):
bazel release 0.4.5 - CUDA/cuDNN version:
CUDA 8.0
cuDNN 5.1.5 - GPU driver version
375.66 - GPU model and memory:
GeForce GTX 1080
8GB - Exact command to reproduce:
python convolution.py (attached)
The Problem
Making a timeline.Timeline object in my environment, "/gpu:0/stream:xx" rows don't appear.

I found the event collector function BufferCompleted were not called at all during measuring performance.
Though BufferCompleted is registered as a callback function to CUPTI for processing GPU events, CUPTI doesn't call it in my environment. This comes from failing to flush GPU events.
GPU events are flushed by ActivityFlushAll with flag CUPTI_ACTIVITY_FLAG_NONE in tensorflow. But this flag doesn't seem to cover necessary GPU events, so GPU events were not flushed and collected.
I modified gpu_tracer.cc to call ActivityFlushAll with flag CUPTI_ACTIVITY_FLAG_FORCE_INT, then I got "/gpu:0/stream:xx" rows in Timeline.

Is there any reason to use CUPTI_ACTIVITY_FLAG_NONE?
Source code / logs
Attached source code comes from tensorflow/models .
The following modification was added to measure performance.
from tensorflow.python.client import timeline
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
l, lr, predictions = sess.run([loss, learning_rate, train_prediction],
feed_dict=feed_dict, options=run_options, run_metadata=run_metadata)
tl = timeline.Timeline(run_metadata.step_stats)
ctf = tl.generate_chrome_trace_format(show_memory=True,
show_dataflow=True)
with open("timeline.json", "w") as f:
f.write(ctf)
Activity
duongnt commentedon Jul 28, 2017
I'm having the exact same problem, but I didn't compile from code
System information
prb12 commentedon Jul 28, 2017
@laket Thanks for the issue report and the clear investigation. I agree that it looks like the tracing buffers aren't getting flushed.
The docs on
cuptiActivtyFlushAllare a bit vague about what those flags mean and we have been running withoutCUPTI_ACTIVITY_FLAG_FLUSH_FORCEDfor a long time without seeing this issue. I guess something has changed in recent driver versions,I don't see a description of what
CUPTI_ACTIVITY_FLAG_FORCE_INTdoes, only a definition as0x7fffffff. Internal? Interrupt?Does this work for you with the "documented" flag?
laket commentedon Jul 31, 2017
@prb12 yes. I got /gpu:0/stream:xx lines in Timeline with
CUPTI_CALL(ActivityFlushAll(CUPTI_ACTIVITY_FLAG_FLUSH_FORCED));prb12 commentedon Jul 31, 2017
Seems reasonable. I dug around into the history of this flag. It seems that in CUDA6 and earlier this flag was required to be zero, and there have been a few bugs related to buffer flushing (e.g. losing the last trace record in the buffer).
Since (I think) we no longer need to support cuda versions < 7 this seems like a sensible change to me.
Could you please submit a PR?
laket commentedon Aug 1, 2017
@prb12 thanks for the detail background. I submit the PR.