采集代码如下:
# 配置采集参数
experimental_config = torch_npu.profiler._ExperimentalConfig(
export_type=torch_npu.profiler.ExportType.Text,
aic_metrics=torch_npu.profiler.AiCMetrics.PipeUtilization,
profiler_level=torch_npu.profiler.ProfilerLevel.Level1,
l2_cache=False,
data_simplification=False
)
with torch_npu.profiler.profile(
activities=[torch_npu.profiler.ProfilerActivity.CPU, torch_npu.profiler.ProfilerActivity.NPU],
schedule=torch_npu.profiler.schedule(wait=0, warmup=1, active=1, repeat=1, skip_first=0),
on_trace_ready=torch_npu.profiler.tensorboard_trace_handler("./result_{}".format(epoch)),
record_shapes=True,
profile_memory=True,
with_stack=True,
with_flops=False,
with_modules=False,
experimental_config=experimental_config
) as prof:
# for i, (images, target) in enumerate(train_loader)及其包含的代码向后缩进
for i, (images, target) in enumerate(train_loader):
......
运行日志如下:
[W AclInterface.cpp:181] Warning: 0Failed to find function aclrtCreateEventExWithFlag (function operator())
Epoch: [0][ 0/67] Time 30.974 ( 0.000) Data 16.008 ( 0.000) Loss 6.9359e+00 (0.0000e+00) Acc@1 0.20 ( 0.00) Acc@5 0.20 ( 0.00)
Epoch: [0][ 1/67] Time 22.673 ( 0.000) Data 22.030 ( 0.000) Loss 6.9379e+00 (0.0000e+00) Acc@1 0.00 ( 0.00) Acc@5 0.00 ( 0.00)
2024-05-11 02:22:01 [INFO] [523971] profiler.py: Start parsing profiling data: /home/yhui/ModelZoo-PyTorch/PyTorch/built-in/cv/classification/ResNet50_for_PyTorch/result_0/master_510670_20240511022107971_ascend_pt
2024-05-11 02:22:03 [WARNING] [523971] profiler.py: 442 memory record(s) are incomplete.
2024-05-11 02:22:07 [ERROR] [524621] profiler.py: Failed to get acl to npu flow events.
2024-05-11 02:22:08 [ERROR] [524882] profiler.py: Failed to get acl to npu flow events.
2024-05-11 02:22:11 [INFO] [524058] profiler.py: CANN profiling data parsed in a total time of 0:00:09.193205
2024-05-11 02:22:11 [ERROR] [525290] profiler.py: Failed to get acl to npu flow events.
2024-05-11 02:22:11 [INFO] [523971] profiler.py: All profiling data parsed in a total time of 0:00:10.011566
采集代码如下:
# 配置采集参数
experimental_config = torch_npu.profiler._ExperimentalConfig(
export_type=torch_npu.profiler.ExportType.Text,
aic_metrics=torch_npu.profiler.AiCMetrics.PipeUtilization,
profiler_level=torch_npu.profiler.ProfilerLevel.Level1,
l2_cache=False,
data_simplification=False
)
with torch_npu.profiler.profile(activities=[torch_npu.profiler.ProfilerActivity.CPU, torch_npu.profiler.ProfilerActivity.NPU],
schedule=torch_npu.profiler.schedule(wait=0, warmup=1, active=1, repeat=1, skip_first=0),
on_trace_ready=torch_npu.profiler.tensorboard_trace_handler("./result_{}".format(epoch)),
record_shapes=True,
profile_memory=True,
with_stack=True,
with_flops=False,
with_modules=False,
experimental_config=experimental_config
) as prof:
# for i, (images, target) in enumerate(train_loader)及其包含的代码向后缩进
for i, (images, target) in enumerate(train_loader):
......
运行日志如下:
[W AclInterface.cpp:181] Warning: 0Failed to find function aclrtCreateEventExWithFlag (function operator())
Epoch: [0][ 0/67] Time 30.974 ( 0.000) Data 16.008 ( 0.000) Loss 6.9359e+00 (0.0000e+00) Acc@1 0.20 ( 0.00) Acc@5 0.20 ( 0.00)
Epoch: [0][ 1/67] Time 22.673 ( 0.000) Data 22.030 ( 0.000) Loss 6.9379e+00 (0.0000e+00) Acc@1 0.00 ( 0.00) Acc@5 0.00 ( 0.00)
2024-05-11 02:22:01 [INFO] [523971] profiler.py: Start parsing profiling data: /home/yhui/ModelZoo-PyTorch/PyTorch/built-in/cv/classification/ResNet50_for_PyTorch/result_0/master_510670_20240511022107971_ascend_pt
2024-05-11 02:22:03 [WARNING] [523971] profiler.py: 442 memory record(s) are incomplete.
2024-05-11 02:22:07 [ERROR] [524621] profiler.py: Failed to get acl to npu flow events.
2024-05-11 02:22:08 [ERROR] [524882] profiler.py: Failed to get acl to npu flow events.
2024-05-11 02:22:11 [INFO] [524058] profiler.py: CANN profiling data parsed in a total time of 0:00:09.193205
2024-05-11 02:22:11 [ERROR] [525290] profiler.py: Failed to get acl to npu flow events.
2024-05-11 02:22:11 [INFO] [523971] profiler.py: All profiling data parsed in a total time of 0:00:10.011566