Function: get_device

Description

Obtains the IDs of the devices in use.

Prototype

  • C Prototype
    1
    aclError aclrtGetDevice(int32_t *deviceId)
    
  • Python Function
    1
    device_id, ret = acl.rt.get_device()
    

Parameters

Parameter

Description

device_id

Pointer to the device ID.

Return Value

Return Value

Description

ret

Int, error code. 0 on success; else, failure.

Restrictions

If no device is specified in advance, an error is returned when acl.rt.get_device is called. You can specify a device by enabling the default device using the init API, explicitly specifying a device by calling the acl.rt.set_device API, or implicitly specifying a device by calling the acl.rt.create_context API.