aclrtCreateEventExWithFlag
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. Event resources are not restricted by hardware for the creation of events.
Restrictions
- Events created using this API cannot be used in the following APIs: aclrtResetEvent, aclrtQueryEvent, and aclrtQueryEventWaitStatus.
- 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 value of flag contains the ACL_EVENT_SYNC macro, the system applies for event resources only when the aclrtRecordEvent API is called. Therefore, the number of events is limited. When the number of events reaches the upper limit, the system waits for resource release.
The number of events supported varies depending on the hardware model, as shown in the following table.
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 ACL_EVENT_SYNC, the event created by this API cannot be used in the aclrtStreamWaitEvent API.
- If the value of flag contains the ACL_EVENT_SYNC macro, the system applies for event resources only when the aclrtRecordEvent API is called. Therefore, the number of events is limited. When the number of events reaches the upper limit, the system waits for resource release.
Prototype
aclError aclrtCreateEventExWithFlag(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:
|
Returns
The value 0 indicates success, and other values indicate failure. For details, see aclError.