aclrtRecordEvent
Applicability
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Description
Records an event in a specified stream. This API is asynchronous.
The aclrtRecordEvent and aclrtStreamWaitEvent APIs can be used together to synchronize streams.
When aclrtRecordEvent is called, the tasks delivered on the current stream are captured and then recorded in the event. Therefore, you can later call aclrtQueryEventStatus to check whether all tasks captured in the event are completed or call aclrtStreamWaitEvent to wait until all tasks are completed.
In addition, for events created using aclrtCreateEventExWithFlag:
- aclrtRecordEvent 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 aclrtStreamWaitEvent is called, the task saved in the latest event is used and will not be affected by subsequent calling of aclrtRecordEvent.
- Before the aclrtRecordEvent API is called for the first time, ACL_EVENT_RECORDED_STATUS_COMPLETE is returned when aclrtQueryEventStatus is called because there is no task in the event.
Prototype
1
|
aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
event |
Input |
Event to record. For details about the type definition, see aclrtEvent. |
|
stream |
Input |
Stream. For details about the type definition, see aclrtStream. For stream synchronization, for example, Stream2 waits for Stream1, set this parameter to Stream1. |
Returns
0 on success; otherwise, failure. For details, see aclError.