1

I have simple tensorflow code:

import tensorflow as tf
from tensorflow.python.client import timeline

zeros = tf.zeros(shape=(1000, 1000))
a, b = tf.while_loop(
    lambda a, b: a < 1000,
    lambda a, b: (a + 1, tf.matmul(zeros, zeros)),
    (0, zeros))

with tf.Session() as sess:
    options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
    run_metadata = tf.RunMetadata()
    sess.run([a,b], options=options, run_metadata=run_metadata)

    fetched_timeline = timeline.Timeline(run_metadata.step_stats)
    chrome_trace = fetched_timeline.generate_chrome_trace_format()

    with open('timeline.json', 'w') as f:
        f.write(chrome_trace)

I don't understand, why top show me >100 %cpu, because all operations run on gpu: trace_data

Any ideas?

Squanchy
  • 147
  • 1
  • 9

0 Answers0