api_statistic (API Duration Statistics)

The timeline information of API duration statistics is displayed at the CANN layer in the msprof_*.json file, and the summary information is summarized in the api_statistic_*.csv file to collect statistics on the API execution duration at the CANN layer, including AscendCL, Runtime, Node, Model, and Communication APIs.

  • AscendCL: AscendCL APIs, namely C language API library for developing DNN applications on the Ascend platform.
  • Runtime: Runtime APIs, namely CANN Runtime APIs.
  • Node: CANN operators.
  • Model: used for internal analysis and can be ignored.
  • Communication: collective communication operators.

Applicability

For details about the mapping between AI processors and Ascend products, see Ascend Product Form Description.

AI Processor Type

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Atlas 350 Accelerator Card

Data at CANN Layer in msprof_*.json

Data at the CANN layer in the msprof_*.json file mainly displays the time consumed by APIs running in the current thread, as shown in the following figure.

Figure 1 CANN layer data

By observing the timeline blocks in the figure, you can identify APIs with longer response time. Additionally, you can click to select the API with the longest response time to access its detailed information, as shown in the following figure.

Table 1 Field description

Field

Description

Title

API name.

Start

Start point on the timeline, which is automatically aligned with that in chrome trace (ms).

Wall Duration

Time taken by the calls to an API (ms).

Self Time

Execution time of the current API, in ms.

Mode

AscendCL API type, which can be ACL_OP (single-operator model API), ACL_MODEL (model API), and ACL_RTS (Runtime API).

level

Level. At the AscendCL level currently.

api_statistic_*.csv File

The following shows the file content format.

Figure 2 api_statistic_*.csv

In the preceding figure, operators are sorted in descending order based on the Time column. You can find the top N operators with the longest time consumptions, and determine whether the operators run stably or whether a call takes a long time based on the maximum, minimum, and average time consumptions, and variance. For example, a lower variance indicates more stable operator execution. Operators are considered stable when the minimum and maximum values are close to the average, with no significant outliers.

Table 2 Field description

Field

Description

Device_id

Device ID. For data collected from the host, the value is host.

Level

API level

API Name

API name.

Time(us)

Total duration, in μs.

Count

Number of calls.

Avg(us)

Average time consumption, in μs.

Min(us)

Minimum time consumption, in μs.

Max(us)

Maximum time consumption, in μs.

Variance

Time consumption variance.