Function: record_event
Applicability
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Description
Records an event in a stream. When this API is called, the tasks that have been delivered in the current stream are captured and recorded in the event. Therefore, when the acl.rt.query_event_status or acl.rt.stream_wait_event API is called later, the system checks or waits until all the tasks captured in the event are complete.
For events created using acl rt.create_event_ex_with_flag:
- This API 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 acl.rt.stream_wait_event is called, the task saved in the latest event is used and will not be affected by subsequent calling of acl.rt.record_event.
- Before this API is called for the first time, ACL_EVENT_RECORDED_STATUS_COMPLETE is returned when acl.rt.query_event_status is called because there is no task in the event.
Prototype
- C Prototype
1aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream)
- Python Function
1ret = acl.rt.record_event(event, stream)
Parameters
|
Parameter |
Description |
|---|---|
|
event |
Int, pointer address of the event to be recorded. |
|
stream |
Int, the specified stream (pointer address) recording the event. 0 indicates the default stream. |
Return Value
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code. 0 on success; else, failure. |
Restrictions
- This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, call the synchronization API (for example, acl.rt.synchronize_stream) to ensure that the task is complete.
- acl.rt.record_event and acl.rt.stream_wait_event are used in conjunction for synchronization between streams. When acl.rt.record_event is called, an event resource is allocated. After acl.rt.stream_wait_event is called, acl.rt.reset_event should be called to free the event resource in a timely manner.
API call sequence: acl.rt.create_event-->acl.rt.record_event-->acl.rt.stream_wait_event-->acl.rt.reset_event