tensorboard-plugin-profile 2.15.0__tar.gz → 2.15.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/PKG-INFO +3 -6
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/dcn_collective_stats_proto_to_gviz.py +56 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/input_pipeline_proto_to_gviz.py +2 -1
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/raw_to_tool_data.py +34 -8
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/integration_tests/tpu/tensorflow/tpu_tf2_keras_test.py +3 -3
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/profile_plugin.py +49 -22
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/overview_page_pb2.py +18 -18
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/static/bundle.js +12970 -12680
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/static/index.html +3 -22
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/static/trace_viewer_index.html +46 -31
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/static/trace_viewer_index.js +503 -209
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/version.py +1 -1
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile.egg-info/PKG-INFO +3 -6
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile.egg-info/entry_points.txt +1 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/README.rst +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/setup.cfg +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/setup.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/__init__.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/diagnostics.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/kernel_stats_proto_to_gviz.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/overview_page_proto_to_gviz.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/tf_data_stats_proto_to_gviz.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/tf_stats_proto_to_gviz.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/convert/trace_events_json.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/integration_tests/tf_mnist.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/integration_tests/tf_profiler_session.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/profile_plugin_loader.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/dcn_slack_analysis_pb2.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/diagnostics_pb2.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/input_pipeline_pb2.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/kernel_stats_pb2.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/power_metrics_pb2.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/tf_data_stats_pb2.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/tf_stats_pb2.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/protobuf/trace_events_pb2.py +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/static/index.js +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/static/materialicons.woff2 +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/static/styles.css +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile/static/zone.js +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile.egg-info/SOURCES.txt +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile.egg-info/dependency_links.txt +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile.egg-info/requires.txt +0 -0
- {tensorboard_plugin_profile-2.15.0 → tensorboard_plugin_profile-2.15.2}/tensorboard_plugin_profile.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tensorboard_plugin_profile
|
|
3
|
-
Version: 2.15.
|
|
3
|
+
Version: 2.15.2
|
|
4
4
|
Summary: Profile Tensorboard Plugin
|
|
5
5
|
Home-page: https://github.com/tensorflow/profiler
|
|
6
6
|
Author: Google Inc.
|
|
7
7
|
Author-email: packages@tensorflow.org
|
|
8
8
|
License: Apache 2.0
|
|
9
9
|
Keywords: tensorflow tensorboard xprof profile plugin
|
|
10
|
+
Platform: UNKNOWN
|
|
10
11
|
Classifier: Intended Audience :: Developers
|
|
11
12
|
Classifier: Intended Audience :: Education
|
|
12
13
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -17,10 +18,6 @@ Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
|
17
18
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
19
|
Classifier: Topic :: Software Development :: Libraries
|
|
19
20
|
Requires-Python: >= 2.7, != 3.0.*, != 3.1.*
|
|
20
|
-
Requires-Dist: gviz_api>=1.9.0
|
|
21
|
-
Requires-Dist: protobuf<5.0.0dev,>=3.19.6
|
|
22
|
-
Requires-Dist: setuptools>=41.0.0
|
|
23
|
-
Requires-Dist: six>=1.10.0
|
|
24
|
-
Requires-Dist: werkzeug>=0.11.15
|
|
25
21
|
|
|
26
22
|
Profile Tensorboard Plugin
|
|
23
|
+
|
|
@@ -22,10 +22,52 @@ from __future__ import absolute_import
|
|
|
22
22
|
from __future__ import division
|
|
23
23
|
from __future__ import print_function
|
|
24
24
|
|
|
25
|
+
import sys
|
|
26
|
+
|
|
25
27
|
import gviz_api
|
|
26
28
|
|
|
27
29
|
from tensorboard_plugin_profile.protobuf import dcn_slack_analysis_pb2
|
|
28
30
|
|
|
31
|
+
_BYTES_TO_GIGABITS_CONVERSION_FACTOR = 8e-9
|
|
32
|
+
_MICRO_TO_SECONDS_CONVERSION_FACTOR = 1e-6
|
|
33
|
+
_BANDWIDTH_CONVERSION_FACTOR = (
|
|
34
|
+
_BYTES_TO_GIGABITS_CONVERSION_FACTOR / _MICRO_TO_SECONDS_CONVERSION_FACTOR
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def convert_bytes_to_human_readable_format(value):
|
|
39
|
+
"""Convert number of bytes to a human readable format (e.g. 10 KB).
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
value: bytes to convert.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
str: Human readable representation of data.
|
|
46
|
+
"""
|
|
47
|
+
suffix_list = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
|
|
48
|
+
|
|
49
|
+
base = 1000
|
|
50
|
+
actual_bytes = float(value)
|
|
51
|
+
abs_bytes = abs(actual_bytes)
|
|
52
|
+
|
|
53
|
+
if abs_bytes == 1:
|
|
54
|
+
return "%d Byte" % actual_bytes
|
|
55
|
+
|
|
56
|
+
if abs_bytes < base:
|
|
57
|
+
return "%d Bytes" % actual_bytes
|
|
58
|
+
|
|
59
|
+
unit = base**2
|
|
60
|
+
suffix = suffix_list[0]
|
|
61
|
+
index = 0
|
|
62
|
+
while index < len(suffix_list):
|
|
63
|
+
unit = base ** (index + 2)
|
|
64
|
+
suffix = suffix_list[index]
|
|
65
|
+
if abs_bytes < unit:
|
|
66
|
+
break
|
|
67
|
+
index += 1
|
|
68
|
+
|
|
69
|
+
return "{0} {1}".format(base * actual_bytes / unit, suffix)
|
|
70
|
+
|
|
29
71
|
|
|
30
72
|
def get_dcn_collective_stats_table_args(dcn_slack_analysis):
|
|
31
73
|
"""Creates a gviz DataTable object from DcnSlackAnalysis proto.
|
|
@@ -45,6 +87,9 @@ def get_dcn_collective_stats_table_args(dcn_slack_analysis):
|
|
|
45
87
|
("observedDuration", "number", "Observed Duration (ms)"),
|
|
46
88
|
("stallDuration", "number", "Stall Duration (ms)"),
|
|
47
89
|
("occurrences", "number", "Occurrences"),
|
|
90
|
+
("totalStallDuration", "number", "Aggregated Total Stall (ms)"),
|
|
91
|
+
("dataTransmittedSize", "string", "Data Transmitted Size"),
|
|
92
|
+
("requiredBandwidth", "number", "Required Bandwidth (Gbps)"),
|
|
48
93
|
]
|
|
49
94
|
|
|
50
95
|
data = []
|
|
@@ -57,7 +102,18 @@ def get_dcn_collective_stats_table_args(dcn_slack_analysis):
|
|
|
57
102
|
slack.observed_duration_us / 1000,
|
|
58
103
|
slack.stall_duration_us / 1000,
|
|
59
104
|
slack.occurrences,
|
|
105
|
+
(slack.stall_duration_us * slack.occurrences) / 1000,
|
|
106
|
+
convert_bytes_to_human_readable_format(
|
|
107
|
+
slack.bytes_transmitted_over_network
|
|
108
|
+
),
|
|
60
109
|
]
|
|
110
|
+
if slack.slack_us == 0:
|
|
111
|
+
row.append(float(sys.maxsize))
|
|
112
|
+
else:
|
|
113
|
+
row.append(
|
|
114
|
+
(slack.bytes_transmitted_over_network / slack.slack_us)
|
|
115
|
+
* _BANDWIDTH_CONVERSION_FACTOR
|
|
116
|
+
)
|
|
61
117
|
data.append(row)
|
|
62
118
|
|
|
63
119
|
return (table_description, data, [])
|
|
@@ -52,6 +52,7 @@ def get_step_breakdown_table_args(ipa):
|
|
|
52
52
|
("tooltip", "string", "tooltip", {
|
|
53
53
|
"role": "tooltip"
|
|
54
54
|
}),
|
|
55
|
+
("stepTimeMs", "number", "Step time"),
|
|
55
56
|
]
|
|
56
57
|
|
|
57
58
|
# Parameters for input analysis summary.
|
|
@@ -94,7 +95,7 @@ def get_step_breakdown_table_args(ipa):
|
|
|
94
95
|
details.host_compute_ms, details.host_prepare_ms,
|
|
95
96
|
details.host_wait_input_ms + details.host_to_device_ms,
|
|
96
97
|
details.output_ms, details.host_compile_ms, details.unknown_time_ms,
|
|
97
|
-
tooltip
|
|
98
|
+
tooltip, details.step_time_ms,
|
|
98
99
|
]
|
|
99
100
|
data.append(row)
|
|
100
101
|
|
|
@@ -58,10 +58,11 @@ def xspace_to_tools_data_from_byte_string(xspace_byte_list, filenames, tool,
|
|
|
58
58
|
Returns:
|
|
59
59
|
Returns a string of tool data.
|
|
60
60
|
"""
|
|
61
|
-
|
|
62
|
-
def xspace_wrapper_func(xspace_arg, tool_arg):
|
|
61
|
+
# pylint:disable=dangerous-default-value
|
|
62
|
+
def xspace_wrapper_func(xspace_arg, tool_arg, params={}):
|
|
63
63
|
return _pywrap_profiler.xspace_to_tools_data_from_byte_string(
|
|
64
|
-
xspace_arg, filenames, tool_arg)
|
|
64
|
+
xspace_arg, filenames, tool_arg, params)
|
|
65
|
+
# pylint:enable=dangerous-default-value
|
|
65
66
|
|
|
66
67
|
return xspace_to_tool_data(xspace_byte_list, tool, params,
|
|
67
68
|
xspace_wrapper_func)
|
|
@@ -95,7 +96,7 @@ def xspace_to_tool_data(
|
|
|
95
96
|
tool: A string of tool name.
|
|
96
97
|
params: user input parameters.
|
|
97
98
|
xspace_wrapper_func: A callable that takes a list of strings and a tool and
|
|
98
|
-
returns the raw data.
|
|
99
|
+
returns the raw data. If failed, raw data contains the error message.
|
|
99
100
|
|
|
100
101
|
Returns:
|
|
101
102
|
Returns a string of tool data and the content type for the response.
|
|
@@ -116,7 +117,9 @@ def xspace_to_tool_data(
|
|
|
116
117
|
# Streaming trace viewer handles one host at a time.
|
|
117
118
|
assert len(xspace_paths) == 1
|
|
118
119
|
options = params.get('trace_viewer_options', {})
|
|
119
|
-
|
|
120
|
+
raw_data, success = xspace_wrapper_func(xspace_paths, tool, options)
|
|
121
|
+
if success:
|
|
122
|
+
data = raw_data
|
|
120
123
|
elif tool == 'overview_page':
|
|
121
124
|
raw_data, success = xspace_wrapper_func(xspace_paths, tool)
|
|
122
125
|
if success:
|
|
@@ -125,13 +128,22 @@ def xspace_to_tool_data(
|
|
|
125
128
|
raw_data, success = xspace_wrapper_func(xspace_paths, tool)
|
|
126
129
|
if success:
|
|
127
130
|
data = input_pipeline_proto_to_gviz.to_json(raw_data)
|
|
128
|
-
elif tool == '
|
|
131
|
+
elif tool == 'framework_op_stats':
|
|
129
132
|
raw_data, success = xspace_wrapper_func(xspace_paths, tool)
|
|
130
133
|
if success:
|
|
131
134
|
if tqx == 'out:csv':
|
|
132
135
|
data = tf_stats_proto_to_gviz.to_csv(raw_data)
|
|
133
136
|
else:
|
|
134
137
|
data = tf_stats_proto_to_gviz.to_json(raw_data)
|
|
138
|
+
# Try legacy tool name: Handle backward compatibility with lower TF version
|
|
139
|
+
else:
|
|
140
|
+
legacy_tool = 'tensorflow_stats'
|
|
141
|
+
raw_data, success = xspace_wrapper_func(xspace_paths, legacy_tool)
|
|
142
|
+
if success:
|
|
143
|
+
if tqx == 'out:csv':
|
|
144
|
+
data = tf_stats_proto_to_gviz.to_csv(raw_data)
|
|
145
|
+
else:
|
|
146
|
+
data = tf_stats_proto_to_gviz.to_json(raw_data)
|
|
135
147
|
elif tool == 'kernel_stats':
|
|
136
148
|
raw_data, success = xspace_wrapper_func(xspace_paths, tool)
|
|
137
149
|
if success:
|
|
@@ -163,11 +175,25 @@ def xspace_to_tool_data(
|
|
|
163
175
|
if success:
|
|
164
176
|
data = raw_data
|
|
165
177
|
content_type = 'text/html'
|
|
178
|
+
else:
|
|
179
|
+
# TODO(tf-profiler) Handle errors for other tools as well,
|
|
180
|
+
# to pass along the error message to client
|
|
181
|
+
if isinstance(raw_data, bytes):
|
|
182
|
+
raw_data = raw_data.decode('utf-8')
|
|
183
|
+
raise ValueError(raw_data)
|
|
166
184
|
elif tool == 'memory_viewer':
|
|
167
|
-
|
|
185
|
+
view_memory_allocation_timeline = params.get(
|
|
186
|
+
'view_memory_allocation_timeline', False
|
|
187
|
+
)
|
|
188
|
+
options = {
|
|
189
|
+
'module_name': params.get('host'),
|
|
190
|
+
'view_memory_allocation_timeline': view_memory_allocation_timeline,
|
|
191
|
+
}
|
|
168
192
|
raw_data, success = xspace_wrapper_func(xspace_paths, tool, options)
|
|
169
193
|
if success:
|
|
170
194
|
data = raw_data
|
|
195
|
+
if view_memory_allocation_timeline:
|
|
196
|
+
content_type = 'text/html'
|
|
171
197
|
elif tool == 'dcn_collective_stats':
|
|
172
198
|
options = {'host_name': params.get('host')}
|
|
173
199
|
raw_data, success = xspace_wrapper_func(xspace_paths, tool, options)
|
|
@@ -194,7 +220,7 @@ def tool_proto_to_tool_data(tool_proto, tool, params):
|
|
|
194
220
|
tqx = params.get('tqx', '')
|
|
195
221
|
if tool == 'trace_viewer':
|
|
196
222
|
data = process_raw_trace(tool_proto)
|
|
197
|
-
elif tool == '
|
|
223
|
+
elif tool == 'framework_op_stats':
|
|
198
224
|
if tqx == 'out:csv;':
|
|
199
225
|
data = tf_stats_proto_to_gviz.to_csv(tool_proto)
|
|
200
226
|
else:
|
|
@@ -101,7 +101,7 @@ class TpuKerasTest(absltest.TestCase):
|
|
|
101
101
|
'trace_viewer@^',
|
|
102
102
|
'overview_page^',
|
|
103
103
|
'input_pipeline_analyzer^',
|
|
104
|
-
'
|
|
104
|
+
'framework_op_stats^',
|
|
105
105
|
'memory_profile^',
|
|
106
106
|
'pod_viewer^',
|
|
107
107
|
'tf_data_bottleneck_analysis^',
|
|
@@ -156,8 +156,8 @@ class TpuKerasTest(absltest.TestCase):
|
|
|
156
156
|
process_names.append((event['args']['name']))
|
|
157
157
|
self.assertContainsSubset(
|
|
158
158
|
[
|
|
159
|
-
'
|
|
160
|
-
'
|
|
159
|
+
'Framework Name Scope',
|
|
160
|
+
'Framework Ops',
|
|
161
161
|
'XLA Modules',
|
|
162
162
|
'XLA Ops',
|
|
163
163
|
'XLA TraceMe',
|
|
@@ -73,7 +73,7 @@ TOOLS = {
|
|
|
73
73
|
'overview_page@': 'overview_page.pb',
|
|
74
74
|
'memory_viewer': 'memory_viewer.json',
|
|
75
75
|
'pod_viewer': 'pod_viewer.json',
|
|
76
|
-
'
|
|
76
|
+
'framework_op_stats': 'tensorflow_stats.pb',
|
|
77
77
|
'kernel_stats': 'kernel_stats.pb',
|
|
78
78
|
'memory_profile#': 'memory_profile.json.gz',
|
|
79
79
|
'xplane': 'xplane.pb',
|
|
@@ -99,7 +99,7 @@ XPLANE_TOOLS = [
|
|
|
99
99
|
'trace_viewer@^', # streaming since TF 2.14
|
|
100
100
|
'overview_page^',
|
|
101
101
|
'input_pipeline_analyzer^',
|
|
102
|
-
'
|
|
102
|
+
'framework_op_stats^',
|
|
103
103
|
'kernel_stats^',
|
|
104
104
|
'memory_profile^',
|
|
105
105
|
'pod_viewer^',
|
|
@@ -110,7 +110,7 @@ XPLANE_TOOLS = [
|
|
|
110
110
|
# XPlane generated tools that support all host mode.
|
|
111
111
|
XPLANE_TOOLS_ALL_HOSTS_SUPPORTED = frozenset([
|
|
112
112
|
'input_pipeline_analyzer^',
|
|
113
|
-
'
|
|
113
|
+
'framework_op_stats^',
|
|
114
114
|
'kernel_stats^',
|
|
115
115
|
'overview_page^',
|
|
116
116
|
'pod_viewer^',
|
|
@@ -478,7 +478,7 @@ class ProfilePlugin(base_plugin.TBPlugin):
|
|
|
478
478
|
try:
|
|
479
479
|
contents = self._read_static_file_impl(filename)
|
|
480
480
|
except IOError:
|
|
481
|
-
return respond('
|
|
481
|
+
return respond('Fail to read the files.', 'text/plain', code=404)
|
|
482
482
|
return respond(contents, mimetype)
|
|
483
483
|
|
|
484
484
|
@wrappers.Request.application
|
|
@@ -493,7 +493,7 @@ class ProfilePlugin(base_plugin.TBPlugin):
|
|
|
493
493
|
request: Optional; werkzeug request used for grabbing ctx and experiment
|
|
494
494
|
id for other host implementations
|
|
495
495
|
"""
|
|
496
|
-
return list(self.generate_runs())
|
|
496
|
+
return sorted(list(self.generate_runs()), reverse=True)
|
|
497
497
|
|
|
498
498
|
@wrappers.Request.application
|
|
499
499
|
def run_tools_route(self, request):
|
|
@@ -511,6 +511,20 @@ class ProfilePlugin(base_plugin.TBPlugin):
|
|
|
511
511
|
"""
|
|
512
512
|
return list(self.generate_tools_of_run(run))
|
|
513
513
|
|
|
514
|
+
def _run_host_impl(self, run, run_dir, tool):
|
|
515
|
+
if not run_dir:
|
|
516
|
+
logger.warning('Cannot find asset directory for: %s', run)
|
|
517
|
+
return []
|
|
518
|
+
tool_pattern = make_filename('*', tool)
|
|
519
|
+
filenames = []
|
|
520
|
+
try:
|
|
521
|
+
filenames = tf.io.gfile.glob(os.path.join(run_dir, tool_pattern))
|
|
522
|
+
except tf.errors.OpError as e:
|
|
523
|
+
logger.warning('Cannot read asset directory: %s, OpError %s', run_dir, e)
|
|
524
|
+
filenames = [os.path.basename(f) for f in filenames]
|
|
525
|
+
|
|
526
|
+
return filenames_to_hosts(filenames, tool)
|
|
527
|
+
|
|
514
528
|
def host_impl(self, run, tool, request=None):
|
|
515
529
|
"""Returns available hosts for the run and tool in the log directory.
|
|
516
530
|
|
|
@@ -550,18 +564,7 @@ class ProfilePlugin(base_plugin.TBPlugin):
|
|
|
550
564
|
host_impl(run1, memory_viewer) --> ["module1", "module2"]
|
|
551
565
|
"""
|
|
552
566
|
run_dir = self._run_dir(run)
|
|
553
|
-
|
|
554
|
-
logger.warning('Cannot find asset directory for: %s', run)
|
|
555
|
-
return []
|
|
556
|
-
tool_pattern = make_filename('*', tool)
|
|
557
|
-
filenames = []
|
|
558
|
-
try:
|
|
559
|
-
filenames = tf.io.gfile.glob(os.path.join(run_dir, tool_pattern))
|
|
560
|
-
except tf.errors.OpError as e:
|
|
561
|
-
logger.warning('Cannot read asset directory: %s, OpError %s', run_dir, e)
|
|
562
|
-
filenames = [os.path.basename(f) for f in filenames]
|
|
563
|
-
|
|
564
|
-
return filenames_to_hosts(filenames, tool)
|
|
567
|
+
return self._run_host_impl(run, run_dir, tool)
|
|
565
568
|
|
|
566
569
|
@wrappers.Request.application
|
|
567
570
|
def hosts_route(self, request):
|
|
@@ -599,6 +602,11 @@ class ProfilePlugin(base_plugin.TBPlugin):
|
|
|
599
602
|
if tool not in TOOLS and not use_xplane(tool):
|
|
600
603
|
return None, content_type, None
|
|
601
604
|
|
|
605
|
+
if tool == 'memory_viewer^' and request.args.get(
|
|
606
|
+
'view_memory_allocation_timeline'
|
|
607
|
+
):
|
|
608
|
+
params['view_memory_allocation_timeline'] = True
|
|
609
|
+
|
|
602
610
|
if tool == 'trace_viewer@^':
|
|
603
611
|
options = {}
|
|
604
612
|
options['resolution'] = request.args.get('resolution', 8000)
|
|
@@ -619,14 +627,23 @@ class ProfilePlugin(base_plugin.TBPlugin):
|
|
|
619
627
|
except tf.errors.OpError as e:
|
|
620
628
|
logger.warning('Cannot read asset directory: %s, OpError %s', run_dir,
|
|
621
629
|
e)
|
|
630
|
+
raise IOError(
|
|
631
|
+
'Cannot read asset directory: %s, OpError %s' % (run_dir, e)
|
|
632
|
+
) from e
|
|
622
633
|
else:
|
|
623
634
|
asset_paths = [asset_path]
|
|
624
635
|
|
|
625
636
|
try:
|
|
626
637
|
data, content_type = convert.xspace_to_tool_data(
|
|
627
638
|
asset_paths, tool, params)
|
|
628
|
-
except AttributeError:
|
|
639
|
+
except AttributeError as e:
|
|
629
640
|
logger.warning('XPlane converters are available after Tensorflow 2.4')
|
|
641
|
+
raise AttributeError(
|
|
642
|
+
'XPlane converters are available after Tensorflow 2.4'
|
|
643
|
+
) from e
|
|
644
|
+
except ValueError as e:
|
|
645
|
+
logger.warning('XPlane convert to tool data failed as %s', e)
|
|
646
|
+
raise e
|
|
630
647
|
return data, content_type, content_encoding
|
|
631
648
|
|
|
632
649
|
raw_data = None
|
|
@@ -647,10 +664,18 @@ class ProfilePlugin(base_plugin.TBPlugin):
|
|
|
647
664
|
def data_route(self, request):
|
|
648
665
|
# params
|
|
649
666
|
# request: XMLHTTPRequest.
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
667
|
+
try:
|
|
668
|
+
data, content_type, content_encoding = self.data_impl(request)
|
|
669
|
+
if data is None:
|
|
670
|
+
return respond('No Data', 'text/plain', code=404)
|
|
671
|
+
return respond(data, content_type, content_encoding=content_encoding)
|
|
672
|
+
# Data fetch error handler
|
|
673
|
+
except AttributeError as e:
|
|
674
|
+
return respond(str(e), 'text/plain', code=500)
|
|
675
|
+
except ValueError as e:
|
|
676
|
+
return respond(str(e), 'text/plain', code=500)
|
|
677
|
+
except IOError as e:
|
|
678
|
+
return respond(str(e), 'text/plain', code=500)
|
|
654
679
|
|
|
655
680
|
@wrappers.Request.application
|
|
656
681
|
def capture_route(self, request):
|
|
@@ -889,9 +914,11 @@ class ProfilePlugin(base_plugin.TBPlugin):
|
|
|
889
914
|
# the trailing '@' is to inform tf-profile-dashboard.html and
|
|
890
915
|
# tf-trace-viewer.html that stream trace viewer should be used.
|
|
891
916
|
tools.discard('trace_viewer#')
|
|
917
|
+
tools.discard('trace_viewer^')
|
|
892
918
|
tools.discard('trace_viewer')
|
|
893
919
|
if 'trace_viewer#' in tools:
|
|
894
920
|
# use compressed trace
|
|
921
|
+
tools.discard('trace_viewer^')
|
|
895
922
|
tools.discard('trace_viewer')
|
|
896
923
|
# Return sorted list of tools with 'overview_page' at the front.
|
|
897
924
|
op = frozenset(['overview_page@', 'overview_page', 'overview_page^'])
|
|
@@ -18,7 +18,7 @@ from tensorboard_plugin_profile.protobuf import input_pipeline_pb2 as plugin_dot
|
|
|
18
18
|
from tensorboard_plugin_profile.protobuf import power_metrics_pb2 as plugin_dot_tensorboard__plugin__profile_dot_protobuf_dot_power__metrics__pb2
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n>plugin/tensorboard_plugin_profile/protobuf/overview_page.proto\x12\x13tensorflow.profiler\x1a\x19google/protobuf/any.proto\x1a<plugin/tensorboard_plugin_profile/protobuf/diagnostics.proto\x1a?plugin/tensorboard_plugin_profile/protobuf/input_pipeline.proto\x1a>plugin/tensorboard_plugin_profile/protobuf/power_metrics.proto\"\xc2\x01\n\x0cOverviewTfOp\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x10\n\x08\x63\x61tegory\x18\x02 \x01(\t\x12\x1a\n\x12self_time_fraction\x18\x03 \x01(\x01\x12 \n\x18\x63umulative_time_fraction\x18\x04 \x01(\x01\x12\x11\n\tflop_rate\x18\x05 \x01(\x01\x12!\n\x19is_op_tensorcore_eligible\x18\x06 \x01(\x08\x12\x1e\n\x16is_op_using_tensorcore\x18\x07 \x01(\x08\"\
|
|
21
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n>plugin/tensorboard_plugin_profile/protobuf/overview_page.proto\x12\x13tensorflow.profiler\x1a\x19google/protobuf/any.proto\x1a<plugin/tensorboard_plugin_profile/protobuf/diagnostics.proto\x1a?plugin/tensorboard_plugin_profile/protobuf/input_pipeline.proto\x1a>plugin/tensorboard_plugin_profile/protobuf/power_metrics.proto\"\xc2\x01\n\x0cOverviewTfOp\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x10\n\x08\x63\x61tegory\x18\x02 \x01(\t\x12\x1a\n\x12self_time_fraction\x18\x03 \x01(\x01\x12 \n\x18\x63umulative_time_fraction\x18\x04 \x01(\x01\x12\x11\n\tflop_rate\x18\x05 \x01(\x01\x12!\n\x19is_op_tensorcore_eligible\x18\x06 \x01(\x08\x12\x1e\n\x16is_op_using_tensorcore\x18\x07 \x01(\x08\"\xea\x08\n\x14OverviewPageAnalysis\x12\x1f\n\x17mxu_utilization_percent\x18\x01 \x01(\x01\x12 \n\x18\x64\x65vice_idle_time_percent\x18\x02 \x01(\x01\x12\x1e\n\x16host_idle_time_percent\x18\x03 \x01(\x01\x12\x39\n\x0etop_device_ops\x18\x04 \x03(\x0b\x32!.tensorflow.profiler.OverviewTfOp\x12\x13\n\x0bremark_text\x18\x05 \x01(\t\x12\x14\n\x0cremark_color\x18\x06 \x01(\t\x12:\n2flop_rate_utilization_relative_to_roofline_percent\x18\x07 \x01(\x01\x12:\n2memory_bw_utilization_relative_to_hw_limit_percent\x18\x08 \x01(\x01\x12$\n\x1c\x64\x65vice_compute_16bit_percent\x18\t \x01(\x01\x12$\n\x1c\x64\x65vice_compute_32bit_percent\x18\n \x01(\x01\x12\x1a\n\x12host_tf_op_percent\x18\x0b \x01(\x01\x12\x1c\n\x14\x64\x65vice_tf_op_percent\x18\x0c \x01(\x01\x12\x18\n\x10host_trace_level\x18\r \x01(\r\x12\"\n\x1ahost_op_time_eager_percent\x18\x0e \x01(\x01\x12$\n\x1c\x64\x65vice_op_time_eager_percent\x18\x0f \x01(\x01\x12\x32\n*device_op_time_outside_compilation_percent\x18\x10 \x01(\x01\x12!\n\x19\x64\x65vice_duty_cycle_percent\x18\x11 \x01(\x01\x12\x1f\n\x17program_goodput_percent\x18\x12 \x01(\x01\x12\x1f\n\x17sc_step_time_ms_average\x18\x13 \x01(\x01\x12\x1d\n\x15sc_infeed_time_ms_avg\x18\x14 \x01(\x01\x12\x1e\n\x16sc_outfeed_time_ms_avg\x18\x15 \x01(\x01\x12\x1b\n\x13sc_idle_time_ms_avg\x18\x16 \x01(\x01\x12\'\n\x1f\x66w_max_vdd_core_pl1_power_watts\x18\x17 \x01(\x01\x12\'\n\x1f\x66w_max_vdd_core_pl2_power_watts\x18\x18 \x01(\x01\x12\'\n\x1f\x66w_max_vdd_core_pl3_power_watts\x18\x19 \x01(\x01\x12\'\n\x1f\x66w_max_vdd_core_pl4_power_watts\x18\x1a \x01(\x01\x12\"\n\x1a\x66w_max_hbm_pl1_power_watts\x18\x1b \x01(\x01\x12\"\n\x1a\x66w_max_hbm_pl2_power_watts\x18\x1c \x01(\x01\x12\"\n\x1a\x66w_max_hbm_pl3_power_watts\x18\x1d \x01(\x01\x12\"\n\x1a\x66w_max_hbm_pl4_power_watts\x18\x1e \x01(\x01\"\x1f\n\x0fOverviewPageTip\x12\x0c\n\x04link\x18\x01 \x01(\t\"\xff\x01\n\x15GenericRecommendation\x12 \n\x18kernel_launch_bottleneck\x18\x01 \x01(\t\x12\x1f\n\x17kernel_launch_statement\x18\x02 \x01(\t\x12\x1c\n\x14\x61ll_other_bottleneck\x18\x03 \x01(\t\x12\x1b\n\x13\x61ll_other_statement\x18\x04 \x01(\t\x12\x1b\n\x13precision_statement\x18\x05 \x01(\t\x12%\n\x1d\x64\x65vice_collectives_bottleneck\x18\x06 \x01(\t\x12$\n\x1c\x64\x65vice_collectives_statement\x18\x07 \x01(\t\"\xdf\x04\n\x1aOverviewPageRecommendation\x12\x12\n\nbottleneck\x18\x01 \x01(\t\x12\x11\n\tstatement\x18\x02 \x01(\t\x12\x38\n\ninput_tips\x18\x0b \x03(\x0b\x32$.tensorflow.profiler.OverviewPageTip\x12\x18\n\x10output_statement\x18\t \x01(\t\x12\x1c\n\x14\x65\x61ger_statement_html\x18\x0c \x01(\t\x12*\n\"outside_compilation_statement_html\x18\r \x01(\t\x12\"\n\x1atf_function_statement_html\x18\n \x01(\t\x12\x37\n\thost_tips\x18\x03 \x03(\x0b\x32$.tensorflow.profiler.OverviewPageTip\x12\x39\n\x0b\x64\x65vice_tips\x18\x04 \x03(\x0b\x32$.tensorflow.profiler.OverviewPageTip\x12@\n\x12\x64ocumentation_tips\x18\x05 \x03(\x0b\x32$.tensorflow.profiler.OverviewPageTip\x12,\n\x0erecommendation\x18\x06 \x01(\x0b\x32\x14.google.protobuf.Any\x12\x36\n\x08\x66\x61q_tips\x18\x07 \x03(\x0b\x32$.tensorflow.profiler.OverviewPageTip\x12<\n\x0einference_tips\x18\x08 \x03(\x0b\x32$.tensorflow.profiler.OverviewPageTip\"\x80\x01\n\"OverviewPageHostIndependentJobInfo\x12\x13\n\x0b\x63hange_list\x18\x01 \x01(\x03\x12\x12\n\nbuild_time\x18\x02 \x01(\x03\x12\x14\n\x0c\x62uild_target\x18\x03 \x01(\t\x12\x1b\n\x13profile_duration_ms\x18\x04 \x01(\r\"\x8b\x01\n OverviewPageHostDependentJobInfo\x12\x0f\n\x07host_id\x18\x01 \x01(\t\x12\x14\n\x0c\x63ommand_line\x18\x02 \x01(\t\x12\x12\n\nstart_time\x18\x03 \x01(\x03\x12\x13\n\x0b\x62ns_address\x18\x04 \x01(\t\x12\x17\n\x0fprofile_time_ns\x18\x05 \x01(\x04\"\xb8\x04\n\x1aOverviewPageRunEnvironment\x12\x12\n\nhost_count\x18\x01 \x01(\x05\x12\x12\n\ntask_count\x18\x02 \x01(\x05\x12Q\n\thostnames\x18\x03 \x03(\x0b\x32>.tensorflow.profiler.OverviewPageRunEnvironment.HostnamesEntry\x12\x13\n\x0b\x64\x65vice_type\x18\x04 \x01(\t\x12\x19\n\x11\x64\x65vice_core_count\x18\x05 \x01(\x05\x12Z\n\x19host_independent_job_info\x18\x07 \x01(\x0b\x32\x37.tensorflow.profiler.OverviewPageHostIndependentJobInfo\x12V\n\x17host_dependent_job_info\x18\x08 \x03(\x0b\x32\x35.tensorflow.profiler.OverviewPageHostDependentJobInfo\x12\x15\n\rreplica_count\x18\t \x01(\x05\x12\x1d\n\x15num_cores_per_replica\x18\n \x01(\x05\x12\x13\n\x0bis_training\x18\x0b \x01(\x08\x12\x38\n\rpower_metrics\x18\x0c \x01(\x0b\x32!.tensorflow.profiler.PowerMetrics\x1a\x30\n\x0eHostnamesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01J\x04\x08\x06\x10\x07\"\xf1\x02\n\x0cOverviewPage\x12H\n\x0frun_environment\x18\x06 \x01(\x0b\x32/.tensorflow.profiler.OverviewPageRunEnvironment\x12H\n\x0einput_analysis\x18\x02 \x01(\x0b\x32\x30.tensorflow.profiler.InputPipelineAnalysisResult\x12;\n\x08\x61nalysis\x18\x03 \x01(\x0b\x32).tensorflow.profiler.OverviewPageAnalysis\x12G\n\x0erecommendation\x18\x04 \x01(\x0b\x32/.tensorflow.profiler.OverviewPageRecommendation\x12\x35\n\x0b\x64iagnostics\x18\x08 \x01(\x0b\x32 .tensorflow.profiler.DiagnosticsJ\x04\x08\x01\x10\x02J\x04\x08\x05\x10\x06J\x04\x08\x07\x10\x08\x62\x06proto3')
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -111,21 +111,21 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
|
|
111
111
|
_OVERVIEWTFOP._serialized_start=306
|
|
112
112
|
_OVERVIEWTFOP._serialized_end=500
|
|
113
113
|
_OVERVIEWPAGEANALYSIS._serialized_start=503
|
|
114
|
-
_OVERVIEWPAGEANALYSIS._serialized_end=
|
|
115
|
-
_OVERVIEWPAGETIP._serialized_start=
|
|
116
|
-
_OVERVIEWPAGETIP._serialized_end=
|
|
117
|
-
_GENERICRECOMMENDATION._serialized_start=
|
|
118
|
-
_GENERICRECOMMENDATION._serialized_end=
|
|
119
|
-
_OVERVIEWPAGERECOMMENDATION._serialized_start=
|
|
120
|
-
_OVERVIEWPAGERECOMMENDATION._serialized_end=
|
|
121
|
-
_OVERVIEWPAGEHOSTINDEPENDENTJOBINFO._serialized_start=
|
|
122
|
-
_OVERVIEWPAGEHOSTINDEPENDENTJOBINFO._serialized_end=
|
|
123
|
-
_OVERVIEWPAGEHOSTDEPENDENTJOBINFO._serialized_start=
|
|
124
|
-
_OVERVIEWPAGEHOSTDEPENDENTJOBINFO._serialized_end=
|
|
125
|
-
_OVERVIEWPAGERUNENVIRONMENT._serialized_start=
|
|
126
|
-
_OVERVIEWPAGERUNENVIRONMENT._serialized_end=
|
|
127
|
-
_OVERVIEWPAGERUNENVIRONMENT_HOSTNAMESENTRY._serialized_start=
|
|
128
|
-
_OVERVIEWPAGERUNENVIRONMENT_HOSTNAMESENTRY._serialized_end=
|
|
129
|
-
_OVERVIEWPAGE._serialized_start=
|
|
130
|
-
_OVERVIEWPAGE._serialized_end=
|
|
114
|
+
_OVERVIEWPAGEANALYSIS._serialized_end=1633
|
|
115
|
+
_OVERVIEWPAGETIP._serialized_start=1635
|
|
116
|
+
_OVERVIEWPAGETIP._serialized_end=1666
|
|
117
|
+
_GENERICRECOMMENDATION._serialized_start=1669
|
|
118
|
+
_GENERICRECOMMENDATION._serialized_end=1924
|
|
119
|
+
_OVERVIEWPAGERECOMMENDATION._serialized_start=1927
|
|
120
|
+
_OVERVIEWPAGERECOMMENDATION._serialized_end=2534
|
|
121
|
+
_OVERVIEWPAGEHOSTINDEPENDENTJOBINFO._serialized_start=2537
|
|
122
|
+
_OVERVIEWPAGEHOSTINDEPENDENTJOBINFO._serialized_end=2665
|
|
123
|
+
_OVERVIEWPAGEHOSTDEPENDENTJOBINFO._serialized_start=2668
|
|
124
|
+
_OVERVIEWPAGEHOSTDEPENDENTJOBINFO._serialized_end=2807
|
|
125
|
+
_OVERVIEWPAGERUNENVIRONMENT._serialized_start=2810
|
|
126
|
+
_OVERVIEWPAGERUNENVIRONMENT._serialized_end=3378
|
|
127
|
+
_OVERVIEWPAGERUNENVIRONMENT_HOSTNAMESENTRY._serialized_start=3324
|
|
128
|
+
_OVERVIEWPAGERUNENVIRONMENT_HOSTNAMESENTRY._serialized_end=3372
|
|
129
|
+
_OVERVIEWPAGE._serialized_start=3381
|
|
130
|
+
_OVERVIEWPAGE._serialized_end=3750
|
|
131
131
|
# @@protoc_insertion_point(module_scope)
|