@@ -41,13 +41,12 @@ def process_raw_trace(raw_trace):
4141 return '' .join (trace_events_json .TraceEventsJsonStream (trace ))
4242
4343
44- def xspace_to_tools_data_from_byte_string (xspace_byte_list , all_hosts ,
45- filenames , tool , params ):
44+ def xspace_to_tools_data_from_byte_string (xspace_byte_list , filenames , tool ,
45+ params ):
4646 """Helper function for getting an XSpace tool from a bytes string.
4747
4848 Args:
4949 xspace_byte_list: A list of byte strings read from a XSpace proto file.
50- all_hosts: A list of all hosts in the session.
5150 filenames: Names of the read files.
5251 tool: A string of tool name.
5352 params: user input parameters.
@@ -58,7 +57,7 @@ def xspace_to_tools_data_from_byte_string(xspace_byte_list, all_hosts,
5857# pylint:disable=dangerous-default-value
5958 def xspace_wrapper_func (xspace_arg , tool_arg , params = {}):
6059 return _pywrap_profiler_plugin .xspace_to_tools_data_from_byte_string (
61- xspace_arg , all_hosts , filenames , tool_arg , params )
60+ xspace_arg , filenames , tool_arg , params )
6261# pylint:enable=dangerous-default-value
6362
6463 return xspace_to_tool_data (xspace_byte_list , tool , params ,
@@ -74,26 +73,22 @@ def xspace_to_tool_names(xspace_paths):
7473 Returns:
7574 Returns a list of tool names.
7675 """
77- # xspace_to_tools_data expects all_hosts as the second argument, passing an
78- # empty list.
7976 raw_data , success = _pywrap_profiler_plugin .xspace_to_tools_data (
80- xspace_paths , [], 'tool_names' , {} )
77+ xspace_paths , 'tool_names' )
8178 if success :
8279 return [tool for tool in raw_data .decode ().split (',' )]
8380 return []
8481
8582
8683def xspace_to_tool_data (
8784 xspace_paths ,
88- all_hosts ,
8985 tool ,
9086 params ,
9187 xspace_wrapper_func = _pywrap_profiler_plugin .xspace_to_tools_data ):
9288 """Converts XSpace to tool data string.
9389
9490 Args:
9591 xspace_paths: A list of XSpace paths.
96- all_hosts: A list of all hosts in the session.
9792 tool: A string of tool name.
9893 params: user input parameters.
9994 xspace_wrapper_func: A callable that takes a list of strings and a tool and
@@ -117,31 +112,26 @@ def xspace_to_tool_data(
117112 if tool == 'trace_viewer' :
118113 # Trace viewer handles one host at a time.
119114 assert len (xspace_paths ) == 1
120- raw_data , success = xspace_wrapper_func (
121- xspace_paths , all_hosts , tool , options )
115+ raw_data , success = xspace_wrapper_func (xspace_paths , tool , options )
122116 if success :
123117 data = process_raw_trace (raw_data )
124118 elif tool == 'trace_viewer@' :
125119 options = params .get ('trace_viewer_options' , {})
126120 options ['use_saved_result' ] = params .get ('use_saved_result' , True )
127- options ['hosts' ] = all_hosts
128- raw_data , success = xspace_wrapper_func (
129- xspace_paths , all_hosts , tool , options )
121+ options ['hosts' ] = params .get ('hosts' , [])
122+ raw_data , success = xspace_wrapper_func (xspace_paths , tool , options )
130123 if success :
131124 data = raw_data
132125 elif tool == 'overview_page' :
133- json_data , success = xspace_wrapper_func (
134- xspace_paths , all_hosts , tool , options )
126+ json_data , success = xspace_wrapper_func (xspace_paths , tool , options )
135127 if success :
136128 data = json_data
137129 elif tool == 'input_pipeline_analyzer' :
138- json_data , success = xspace_wrapper_func (
139- xspace_paths , all_hosts , tool , options )
130+ json_data , success = xspace_wrapper_func (xspace_paths , tool , options )
140131 if success :
141132 data = json_data
142133 elif tool == 'framework_op_stats' :
143- json_data , success = xspace_wrapper_func (
144- xspace_paths , all_hosts , tool , options )
134+ json_data , success = xspace_wrapper_func (xspace_paths , tool , options )
145135 if success :
146136 if tqx == 'out:csv' :
147137 data = csv_writer .json_to_csv (json_data )
@@ -152,16 +142,15 @@ def xspace_to_tool_data(
152142 # TODO(b/419013992): Remove this tool completely as it has been deprecated
153143 legacy_tool = 'tensorflow_stats'
154144 json_data , success = xspace_wrapper_func (
155- xspace_paths , all_hosts , legacy_tool , options
145+ xspace_paths , legacy_tool , options
156146 )
157147 if success :
158148 if tqx == 'out:csv' :
159149 data = csv_writer .json_to_csv (json_data )
160150 else :
161151 data = json_data
162152 elif tool == 'kernel_stats' :
163- json_data , success = xspace_wrapper_func (
164- xspace_paths , all_hosts , tool , options )
153+ json_data , success = xspace_wrapper_func (xspace_paths , tool , options )
165154 if success :
166155 if tqx == 'out:csv' :
167156 data = csv_writer .json_to_csv (json_data )
@@ -170,44 +159,37 @@ def xspace_to_tool_data(
170159 elif tool == 'memory_profile' :
171160 # Memory profile handles one host at a time.
172161 assert len (xspace_paths ) == 1
173- raw_data , success = xspace_wrapper_func (
174- xspace_paths , all_hosts , tool , options )
162+ raw_data , success = xspace_wrapper_func (xspace_paths , tool , options )
175163 if success :
176164 data = raw_data
177165 elif tool == 'pod_viewer' :
178- raw_data , success = xspace_wrapper_func (
179- xspace_paths , all_hosts , tool , options )
166+ raw_data , success = xspace_wrapper_func (xspace_paths , tool , options )
180167 if success :
181168 data = raw_data
182169 elif tool == 'op_profile' :
183170 options ['group_by' ] = params .get ('group_by' , 'program' )
184- raw_data , success = xspace_wrapper_func (
185- xspace_paths , all_hosts , tool , options )
171+ raw_data , success = xspace_wrapper_func (xspace_paths , tool , options )
186172 if success :
187173 data = raw_data
188174 elif tool == 'hlo_op_profile' :
189175 options ['group_by' ] = params .get ('group_by' , 'program' )
190- raw_data , success = xspace_wrapper_func (
191- xspace_paths , all_hosts , tool , options )
176+ raw_data , success = xspace_wrapper_func (xspace_paths , tool , options )
192177 if success :
193178 data = raw_data
194179 elif tool == 'hlo_stats' :
195- json_data , success = xspace_wrapper_func (
196- xspace_paths , all_hosts , tool , options )
180+ json_data , success = xspace_wrapper_func (xspace_paths , tool , options )
197181 if success :
198182 data = json_data
199183 elif tool == 'roofline_model' :
200- json_data , success = xspace_wrapper_func (
201- xspace_paths , all_hosts , tool , options )
184+ json_data , success = xspace_wrapper_func (xspace_paths , tool , options )
202185 if success :
203186 data = json_data
204187 elif tool == 'graph_viewer' :
205188 download_hlo_types = ['pb' , 'pbtxt' , 'json' , 'short_txt' , 'long_txt' ]
206189 graph_html_type = 'graph'
207190 options = params .get ('graph_viewer_options' , {})
208191 options ['use_saved_result' ] = params .get ('use_saved_result' , True )
209- raw_data , success = xspace_wrapper_func (
210- xspace_paths , all_hosts , tool , options )
192+ raw_data , success = xspace_wrapper_func (xspace_paths , tool , options )
211193 if success :
212194 data = raw_data
213195 content_type = 'text/plain'
@@ -231,21 +213,18 @@ def xspace_to_tool_data(
231213 'view_memory_allocation_timeline' : view_memory_allocation_timeline ,
232214 'memory_space' : params .get ('memory_space' , '' ),
233215 }
234- raw_data , success = xspace_wrapper_func (
235- xspace_paths , all_hosts , tool , options )
216+ raw_data , success = xspace_wrapper_func (xspace_paths , tool , options )
236217 if success :
237218 data = raw_data
238219 if view_memory_allocation_timeline :
239220 content_type = 'text/html'
240221 elif tool == 'megascale_stats' :
241222 options = {'host_name' : params .get ('host' )}
242- json_data , success = xspace_wrapper_func (
243- xspace_paths , all_hosts , tool , options )
223+ json_data , success = xspace_wrapper_func (xspace_paths , tool , options )
244224 if success :
245225 data = json_data
246226 elif tool == 'inference_profile' :
247- json_data , success = xspace_wrapper_func (
248- xspace_paths , all_hosts , tool , options )
227+ json_data , success = xspace_wrapper_func (xspace_paths , tool , options )
249228 if success :
250229 data = json_data
251230 else :
0 commit comments