Function: get_device
Applicability
Product |
Supported (√/x) |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Obtains the IDs of the devices in use.
Prototype
- C Prototype
1aclError aclrtGetDevice(int32_t *deviceId)
- Python Function
1device_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.
Parent topic: Device Management