Function: acl.rt.device_get_limit

Applicable Products

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Not supported
  • Atlas inference products: Not supported
  • Atlas training products: Not supported

Function

Obtains the device resource limits of the current process.

Prototype

  • C Prototype

    aclError aclrtDeviceGetLimit(aclrtDeviceLimit limit, size_t *value)
    
  • Python Function

    value, ret = acl.rt.device_get_limit(limit)
    

Parameters

Parameter Description
limit Int, resource type. For details, see aclrtDeviceLimit.

Return Values

Return Value Description
value Int, resource limit, in bytes.
ret Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails.

Constraints

  • The device resource limit configured by calling acl.rt.device_set_limit applies to the current process. All devices share the same configuration, and the same value is returned when the limit is queried on any device.

  • The instantaneous value of the current process is obtained through this API, which does not ensure multi-thread concurrency security.

    For example, call acl.rt.device_set_limit to set the stack size to A, and then call acl.rt.set_device to make the setting take effect. In this case, the value obtained by calling acl.rt.device_get_limit is A, and the resource limit is also A. Then, acl.rt.device_set_limit is called again to change the value to B, but acl.rt.set_device is not called again. In this case, the value obtained by calling acl.rt.device_get_limit is B, but the actual resource limit is still A.