我在 AWS ubuntu 机器集群上运行 tensorflow 分布式初始模型,并通过
# Track statistics of the run using Timeline
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
# Run
loss_value, step = sess.run([train_op, global_step], options=run_options, run_metadata=run_metadata)
# Create timeline and write it to a json file
tl = timeline.Timeline(run_metadata.step_stats)
ctf = tl.generate_chrome_trace_format()
with open('timeline%d.json' % FLAGS.task_id, 'w') as f:
f.write(ctf)
当我查看工作机器生成的时间线时,我看到了这个: 工作机器的时间线跟踪
注意右边的 QueueDequeue 操作,时间线说它是参数服务器 /job:ps/replica:0/task:0/cpu:0 的一部分。
由于 ScatterUpdate 就在 QueueDequeue 之后,如图所示,我相信此操作对应于同步副本优化器操作,其中工作人员尝试将令牌出列并进行分散更新:https ://github.com/tensorflow/tensorflow/blob /master/tensorflow/python/training/sync_replicas_optimizer.py#L412
但是如果是这样的话,应该是一个工作人员执行这个操作,而不是一个参数服务器。为什么时间线说参数服务器正在执行这个?
我正在使用 tensorflow 0.11,仅限 CPU。