Function: reset_device
Description
Resets the current device and releases the resources on the device. The resources to be released 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)
Parameters
|
Parameter |
Description |
|---|---|
|
device_id |
Int, device ID. |
Return Value
|
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 the acl.rt.destroy_event API to release an event, call the acl.rt.destroy_stream API to release an explicitly created stream, call the acl.rt.destroy_context API to release an explicitly created context, and then call the acl.rt.reset_device API.