Function: stream_abort

Applicable Products

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: Supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Not supported
  • Atlas inference products: Not supported
  • Atlas training products: Not supported

Function

Stops tasks that are being executed in a specified stream and discards tasks that have been delivered but not executed in the specified stream. New tasks delivered to the specified stream do not take effect during the execution of this API.

Prototype

  • C Prototype

    aclError aclrtStreamAbort(aclrtStream stream)
    
  • Python Function

    ret = acl.rt.stream_abort(stream)
    

Parameters

Parameter Description
stream Int, stream with tasks to be cleared.

Return Values

Return Value Description
ret Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails.

Constraints

  • If other streams depend on the stream specified in this API (for example, two streams are synchronized by calling acl.rt.record_event or acl.rt.stream_wait_event, the execution of other streams may be suspended. In this case, you need to explicitly call this API to clear tasks on other streams.
  • If this API is called to clear tasks on a specified stream, and then a synchronization API (such as acl.rt.synchronize_stream or acl.rt.synchronize_event) is called, the synchronization API exits and returns the ACL\_ERROR\_RT\_STREAM\_ABORT error code.