总体介绍 本章节提供离线推理场景下AscendCL API,用于性能数据采集,支持以下实现方式: 表1 AscendCL API采集采集方式 说明 调用 Profiling AscendCL API(通过Profiling AscendCL API采集并落盘性能数据) 将采集到的性能数据写入文件,再使用msprof工具解析该文件,并展示性能分析数据。 aclprofInit、aclprofFinalize、aclprofSetConfig、aclprofStart、aclprofStop、aclprofCreateConfig和aclprofDestroyConfig接口配合使用,实现该方式的性能数据采集。该方式可获取AscendCL的接口性能数据、AI Core上算子的执行时间、AI Core性能指标数据等。 Profiling AscendCL API for Extension(Profiling AscendCL API扩展接口) 当用户需要定位应用程序或上层框架程序的性能瓶颈时,可在Profiling采集进程内(acl.prof.start接口、acl.prof.stop接口之间)调用Profiling pyACL API扩展接口(统称为msproftx接口),开启记录应用程序执行期间特定事件发生的时间跨度,并将数据写入性能数据文件,再使用msprof工具解析该文件,并导出展示性能分析数据。 在aclprofStart和aclprofStop接口之间调用aclprofCreateStamp、aclprofSetStampTraceMessage、aclprofMark、aclprofPush、aclprofPop、aclprofRangeStart、aclprofRangeStop、aclprofDestroyStamp接口,获取应用程序执行期间特定时间发生的事件并记录事件发生的时间跨度。 Profiling AscendCL API for Subscription(订阅算子信息的Profiling AscendCL API) 将采集到的性能数据解析后写入管道,由用户读入内存,再由用户调用AscendCL API获取性能数据。 aclprofModelSubscribe接口、aclprofGet*接口、aclprofModelUnSubscribe接口配合使用,实现该方式的性能数据采集,当前支持获取网络模型中算子的性能数据,包括算子名称、算子类型名称、算子执行时间等。 注:接口详细说明,请参见《AscendCL应用软件开发指南(C&C++) 》中的“AscendCL API参考 > Profiling数据采集”。 使用Profiling AscendCL API进行性能数据采集前,须参见《AscendCL应用软件开发指南(C&C++) 》完成应用工程开发、编译和运行。Profiling AscendCL API和Profiling AscendCL API for Extension不能与Profiling AscendCL API for Subscription交叉调用。 父主题: 使用AscendCL C&C++接口采集性能数据