Function: reset_device

C Prototype

aclError aclrtResetDevice(int32_t deviceId)

Python Function

ret = acl.rt.reset_device(device_id)

Function Usage

Resets the compute device and releases the resources (including the default context and stream, and all streams created in the default context) on the device. If a task in the default context or stream is not complete, resources will be released after the task is complete.

Input Description

device_id: int, device ID.

Return Value

ret: int, error code.

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.

Reference

For details about the API call sequence and example, see Runtime Resource Allocation and Deallocation and Synchronous Wait.