Overview

This section provides the following methods to implement profile data collection by using pyACL API calls in offline inference scenarios:

Table 1 pyACL API collection

Collection Mode

Description

Call

Profiling pyACL APIs (collecting and flushing profile data)

Write the collected profile data to a file, parse the file by using the msprof tool, and display the profile data analysis result.

Call acl.prof.init, acl.prof.finalize, acl.prof.start, acl.prof.stop, acl.prof.create_config, and acl.prof.destroy_config in conjunction to collect profile data. You can obtain the pyACL API profile data, time taken to execute AI Core operators, as well as AI Core metrics.

Profiling pyACL APIs for Extension (extension APIs)

To locate the performance bottleneck of your application or the upper-layer framework program, call the Profiling pyACL APIs for Extension during the profiling process (between the acl.prof.start and acl.prof.stop calls). The extension APIs together achieve the function of msproftx APIs, which record the time span of specific events during application running and write data to a profile data file. You can use the msprof tool to parse the file and export and display the result.

Call the acl.prof.create_stamp, acl.prof.set_stamp_trace_message, acl.prof.mark, acl.prof.push, acl.prof.pop, acl.prof.range_start, acl.prof.range_stop, acl.prof.destroy_stamp APIs between acl.prof.start and acl.prof.stop to obtain the events that occur at specific time during application execution and record the time span of the events.

Profiling pyACL APIs for Subscription (subscribing to operator information)

Parse the collected profile data and write it to a pipeline. Then, users read the data to the memory and call pyACL APIs to obtain it.

This method is implemented by calls to the following APIs: acl.prof.model_subscribe, acl.prof.get*, and acl.prof.model_un_subscribe. The profile data of each operator in the model can be obtained, including the operator name, operator type name, and operator execution time.

Profiling pyACL APIs (setting iteration time)

Set the start and end timestamps of an iteration, to display the profile data parsing result by iteration.

Call acl.prof.get_step_timestamp, acl.prof.Create_Step_Info, and acl.prof.Destroy_Step_Info in conjunction to collect profile data.

Note:

For details, see "More Features" > Performance Data Profiling" in CANN AscendCL Application Software Development Guide (Python).

  • To use the Profiling pyACL APIs to collect profile data, you need to develop, build, and run an application project.
  • The Profiling pyACL APIs and Profiling AscendCL APIs for Extension cannot be called together with the Profiling pyACL APIs for Subscription.