From 58163ac1bfb51795ccb501b0728b9681e6acfc88 Mon Sep 17 00:00:00 2001 From: sunboquan Date: Wed, 16 Aug 2023 18:45:38 +0800 Subject: [PATCH] compare entry --- profiler/compare_tools/comparator/op_comparator.py | 2 ++ profiler/compare_tools/performance_compare.py | 12 ++++++++---- profiler/performance_analyse/npu_parser.py | 2 +- profiler/performance_analyse/profiling_parse.py | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/profiler/compare_tools/comparator/op_comparator.py b/profiler/compare_tools/comparator/op_comparator.py index f299463fe5..4b552ac258 100644 --- a/profiler/compare_tools/comparator/op_comparator.py +++ b/profiler/compare_tools/comparator/op_comparator.py @@ -127,3 +127,5 @@ class OpComparator: match_list.reverse() for data in match_list: op_deque.append(data) + + return drill_down_result diff --git a/profiler/compare_tools/performance_compare.py b/profiler/compare_tools/performance_compare.py index 46f7160341..3a7f391309 100644 --- a/profiler/compare_tools/performance_compare.py +++ b/profiler/compare_tools/performance_compare.py @@ -19,9 +19,9 @@ def performance_compare(args): if ArgsManager().base_profiling_type == Constant.NPU: npu_path = ArgsManager().base_profiling.file_path elif ArgsManager().base_profiling_type == Constant.GPU: - npu_path = ArgsManager().base_profiling.file_path + gpu_path = ArgsManager().base_profiling.file_path if ArgsManager().comparison_profiling_type == Constant.NPU: - gpu_path = ArgsManager().comparison_profiling.file_path + npu_path = ArgsManager().comparison_profiling.file_path elif ArgsManager().comparison_profiling_type == Constant.GPU: gpu_path = ArgsManager().comparison_profiling.file_path prof_main(npu_path, gpu_path) @@ -49,9 +49,13 @@ def main(): args = parser.parse_args() ArgsManager().init(args) - performance_compare(args) + try: + performance_compare(args) + except Exception: + print("profiling analyze failed.") dir_path = args.output_path if args.output_path else "./" - file_name = "performance_comparison_result_{}.xlsx".format(time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))) + file_name = "performance_comparison_result_{}.xlsx".format( + time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))) result_file_path = os.path.join(dir_path, file_name) ComparisonGenerator(args).create_excel(result_file_path) diff --git a/profiler/performance_analyse/npu_parser.py b/profiler/performance_analyse/npu_parser.py index 333d8a2682..375dd85680 100644 --- a/profiler/performance_analyse/npu_parser.py +++ b/profiler/performance_analyse/npu_parser.py @@ -48,7 +48,7 @@ class NpuProfilingParser: ai_core_res = defaultdict(float) for dic in data: self.get_ts_by_task_type(dic, event_wait_sqe, ai_core_dict, event_wait_sqe_res, ai_core_res) - if ('name' in dic) and (dic.get('name') == 'compute_time'): + if ('name' in dic) and (dic.get('name') == 'Compute'): ts_flag = True ts = dic.get('ts') dur = dic.get('dur') diff --git a/profiler/performance_analyse/profiling_parse.py b/profiler/performance_analyse/profiling_parse.py index 6c69af674f..c45c73e9e2 100644 --- a/profiler/performance_analyse/profiling_parse.py +++ b/profiler/performance_analyse/profiling_parse.py @@ -44,7 +44,7 @@ def show_table(gpu_profiling_info, npu_profiling_info): f'{gpu_profiling_info.compute_time:.3f}s', f'{gpu_profiling_info.communication_not_overlapped: .3f}s', f'{gpu_profiling_info.scheduling_time:.3f}', f'{gpu_profiling_info.scheduling_ratio:.2%}', f'{gpu_profiling_info.memory_used:.2f}G', f'{gpu_profiling_info.e2e_time:.3f}s']) - table.add_row(['当前现状', f'{npu_profiling_info.cube_time:.3f}s', f'{npu_profiling_info.vector_time:.3f}s', + table.add_row(['NPU现状', f'{npu_profiling_info.cube_time:.3f}s', f'{npu_profiling_info.vector_time:.3f}s', f'{npu_profiling_info.compute_time:.3f}s', f'{npu_profiling_info.communication_not_overlapped: .3f}s', f'{npu_profiling_info.scheduling_time:.3f}', f'{npu_profiling_info.scheduling_ratio:.2%}', f'{npu_profiling_info.memory_used:.2f}G', f'{npu_profiling_info.e2e_time:.3f}s']) -- Gitee