Function: get_device

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

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()
    

Parameter Description

Parameter

Description

device_id

Pointer to the device ID.

Return Value Description

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 aclrtGetDevice is called. You can specify a device by enabling the default device by using init, explicitly specifying a device by using acl.rt.set_device, or implicitly specifying a device by using acl.rt.create_context.