下载
中文
注册

总体介绍

本章节提供离线推理场景下pyACL API,用于性能数据采集,支持以下实现方式:

表1 pyACL API采集

采集方式

说明

调用

Profiling pyACL API(通过Profiling pyACL API采集并落盘性能数据)

将采集到的性能数据写入文件,再使用msprof工具解析该文件,并展示性能分析数据。

acl.prof.initacl.prof.finalizeacl.prof.start acl.prof.stopacl.prof.create_configacl.prof.destroy_config接口配合使用,实现该方式的性能数据采集。该方式可获取pyACL的接口性能数据、AI Core上算子的执行时间、AI Core性能指标数据等。

Profiling pyACL API for Extension(Profiling pyACL API扩展接口)

当用户需要定位应用程序或上层框架程序的性能瓶颈时,可在Profiling采集进程内(acl.prof.start接口、acl.prof.stop接口之间)调用Profiling pyACL API扩展接口(统称为msproftx接口),开启记录应用程序执行期间特定事件发生的时间跨度,并将数据写入性能数据文件,再使用msprof工具解析该文件,并导出展示性能分析数据。

acl.prof.startacl.prof.stop接口之间调用acl.prof.create_stampacl.prof.set_stamp_trace_messageacl.prof.markacl.prof.pushacl.prof.popacl.prof.range_startacl.prof.range_stopacl.prof.destroy_stamp接口,获取应用程序执行期间特定时间发生的事件并记录事件发生的时间跨度。

Profiling pyACL API for Subscription(订阅算子信息的Profiling pyACL API)

将采集到的性能数据解析后写入管道,由用户读入内存,再由用户调用pyACL API获取性能数据。

acl.prof.model_subscribe接口、acl.prof.get*接口、acl.prof.model_un_subscribe接口配合使用,实现该方式的性能数据采集,当前支持获取网络模型中算子的性能数据,包括算子名称、算子类型名称、算子执行时间等。

注:pyACL接口详细说明,请参见CANN AscendCL应用软件开发指南(Python)中的“应用开发接口 > AscendCL API(Python) > Profiling数据采集

  • 使用Profiling pyACL API进行性能数据采集,须完成应用工程开发、编译和运行。
  • Profiling pyACL API和Profiling AscendCL API for Extension不能与Profiling pyACL API for Subscription交叉调用。