aclrtGetMemUsageInfo

Applicability

Product

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

Description

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

Prototype

1
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. For details about the type definition, see aclrtMemUsageInfo.

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. The elements in the memUsageInfo array are sorted in descending order of the current memory usage.

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.