aclrtSetDeviceResLimit

Applicable Products

Product

Supported

Ascend 950PR/Ascend 950DT

√

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

√

Function

Sets the device resource limits of the current process.

This API must be called after aclrtSetDevice is called and before operators are executed. If the same device is set multiple times, the last setting takes effect.

In addition to device resource limits for processes, you can also use aclrtSetStreamResLimit and aclrtUseStreamResInCurrentThread to set device resource limits for streams.

The priorities of device resource limits are as follows: device resource limits for streams > device resource limits for processes > AI processor resource limits.

Prototype

1
aclError aclrtSetDeviceResLimit(int32_t deviceId, aclrtDevResLimitType type, uint32_t value)

Parameters

Parameter

Input/Output

Description

deviceId

Input

Device ID.

The value must be in the range of [0, (Available device count – 1)]. Call aclrtGetDeviceCount to obtain the device count.

type

Input

Resource type. For details, see aclrtDevResLimitType.

value

Input

Resource limit.

Returns

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

Restrictions

The settings of this API are valid only for subsequent tasks. For example, if aclmdlRICaptureBegin and aclmdlRICaptureEnd are called to capture stream tasks to a model and then perform model inference, you need to call this API to set device resources before the capture.