MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _show_compute

Method _show_compute

tensorflow/python/client/timeline.py:687–785  ·  view source on GitHub ↗

Visualize the computation activity.

(self, show_dataflow)

Source from the content-addressed store, hash-verified

685 output)
686
687 def _show_compute(self, show_dataflow):
688 """Visualize the computation activity."""
689 # extract CCTs
690 activity_cache = {}
691 for dev_stats in self._step_stats.dev_stats:
692 device_name = dev_stats.device
693 device_pid = self._device_pids[device_name]
694 is_gputrace = self._is_gputrace_device(device_name)
695 is_hosttrace = self._is_hosttrace_dvice(device_name)
696 is_launchtrace = self._is_launchtrace_device(device_name)
697 # The trace must not be hosttrace and gputrace simultaneously
698 assert not (is_gputrace and is_hosttrace)
699 for node_stats in dev_stats.node_stats:
700 # cache for the op via the correlation id (activity id)
701 if not is_launchtrace:
702 activity_cache[node_stats.correlation_id] = (node_stats, device_pid)
703 # generate chrome traces
704 for dev_stats in self._step_stats.dev_stats:
705 device_name = dev_stats.device
706 device_pid = self._device_pids[device_name]
707 is_gputrace = self._is_gputrace_device(device_name)
708 is_hosttrace = self._is_hosttrace_dvice(device_name)
709 is_launchtrace = self._is_launchtrace_device(device_name)
710 # The trace must not be hosttrace and gputrace simultaneously
711 assert not (is_gputrace and is_hosttrace)
712
713 for node_stats in dev_stats.node_stats:
714 tid = node_stats.thread_id
715 start_time = node_stats.all_start_micros
716 end_time = node_stats.all_start_micros + node_stats.all_end_rel_micros
717
718 if is_launchtrace:
719 self._emit_launch(node_stats, device_pid, activity_cache)
720 else:
721 self._emit_op(node_stats, device_pid, is_gputrace, is_hosttrace, activity_cache)
722
723 if is_gputrace or node_stats.node_name == 'RecvTensor':
724 continue
725
726 # cache for the op via the correlation id (activity id)
727 if node_stats.parent_id != 0:
728 if node_stats.parent_id in activity_cache.keys():
729 parent, parent_pid = activity_cache[node_stats.parent_id]
730 invoke_time = node_stats.all_start_micros
731 flow_id = self._alloc_flow_id()
732 flow_name = parent.node_name + ' => ' + node_stats.node_name
733 # Make sure the invoke edge can be properly displayed in chrome://tracing
734 self._chrome_trace.emit_flow_type_start("Invoke",
735 flow_name, invoke_time-1,
736 parent_pid, parent.thread_id,
737 flow_id)
738 self._chrome_trace.emit_flow_type_end("Invoke",
739 flow_name, invoke_time,
740 device_pid, node_stats.thread_id, flow_id)
741 # currently kernels cannot track dataflows
742 if is_launchtrace:
743 continue
744

Callers 1

analyze_step_statsMethod · 0.95

Calls 14

_is_gputrace_deviceMethod · 0.95
_is_hosttrace_dviceMethod · 0.95
_emit_launchMethod · 0.95
_emit_opMethod · 0.95
_alloc_flow_idMethod · 0.95
_parse_op_labelMethod · 0.95
keysMethod · 0.45
emit_flow_type_startMethod · 0.45
emit_flow_type_endMethod · 0.45
add_refMethod · 0.45
add_unrefMethod · 0.45

Tested by

no test coverage detected