Function: reset_event

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 an event. Resets the event only after all tasks in the stream are completely executed. This API is asynchronous.

For stream synchronization, this API is called after an acl.rt.stream_wait_event call.

Prototype

  • C Prototype
    1
    aclError aclrtResetEvent(aclrtEvent event, aclrtStream stream)
    
  • Python Function
    1
    ret = acl.rt.reset_event(event, stream)
    

Parameters

Parameter

Description

event

Int, pointer address of the event object to be reset.

stream

Int, pointer address of the stream object where the event is located.

For stream synchronization, for example, Stream2 waits for Stream1, set this parameter to Stream2.

Return Values

Return Value

Description

ret

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

Restrictions

Only the events created by the acl.rt.creat_event_with_flag API and flagged with ACL_EVENT_SYNC can be reset.

Note: If tasks in multiple streams need to wait for the same event, calling this API to reset the event is not recommended. As shown in the figure, if aclrtResetEvent is called after aclrtStreamWaitEvent in stream 2, the event will be reset. As a result, aclrtStreamWaitEvent in stream 3 will fail.