Function: reset_device
Applicability
|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function Usage
Resets the current device and releases the resources on the device. The resources it releases include the default context, default stream, and all streams created in the default context. If a task in the default context or stream is not complete, the system releases the context or stream after the task is complete.
Prototype
- C Prototype
1aclError aclrtResetDevice(int32_t deviceId)
- Python Function
1ret = acl.rt.reset_device(device_id)
Parameter Description
|
Parameter |
Description |
|---|---|
|
device_id |
Int, device ID. |
Return Value Description
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code: 0 on success; else, failure. |
Restrictions
If there are explicitly created contexts, streams, or events on the device to be reset, you are advised to follow the following call sequence before resetting. Otherwise, exceptions may occur.
The API call sequence is as follows: call acl.rt.destroy_event to destroy the event or call acl.rt.destroy_stream to destroy the explicitly created stream --> call acl.rt.destroy_context to destroy the explicitly created context --> call acl.rt.reset_device.