Resets the compute device and destroys all allocations (including the default context and stream, and all streams created in the default context) on the device. This API is synchronous. If a task in the default context or stream is not complete, allocations will be destroyed after the task is complete.
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 aclrtDestroyEvent to destroy the event or call aclrtDestroyStream to destroy the explicitly created stream--> call aclrtDestroyContext to destroy the explicitly created context--> call aclrtResetDevice.
aclError aclrtResetDevice(int32_t deviceId)
Parameter |
Input/Output |
Description |
|---|---|---|
deviceId |
Input |
Device ID. |
0 on success; else, failure.
For details about the API call sequence and example, see Runtime Resource Allocation and Deallocation.