aclrtCreateEventWithFlag

Description

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.

Restrictions

When this API is called to create an event, the flag is a bitmap. You can set the flag to a single macro or perform the OR operation on multiple macros.

  • If the flag contains the ACL_EVENT_SYNC macro, the number of created events is limited. For details, see the following:

    Model

    Maximum Number of Events Supported by a Device

    Atlas 200/300/500 Inference Product

    1,023

    Atlas Training Series Product

    65,535

  • If the value of flag does not contain the ACL_EVENT_SYNC macro, events created by this API cannot be used in the following APIs: aclrtResetEvent, aclrtStreamWaitEvent, and aclrtQueryEventWaitStatus.

Prototype

aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag)

Parameters

Parameter

Input/Output

Description

event

Output

Event pointer.

flag

Input

Flag of the event pointer.

The supported macros are as follows:

  • ACL_EVENT_TIME_LINE
    If this bit is enabled, the timestamp information needs to be recorded for the created event. Note: Enabling the timestamp function affects the performance of event-related APIs.
    #define ACL_EVENT_TIME_LINE 0x00000008u
  • ACL_EVENT_SYNC
    If this bit is enabled, the created event supports synchronization between multiple streams.
    #define ACL_EVENT_SYNC 0x00000001u
  • ACL_EVENT_CAPTURE_STREAM_PROGRESS

    If this bit is enabled, the created event is used to trace the task execution progress of the stream.

    #define ACL_EVENT_CAPTURE_STREAM_PROGRESS 0x00000002u 

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.