Function: create_event_ex_with_flag

C Prototype

aclError aclrtCreateEventExWithFlag(aclrtEvent *event, uint32_t flag)

Python Function

event, ret = acl.rt.create_event_ex_with_flag(flag)

Function Usage

Creates an event with a flag. Events with different flags are used for different functions. When an event is created, multiple flags can be carried (bitwise OR operation) to enable the corresponding flag function. Event resources are not restricted by hardware for the creation of events.

Input Description

flag: int, event pointer flag. The options are as follows:

  • ACL_EVENT_TIME_LINE = 0x00000008 indicates that the number of created events is not limited, and the created events can be used to compute the elapsed time between events.
  • ACL_EVENT_SYNC = 0x00000001 indicates that the number of created events is limited, and the created events can be used for synchronization between multiple streams.
  • ACL_EVENT_CAPTURE_STREAM_PROGRESS = 0x00000002 indicates that the created event is used to trace the task execution progress of the stream.

Return Value

event: int, pointer address of the created event object.

ret: int, error code.

Restrictions

  • Events created using this API cannot be used in the following APIs: acl.rt.reset_event, acl.rt.query_event, and acl.rt.query_event_wait_status.
  • When this API is called to create an event, flag is a bitmap. Operations can be performed on a single flag or multiple flags, for example, acl.rt.create_event_ex_with_flag( ACL_EVENT_TIME_LINE | ACL_EVENT_SYNC).
    • If the value of flag contains ACL_EVENT_SYNC, the system allocates event resources only when acl.rt.record_event is called. Therefore, the number of events is limited. After the number of events reaches the upper limit, the system waits for resource release.

      Limit on the number of events:

      For the Atlas 200/300/500 Inference Product, a single device supports a maximum of 1023 events.

      For the Atlas Training Series Product, a single device supports a maximum of 65535 events.

    • If the value of flag does not contain ACL_EVENT_SYNC, the event created by this API cannot be used in the acl.rt.stream_wait_event API.