GPU上多P收集profiler数据报ERROR:check the Profiler initialized

一. 运行环境

MindSpore版本号:1.1.0;

硬件平台:GPU;

Python版本号:3.7.5;

操作系统:linux Ubuntu

二. 脚本信息

下载https://gitee.com/mindspore/mindspore.git仓库

修改model_zoo/official/cv/retinaface_resnet50/train.py如下:

  1. from mindspore.profiler import Profiler

  2. 在context.set_context(mode=context.GRAPH_MODE, device_target='GPU', save_graphs=False)之后初始化profiler

profiler = Profiler(output_path="...")

  1. train方法最后收集profiler数据(train end and collect Profiler data)

profiler.analyse()

三. 报错信息

[ERROR] ME(57327:139789353105216,MainProcess):2021-01-07-16:26:38.168.060 [mindspore/profiler/profiling.py:167] Please check the Profiler object initialized after set_auto_parallel_context() and init(). Profiler should be initialized after these code.

image.png

ERROR后面的traceback可能不一样,注意看这个ERROR信息就好。

四. 解决方法

把2中的profiler = Profiler(output_path=summary_name)放在nccl init()语句之后。

五. 总结

请注意GPU和Ascend的区别,Ascend上需要把profiler = Profiler(output_path="...")放到 hccl之前,放到之后会报下面的错误(后面看Ascend和GPU能不能优化统一次序;Ascend上报错还不明确待改进):
image.png

posted @ 2021-12-27 15:53  MS小白  阅读(23)  评论(0)    收藏  举报