aclrtRecordEvent Call Failure Due to Too Many Events

Symptom

When the aclrtRecordEvent API is called to record an event in a stream, the following error is displayed in the log, indicating that the event ID allocation fails.

Possible Cause

No more event ID resource is available.

Solution

For synchronous tasks between streams, the event ID resources can be reused as follows: After the aclrtRecordEvent and aclrtStreamWaitEvent APIs are called, if the specified event is complete, the aclrtResetEvent API needs to be called in time to destroy the event resource that is no longer needed.

You need to optimize the code logic based on the event ID reuse process.