From 0e06a25e6e7eeaa7101372e09d1fb2623a48c0ec Mon Sep 17 00:00:00 2001 From: yu-liang-bin Date: Mon, 14 Jul 2025 16:55:47 +0800 Subject: [PATCH] fix profiler docs --- docs/sample_code/profiler/for_loop_profiler.py | 3 ++- tutorials/source_en/debug/profiler.md | 5 +++-- tutorials/source_zh_cn/debug/profiler.md | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/sample_code/profiler/for_loop_profiler.py b/docs/sample_code/profiler/for_loop_profiler.py index 447034a831..d53d62d523 100644 --- a/docs/sample_code/profiler/for_loop_profiler.py +++ b/docs/sample_code/profiler/for_loop_profiler.py @@ -20,7 +20,7 @@ import numpy as np import mindspore import mindspore.dataset as ds from mindspore import nn -from mindspore.profiler import ProfilerLevel, ProfilerActivity, AicoreMetrics +from mindspore.profiler import ProfilerLevel, ProfilerActivity, AicoreMetrics, HostSystem class Net(nn.Cell): @@ -57,6 +57,7 @@ if __name__ == "__main__": l2_cache=False, mstx=False, data_simplification=False, + host_sys=[HostSystem.CPU, HostSystem.MEM], ) steps = 10 net = Net() diff --git a/tutorials/source_en/debug/profiler.md b/tutorials/source_en/debug/profiler.md index 2a41ac2859..4b4b53bf62 100644 --- a/tutorials/source_en/debug/profiler.md +++ b/tutorials/source_en/debug/profiler.md @@ -79,7 +79,7 @@ Sample as follows: ```python import mindspore -from mindspore.profiler import ProfilerLevel, ProfilerActivity, AicoreMetrics +from mindspore.profiler import ProfilerLevel, ProfilerActivity, AicoreMetrics, HostSystem # Define model training times steps = 15 @@ -93,7 +93,8 @@ experimental_config = mindspore.profiler._ExperimentalConfig( aic_metrics=AicoreMetrics.AiCoreNone, l2_cache=False, mstx=False, - data_simplification=False) + data_simplification=False, + host_sys=[HostSystem.CPU, HostSystem.MEM]) # Initialize profile with mindspore.profiler.profile(activities=[ProfilerActivity.CPU, ProfilerActivity.NPU], diff --git a/tutorials/source_zh_cn/debug/profiler.md b/tutorials/source_zh_cn/debug/profiler.md index 11f2ae778e..0cfd9e3be4 100644 --- a/tutorials/source_zh_cn/debug/profiler.md +++ b/tutorials/source_zh_cn/debug/profiler.md @@ -76,7 +76,7 @@ class StopAtStep(mindspore.Callback): ```python import mindspore -from mindspore.profiler import ProfilerLevel, ProfilerActivity, AicoreMetrics +from mindspore.profiler import ProfilerLevel, ProfilerActivity, AicoreMetrics, HostSystem # 定义模型训练次数 steps = 15 @@ -90,7 +90,8 @@ experimental_config = mindspore.profiler._ExperimentalConfig( aic_metrics=AicoreMetrics.AiCoreNone, l2_cache=False, mstx=False, - data_simplification=False) + data_simplification=False, + host_sys=[HostSystem.CPU, HostSystem.MEM]) # 初始化profile with mindspore.profiler.profile(activities=[ProfilerActivity.CPU, ProfilerActivity.NPU], -- Gitee