From 0c9a42260cca07253888ad0e59348e3aa52b073e Mon Sep 17 00:00:00 2001 From: sunyiming Date: Mon, 18 Dec 2023 09:31:12 +0000 Subject: [PATCH 1/4] update debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py. Signed-off-by: sunyiming --- .../src/python/ptdbg_ascend/dump/dump.py | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py index e726d2bc277..df1c97cb5b1 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py @@ -207,12 +207,8 @@ def rename_(): global rank global pkl_name if rank is not None and pkl_name is not None: - if DumpUtil.target_iter: - dir_name = os.path.join(DumpUtil.dump_root, "step{}".format(DumpUtil.iter_num), "rank{}".format(os.getpid())) - new_name = os.path.join(DumpUtil.dump_root, "step{}".format(DumpUtil.iter_num), "rank{}".format(rank)) - else: - dir_name = os.path.join(DumpUtil.dump_root, "rank{}".format(os.getpid())) - new_name = os.path.join(DumpUtil.dump_root, "rank{}".format(rank)) + dir_name = os.path.join(DumpUtil.dump_root, "step{}".format(DumpUtil.iter_num), "rank{}".format(os.getpid())) + new_name = os.path.join(DumpUtil.dump_root, "step{}".format(DumpUtil.iter_num), "rank{}".format(rank)) if not os.path.exists(new_name) and os.path.exists(dir_name): _, file_name = os.path.split(pkl_name) os.rename(dir_name, new_name) @@ -229,11 +225,10 @@ def dump_acc_cmp(name, in_feat, out_feat, dump_step, module): if DumpUtil.get_dump_switch(): global rank dump_dir, dump_filename = os.path.split(dump_file) - if DumpUtil.target_iter: - dump_dir = os.path.join(dump_dir, "step{}".format(DumpUtil.iter_num)) - if not os.path.exists(dump_dir): - Path(dump_dir).mkdir(mode=FileCheckConst.DATA_DIR_AUTHORITY, exist_ok=True) - dump_file = os.path.join(dump_dir, dump_filename) + dump_dir = os.path.join(dump_dir, "step{}".format(DumpUtil.iter_num)) + if not os.path.exists(dump_dir): + Path(dump_dir).mkdir(mode=FileCheckConst.DATA_DIR_AUTHORITY, exist_ok=True) + dump_file = os.path.join(dump_dir, dump_filename) rank_this = get_tensor_rank(in_feat, out_feat) DumpUtil.dump_root = os.path.dirname(DumpUtil.dump_path) if rank_this is not None and rank != rank_this: @@ -244,10 +239,7 @@ def dump_acc_cmp(name, in_feat, out_feat, dump_step, module): npy_dir = dump_filename[:-4] else: npy_dir = dump_filename - if DumpUtil.target_iter: - DumpUtil.dump_data_dir = os.path.join(DumpUtil.dump_root, "step{}".format(DumpUtil.iter_num), "rank{}".format(rank), npy_dir) - else: - DumpUtil.dump_data_dir = os.path.join(DumpUtil.dump_root, "rank{}".format(rank), npy_dir) + DumpUtil.dump_data_dir = os.path.join(DumpUtil.dump_root, "step{}".format(DumpUtil.iter_num), "rank{}".format(rank), npy_dir) if DumpUtil.target_rank is not None: if rank != DumpUtil.target_rank: return -- Gitee From 0c630e38b3c00e30d3b68ee9a2543b3f77e86c17 Mon Sep 17 00:00:00 2001 From: sunyiming Date: Mon, 18 Dec 2023 09:31:51 +0000 Subject: [PATCH 2/4] update debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py. Signed-off-by: sunyiming --- .../ptdbg_ascend/overflow_check/overflow_check.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py index 10875743c76..ca1874d75f5 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py @@ -91,12 +91,11 @@ def overflow_check(name, **kwargs): return dump_file = DumpUtil.get_dump_path() global rank - if DumpUtil.target_iter: - dump_dir, dump_filename = os.path.split(dump_file) - dump_dir = os.path.join(dump_dir, "step{}".format(DumpUtil.iter_num)) - if not os.path.exists(dump_dir): - Path(dump_dir).mkdir(mode=0o750, exist_ok=True) - dump_file = os.path.join(dump_dir, dump_filename) + dump_dir, dump_filename = os.path.split(dump_file) + dump_dir = os.path.join(dump_dir, "step{}".format(DumpUtil.iter_num)) + if not os.path.exists(dump_dir): + Path(dump_dir).mkdir(mode=0o750, exist_ok=True) + dump_file = os.path.join(dump_dir, dump_filename) rank_this = get_tensor_rank(in_feat, out_feat) DumpUtil.dump_root = os.path.dirname(DumpUtil.dump_path) if rank_this is not None and rank != rank_this: -- Gitee From 55b6638399283fe0db7193aff939d768620fd1cc Mon Sep 17 00:00:00 2001 From: sunyiming Date: Wed, 20 Dec 2023 01:41:58 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sunyiming --- .../src/python/ptdbg_ascend/overflow_check/overflow_check.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py index ca1874d75f5..afa0fea2026 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/overflow_check/overflow_check.py @@ -16,6 +16,7 @@ from .utils import OverFlowUtil, dump_overflow, check_overflow_npu, clear_overfl from ..dump.utils import DumpUtil, Const, get_tensor_rank, create_dirs_if_not_exist from .info_dump import write_api_info_json, ForwardAPIInfo, BackwardAPIInfo from ..dump import dump +from ..common.file_check_util import FileCheckConst backward_init_status = False api_overflow = [] @@ -94,7 +95,7 @@ def overflow_check(name, **kwargs): dump_dir, dump_filename = os.path.split(dump_file) dump_dir = os.path.join(dump_dir, "step{}".format(DumpUtil.iter_num)) if not os.path.exists(dump_dir): - Path(dump_dir).mkdir(mode=0o750, exist_ok=True) + Path(dump_dir).mkdir(mode=FileCheckConst.DATA_DIR_AUTHORITY, exist_ok=True) dump_file = os.path.join(dump_dir, dump_filename) rank_this = get_tensor_rank(in_feat, out_feat) DumpUtil.dump_root = os.path.dirname(DumpUtil.dump_path) -- Gitee From bca6706e967211be57cc43be5d8902293842d52f Mon Sep 17 00:00:00 2001 From: sunyiming Date: Wed, 20 Dec 2023 03:28:06 +0000 Subject: [PATCH 4/4] update debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/support_wrap_ops.yaml. Signed-off-by: sunyiming --- .../src/python/ptdbg_ascend/hook_module/support_wrap_ops.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/support_wrap_ops.yaml b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/support_wrap_ops.yaml index 6f800530981..92650b03f75 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/support_wrap_ops.yaml +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/support_wrap_ops.yaml @@ -272,7 +272,6 @@ tensor: - deg2rad - deg2rad_ - det - - detach - diag - diag_embed - diagflat -- Gitee