aclrtGetDeviceUtilizationRate

Description

Queries the usage of the Cube, Vector, and AI CPU on the device.

Restrictions

  • Querying the memory usage of a device is a reserved function and is not supported in the current version. If this API is called to query the memory usage, the returned value is -1.
  • For Ascend virtual instances, this API cannot be called to query the usage, and the returned value has no meaning.
  • When profiling is enabled, this API cannot be called to query the usage, and the returned value has no meaning.
  • There is no vector on the Ascend 310 AI Processor. When this API is called to query the vector usage, the returned value is -1.
  • There is no vector on the Ascend 910 AI Processor. When this API is called to query the vector usage, the returned value is -1.

Prototype

aclError aclrtGetDeviceUtilizationRate(int32_t deviceId, aclrtUtilizationInfo *utilizationInfo)

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.

utilizationInfo

Output

Pointer to the usage information structure.

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.