Function: get_device

Applicable Products

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

Function

Obtains the ID of the device currently in use.

Prototype

  • C Prototype

    aclError aclrtGetDevice(int32_t *deviceId)
    
  • Python Function

    device_id, ret = acl.rt.get_device()
    

Parameters

None

Return Values

Return Value Description
device_id Pointer to the device ID.
ret Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails.

Constraints

If no device is specified in advance, an error is returned when acl.rt.get_device is called.