From 5561b1ee71f30d890336d80faab4194bcf481b48 Mon Sep 17 00:00:00 2001 From: LinYihan <14237638+linyihan1026@user.noreply.gitee.com> Date: Mon, 20 May 2024 09:47:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9compare=5Fscript.template?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E7=94=A8=E6=88=B7=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=9C=A8=E5=91=BD=E4=BB=A4=E8=A1=8C=E8=BE=93=E5=85=A5=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/compare_script.template | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/compare_script.template b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/compare_script.template index 91565b3c87..31948a19b1 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/compare_script.template +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/compare_script.template @@ -1,14 +1,39 @@ from ptdbg_ascend import compare +import argparse +import os.path +from ptdbg_ascend.common.file_check_util import FileChecker pkl_path = "%s" dump_data_dir = "%s" +parser = argparse.ArgumentParser(description="compare data") +parser.add_argument("--npu_pkl_path", type=str, default=pkl_path, help="npu保存数据的pkl路径") +parser.add_argument("--bench_pkl_path", type=str, default=pkl_path, help="对比数据的pkl路径") +parser.add_argument("--output_path", type=str, default="./", help="导出对比数据的路径") + +args = parser.parse_args() +npu_pkl_path = args.npu_pkl_path +bench_pkl_path = args.bench_pkl_path +output_path = args.output_path + +suffix = ".pkl" +npu_path_checker = FileChecker(npu_pkl_path, "file", "read", suffix) +npu_path_checker.common_check() +bench_path_checker = FileChecker(bench_pkl_path, "file", "read", suffix) +bench_path_checker.common_check() + +npu_dump_data_dir = npu_pkl_path[:-len(suffix)] +bench_dump_data_dir = bench_pkl_path[:-len(suffix)] +if not os.path.exists(npu_dump_data_dir) or not os.path.exists(bench_dump_data_dir): + npu_dump_data_dir = "" + bench_dump_data_dir = "" + dump_path_param = { - "npu_pkl_path": , - "bench_pkl_path": , - "npu_dump_data_dir": , - "bench_dump_data_dir": , + "npu_pkl_path": npu_pkl_path, + "bench_pkl_path": bench_pkl_path, + "npu_dump_data_dir": npu_dump_data_dir, + "bench_dump_data_dir": bench_dump_data_dir, "is_print_compare_log": True } -compare(dump_path_param, output_path="", stack_mode=%s) +compare(dump_path_param, output_path=output_path, stack_mode=%s) \ No newline at end of file -- Gitee