diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-06-14 16:04:58 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-06-14 16:08:55 -0700 |
commit | f386c885017188448062db1c37069ea47e86b55e (patch) | |
tree | 2b9b6cc50d1135b23b9f2438d095de951e4d9973 /tensorflow/core/grappler/costs/virtual_scheduler.cc | |
parent | e16d717e0be08c7d4b9f2455dec356c853cb7225 (diff) |
Make virtual scheduler potentially write summary information to stepstats_ variable.
PiperOrigin-RevId: 159039540
Diffstat (limited to 'tensorflow/core/grappler/costs/virtual_scheduler.cc')
-rw-r--r-- | tensorflow/core/grappler/costs/virtual_scheduler.cc | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tensorflow/core/grappler/costs/virtual_scheduler.cc b/tensorflow/core/grappler/costs/virtual_scheduler.cc index c68d4e31c4..e5073d6301 100644 --- a/tensorflow/core/grappler/costs/virtual_scheduler.cc +++ b/tensorflow/core/grappler/costs/virtual_scheduler.cc @@ -244,8 +244,8 @@ string VirtualScheduler::DeviceName(const NodeDef* node) const { string VirtualScheduler::ChannelDeviceName(const NodeDef* from, const NodeDef* to) const { CHECK(!initialized_) << "ChannelDeviceName is called after Init()."; - - return kChannelDevice + ": " + DeviceName(from) + " to " + DeviceName(to); + return kChannelDevice + ": from " + DeviceName(from) + " to " + + DeviceName(to); } std::pair<const NodeDef*, const NodeDef*> VirtualScheduler::CreateSendRecv( @@ -318,8 +318,8 @@ NodeInfo VirtualScheduler::GetCurrNodeInfo() const { } // Construct NodeInfo. - const auto& node_state = node_map_.at(node); NodeInfo node_info; + const auto& node_state = node_map_.at(node); node_info.name = node->name(); node_info.device_name = node_state.device_name; auto& op_info = node_info.op_info; @@ -577,6 +577,7 @@ Costs VirtualScheduler::Summary() const { << " GB, at the end: " << state.memory_usage << " B"; VLOG(1) << "Per-op execution time (and memory usage at peak memory usage):"; + // Profile non-persistent op memory usage. for (const auto& node_port : state.mem_usage_snapshot_at_peak) { const auto* node = node_port.first; @@ -617,5 +618,30 @@ Costs VirtualScheduler::Summary() const { return critical_path_costs; } +Costs VirtualScheduler::Summary(StepStats* stepstats) { + if (stepstats != nullptr) { + for (const auto& device : device_) { + DeviceStepStats* device_stepstats = stepstats->add_dev_stats(); + device_stepstats->set_device(device.first); + for (const auto& node_def : device.second.nodes_executed) { + const NodeState& nodestate = node_map_.at(node_def); + NodeExecStats* node_stats = device_stepstats->add_node_stats(); + node_stats->set_node_name(node_def->op()); + node_stats->set_timeline_label(node_def->name()); + node_stats->set_op_start_rel_micros(0); + node_stats->set_all_start_micros( + nodestate.time_scheduled.asMicroSeconds().count()); + node_stats->set_op_end_rel_micros( + nodestate.time_finished.asMicroSeconds().count() - + nodestate.time_scheduled.asMicroSeconds().count()); + node_stats->set_all_end_rel_micros( + nodestate.time_finished.asMicroSeconds().count() - + nodestate.time_scheduled.asMicroSeconds().count()); + } + } + } + return Summary(); +} + } // end namespace grappler } // end namespace tensorflow |