aclrtCreateEventWithFlag

Description

Creates an event. This API is synchronous.

Restrictions

Since only the ACL_EVENT_TIME_LINE flag is supported, the number of created events is not limited, but the created events can only be used to compute the elapsed time between events.

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
    Indicates that the number of created events is not limited, and the created events can be used to compute the elapsed time between events.
    #define ACL_EVENT_TIME_LINE 0x00000008u
  • ACL_EVENT_SYNC
    Indicates that the number of created events is limited, and the created events can be used for synchronization between multiple streams.
    #define ACL_EVENT_SYNC 0x00000001u

flag is a bitmap. You can set the flag to a single macro or perform the OR operation on multiple macros. When this API is used to create events, if the value of flag contains the ACL_EVENT_SYNC macro, the number of created events is limited. The details are as follows:

For the Ascend 310 AI Processor, a single device supports a maximum of 1023 events.

For the Ascend 910 AI Processor, a single device supports a maximum of 65535 events.

For the Ascend 310P AI Processor, a single device supports a maximum of 1023 events.

Returns

0 on success; else, failure.

Related APIs

aclrtCreateEvent: creates an event. Only a limited number of events can be created by using this API. The created events can be used to not only compute the elapsed time between two events, but also synchronize streams and synchronize on an event.