Function: get_device

Applicable Products

Product

Supported (√/x)

Ascend 950PR/Ascend 950DT

√

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

√

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 Values

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 init, explicitly specifying a device using acl.rt.set_device, or implicitly specifying a device using acl.rt.create_context.