From 5288fdb27de326f8364b4397b6d24a9a28a6af03 Mon Sep 17 00:00:00 2001 From: wuyulong11 Date: Fri, 4 Aug 2023 17:18:38 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E3=80=91=20AR20230717133817=20=E5=A2=9E=E5=8A=A0DIFF=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E8=BF=9B=E8=A1=8CNPU=E4=B8=8ENPU=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=AF=94=E5=AF=B9=20=E3=80=90=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=BA=E3=80=91=20wuyulong=2030031080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tensorboard-plugins/tb_plugin/torch_tb_profiler/plugin.py | 3 +++ .../tb_plugin/torch_tb_profiler/profiler/loader.py | 3 ++- .../tb_plugin/torch_tb_profiler/profiler/run_generator.py | 1 - .../tensorboard-plugins/tb_plugin/torch_tb_profiler/run.py | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/plugin.py b/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/plugin.py index fcfaf7860..d0c6dd863 100644 --- a/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/plugin.py +++ b/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/plugin.py @@ -151,6 +151,9 @@ class TorchProfilerPlugin(base_plugin.TBPlugin): view = request.args.get('view') self._validate(run=name, view=view) run = self._get_run(name) + # Required datas are in file 'trace_view.json' in Ascend. + if run.device_target == 'Ascend' and view == 'Overview': + view = 'Trace' return self.respond_as_json(run.get_workers(view)) @wrappers.Request.application diff --git a/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/profiler/loader.py b/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/profiler/loader.py index 32a7ce323..f1574b226 100644 --- a/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/profiler/loader.py +++ b/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/profiler/loader.py @@ -30,7 +30,8 @@ class RunLoader(object): spans_by_workers = defaultdict(list) if self.device_target == 'Ascend': for path in io.listdir(self.run_dir): - if io.isdir(io.join(self.run_dir, path)) and utils.is_worker_span_dir(path): + if io.isdir(io.join(self.run_dir, path)) and utils.is_worker_span_dir(path) and io.isdir( + io.join(self.run_dir, path, 'ASCEND_PROFILER_OUTPUT')): data_path = io.join(self.run_dir, path, 'ASCEND_PROFILER_OUTPUT') for file in io.listdir(data_path): if utils.is_npu_trace_path(file) or str(file) in ( diff --git a/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/profiler/run_generator.py b/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/profiler/run_generator.py index 09e38c03e..f48495d50 100644 --- a/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/profiler/run_generator.py +++ b/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/profiler/run_generator.py @@ -35,7 +35,6 @@ class RunGenerator(object): profile_run.has_communication = self.profile_data.has_communication profile_run.has_memcpy_or_memset = self.profile_data.has_memcpy_or_memset profile_run.profiler_start_ts = self.profile_data.profiler_start_ts - profile_run.overview = self._generate_overview() if self.device_target != 'Ascend': profile_run.views.append(consts.OVERALL_VIEW) diff --git a/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/run.py b/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/run.py index 7d4e23503..59dd82ecb 100644 --- a/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/run.py +++ b/plugins/tensorboard-plugins/tb_plugin/torch_tb_profiler/run.py @@ -48,9 +48,9 @@ class Run(object): if v.display_name == view: worker_set.add(profile.worker) if not temp_span_view.get(profile.worker): - temp_span_view[profile.worker] = [profile.span] + temp_span_view[profile.worker] = [str(profile.span)] else: - temp_span_view[profile.worker].append(profile.span) + temp_span_view[profile.worker].append(str(profile.span)) break self.span_view = temp_span_view return sorted(list(worker_set)) -- Gitee