Function: reset_device_force

Applicable Products

Product

Supported (√/x)

Ascend 950PR/Ascend 950DT

√

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas training products

√

Atlas inference products

√

Atlas 200I/500 A2 inference products

√

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.

The acl.rt.reset_device_force API can be used with the acl.rt.set_device API or not with the aclrtSetDevice API. If they are not used in pairs, this API needs to be called only once after the acl.rt.set_device API is called for one or more times for the same device in a process to release resources on the device.

# This API is used together with the acl.rt.set_device API.
acl.rt.set_device(1) -> acl.rt.reset_device_force(1) -> acl.rt.set_device(1) -> acl.rt.reset_device_force(1)
 
# This API is not used together with the acl.rt.set_device API.
acl.rt.set_device(1) -> acl.rt.set_device(1) -> acl.rt.reset_device_force(1)

Prototype

Parameters

Parameter

Description

device_id

Int, device ID.

Return Values

Return Value

Description

ret

Int, error code. 0 on success; else, failure.

Restrictions