aclrtGetMemUsageInfo

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Queries the memory usage information of a component, including the component name, current memory size, and peak memory size.

Prototype

aclError aclrtGetMemUsageInfo(int32_t deviceId, aclrtMemUsageInfo *memUsageInfo, size_t inputNum, size_t *outputNum)

Parameters

Parameter

Input/Output

Description

deviceId

Input

Device ID.

Must be in the range of [0, Device count – 1]. Call aclrtGetDeviceCount to obtain the device count.

memUsageInfo

Input/Output

Array of memory usage information.

When using this parameter as an input, you need to pass the aclrtMemUsageInfo structure pointer. The memory size must be sufficient to store the memory usage information of the number of components specified by inputNum.

When this parameter is used as an output, the component name, current memory size, and peak memory size can be obtained.

inputNum

Input

Number of components to query.

If the actual number of components is less than the number specified by inputNum, the actual number of components are queried.

outputNum

Output

Number of components that are actually queried.

Returns

0 on success; else, failure. For details, see aclError.