Function: record_event

Applicability

Product

Supported (√/x)

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

Function Usage

Records an event in a stream. When this API is called, it captures the tasks delivered on the current stream and records them in the event. Therefore, you can later call acl.rt.query_event_status to check whether all tasks captured in the event are completed or call acl.rt.stream_wait_event to wait until all tasks are completed.

For events created using acl rt.create_event_ex_with_flag:

  • This API supports event reuse for multiple records of the same event. Each record captures the tasks that have been delivered on the current stream and overwrites the tasks in the event. When acl.rt.stream_wait_event is called, the task saved in the latest event is used and will not be affected by subsequent calling of acl.rt.record_event.
  • Before this API is called for the first time, ACL_EVENT_RECORDED_STATUS_COMPLETE is returned when acl.rt.query_event_status is called because there is no task in the event.

Prototype

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

Parameter Description

Parameter

Description

event

Int, pointer address of the event to be recorded.

stream

Int, the specified stream (pointer address) recording the event. 0 indicates the default stream.

Return Value Description

Return Value

Description

ret

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

Restrictions