From 43568329c925e963be821916f2630cdad7a93971 Mon Sep 17 00:00:00 2001 From: fuchao Date: Thu, 12 Jun 2025 15:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0kbk=20dump=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=AD=98=E5=9C=A8=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msprobe/mindspore/dump/cell_dump_process.py | 5 ++++- .../msprobe/mindspore/dump/cell_dump_with_insert_gradient.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debug/accuracy_tools/msprobe/mindspore/dump/cell_dump_process.py b/debug/accuracy_tools/msprobe/mindspore/dump/cell_dump_process.py index 44f8dbdfb49..a1719a31dc3 100644 --- a/debug/accuracy_tools/msprobe/mindspore/dump/cell_dump_process.py +++ b/debug/accuracy_tools/msprobe/mindspore/dump/cell_dump_process.py @@ -801,8 +801,11 @@ def create_kbyk_json(dump_path, summary_mode, step): } create_directory(dump_path) + tmp_json_path = os.path.join(dump_path, "tmp.json") config_json_path = os.path.join(dump_path, "kernel_kbyk_dump.json") - save_json(config_json_path, config_json, indent=4) + save_json(tmp_json_path, config_json, indent=4) + if os.path.exists(tmp_json_path): + move_file(tmp_json_path, config_json_path) logger.info(config_json_path + " has been created.") return config_json_path diff --git a/debug/accuracy_tools/msprobe/mindspore/dump/cell_dump_with_insert_gradient.py b/debug/accuracy_tools/msprobe/mindspore/dump/cell_dump_with_insert_gradient.py index 6b8b7344500..d10b40c6d22 100644 --- a/debug/accuracy_tools/msprobe/mindspore/dump/cell_dump_with_insert_gradient.py +++ b/debug/accuracy_tools/msprobe/mindspore/dump/cell_dump_with_insert_gradient.py @@ -27,7 +27,7 @@ from mindspore import nn, ops from msprobe.core.common.const import Const as CoreConst from msprobe.core.common.const import FileCheckConst from msprobe.core.common.file_utils import ( - load_npy, save_json, remove_path, load_yaml, + load_npy, save_json, remove_path, load_yaml, check_path_exists, create_directory, read_csv, write_df_to_csv, write_csv, move_file, move_directory) from msprobe.mindspore.common.log import logger from msprobe.mindspore.dump.cell_dump_process import CellDumpConfig @@ -795,6 +795,7 @@ def start(config: CellDumpConfig): if dump_task == CoreConst.STATISTICS: # 使能KBK dump config_json_path = create_kbyk_json(dump_path, summary_mode, step) + check_path_exists(config_json_path) os.environ["MINDSPORE_DUMP_CONFIG"] = config_json_path # 执行过程中跳过TensorDump算子 -- Gitee