Skip to content

/gpu:0/stream doesn't appear on Timeline #11803

Closed

Description

@laket

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.
timeline_no_gpu

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.
timeline_with_gpu

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)

convolutional.py.zip

Activity

  1. duongnt commented on Jul 28, 2017

    @duongnt

    I'm having the exact same problem, but I didn't compile from code

    System information

    • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
    • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 14.04
    • TensorFlow installed from (source or binary): binary
    • TensorFlow version (use command below): ('v1.2.0-5-g435cdfc', '1.2.1')
    • Python version: Python 2.7.6
    • Bazel version (if compiling from source): not applicable
    • CUDA/cuDNN version: CUDA 8.0, cuDNN 5.1.10
    • GPU model and memory: TITAN X 12GB
    • Exact command to reproduce:
  2. prb12 commented on Jul 28, 2017

    @prb12
    Member

    @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 cuptiActivtyFlushAll are a bit vague about what those flags mean and we have been running without CUPTI_ACTIVITY_FLAG_FLUSH_FORCED for 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_INT does, only a definition as 0x7fffffff. Internal? Interrupt?

    Does this work for you with the "documented" flag?

  3. laket commented on Jul 31, 2017

    @laket
    ContributorAuthor

    @prb12 yes. I got /gpu:0/stream:xx lines in Timeline with CUPTI_CALL(ActivityFlushAll(CUPTI_ACTIVITY_FLAG_FLUSH_FORCED));

  4. prb12 commented on Jul 31, 2017

    @prb12
    Member

    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?

  5. laket commented on Aug 1, 2017

    @laket
    ContributorAuthor

    @prb12 thanks for the detail background. I submit the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions