From 258594951f50bfc492981dacb543467257691280 Mon Sep 17 00:00:00 2001 From: wuyulong11 Date: Thu, 23 Nov 2023 14:40:48 +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=E3=80=90tbplugin=E3=80=91=E3=80=90=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E3=80=91tensorboard=E7=A6=BB=E7=BA=BF=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E9=80=82=E9=85=8D=EF=BC=8C=E5=9B=BE=E8=A1=A8=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E4=B8=89=E4=BD=8D=E5=B0=8F=E6=95=B0=20=E3=80=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=BA=E3=80=91=20wuyulong=2030031080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fe/src/components/charts/ColumnChart.tsx | 17 ++++++++++ .../fe/src/components/charts/NewLineChart.tsx | 2 +- .../profiler/run_generator.py | 31 ++++++++++--------- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/charts/ColumnChart.tsx b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/charts/ColumnChart.tsx index 21c642b03d1..1c83eea9599 100644 --- a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/charts/ColumnChart.tsx +++ b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/charts/ColumnChart.tsx @@ -1,5 +1,22 @@ /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. + *-------------------------------------------------------------------------------------------- + * Copyright (c) 2023, Huawei Technologies. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications: Offer offline supporting. *--------------------------------------------------------------------------------------------*/ import * as React from 'react' diff --git a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/charts/NewLineChart.tsx b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/charts/NewLineChart.tsx index c66bf58c3e1..5bcbd445cd0 100644 --- a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/charts/NewLineChart.tsx +++ b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/charts/NewLineChart.tsx @@ -110,7 +110,7 @@ export const LineChart: React.FC = (props) => { } } if (graph.columns.length <= 4) { - let finalRows = graph.rows['PTA'] + let finalRows = graph.rows['PTA'] ?? graph.rows['GE'] if (graph.columns.length === 4) { const mergedAPPRows = graph.rows['APP'].map((item: Array) => { return [item[0], null, null, item[1]] 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 f80c933f52e..8939130a293 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 @@ -1178,10 +1178,10 @@ class DistributedRunGenerator(object): steps_to_overlap.setdefault(step_name, OrderedDict()) costs = data.comm_overlap_costs[i] steps_to_overlap[step_name][data.worker] = [ - costs.computation - costs.overlap, - costs.overlap, - costs.communication - costs.overlap, - costs.other + round(costs.computation - costs.overlap, 3), + round(costs.overlap, 3), + round(costs.communication - costs.overlap, 3), + round(costs.other, 3) ] steps_to_overlap['all'][data.worker] = [ sum(x) for x in zip(steps_to_overlap['all'][data.worker], steps_to_overlap[step_name][data.worker])] @@ -1193,7 +1193,8 @@ class DistributedRunGenerator(object): steps_to_overlap.setdefault(k, OrderedDict()) # v: computation / overlap / communication_not_overlap / free time # steps_to_overlap: computation_not_overlap / overlap / communication_not_overlap / other - steps_to_overlap[k][data.worker] = list([v[0] - v[1], v[1], v[2], v[3]]) + steps_to_overlap[k][data.worker] = list( + [round(v[0] - v[1], 3), round(v[1], 3), round(v[2], 3), round(v[3], 3)]) steps_to_overlap['all'][data.worker] = [ sum(x) for x in zip(steps_to_overlap['all'][data.worker], steps_to_overlap[k][data.worker])] @@ -1206,8 +1207,8 @@ class DistributedRunGenerator(object): for k, v in steps.items(): steps_to_wait.setdefault(k, OrderedDict()) - trans = v.get('trans') * 1000 # 1ms = 1000us - wait = v.get('Synchronize') * 1000 # 1ms = 1000us + trans = round(v.get('trans') * 1000, 3) # 1ms = 1000us + wait = round(v.get('Synchronize') * 1000, 3) # 1ms = 1000us steps_to_wait[k][data.worker] = list([trans, wait]) steps_to_wait['all'][data.worker] = [ sum(x) for x in zip(steps_to_wait['all'][data.worker], steps_to_wait[k][data.worker])] @@ -1220,8 +1221,8 @@ class DistributedRunGenerator(object): return for step, comm_stats in data.step_comm_stats.items(): steps_to_wait.setdefault(step, OrderedDict())[data.worker] = [ - comm_stats[1], - comm_stats[0] - comm_stats[1] + round(comm_stats[1], 3), + round(comm_stats[0] - comm_stats[1], 3) ] steps_to_wait['all'][data.worker] = [ sum(x) for x in zip(steps_to_wait['all'][data.worker], steps_to_wait[step][data.worker])] @@ -1283,11 +1284,11 @@ class DistributedRunGenerator(object): row = [ op, stats[0], - stats[1] * 1024 * 1024, + round(stats[1] * 1024 * 1024, 3), round(stats[1] * 1024 * 1024 / stats[0] if stats != 0 else 0), # 1MB = 1024 * 1024 bytes - stats[2] * 1000, + round(stats[2] * 1000, 3), round(stats[2] * 1000 / stats[0] if stats != 0 else 0), # 1ms = 1000us - stats[3] * 1000, + round(stats[3] * 1000, 3), round(stats[3] * 1000 / stats[0] if stats != 0 else 0) # 1ms = 1000us ] table['rows'].append(row) @@ -1311,11 +1312,11 @@ class DistributedRunGenerator(object): row = [ op, stats[0], - stats[1], + round(stats[1], 3), round(stats[1] / stats[0] if stats != 0 else 0), - stats[2], + round(stats[2], 3), round(stats[2] / stats[0] if stats != 0 else 0), - stats[3], + round(stats[3], 3), round(stats[3] / stats[0] if stats != 0 else 0) ] table['rows'].append(row) -- Gitee