Intel® FPGA SDK for OpenCL™ Standard Edition: Programming Guide

ID 683342
Date 4/22/2019
Public
Document Table of Contents

6.8. Debugging Your OpenCL System That is Gradually Slowing Down

Your OpenCL system might slow down gradually during execution when a loop in the host application keeps creating events without releasing them. To mitigate this slowdown, the host application must release the cl_event objects after they are no longer needed for scheduling or time profiling.
To verify whether the slowdown is caused by the presence of many live events in the OpenCL system, define a context callback function that prints the context callback warnings or errors, as shown in the following example code:
void oclContextCallback (const char *errinfo, const void *, size_t, void *) {
     printf ("Context callback: %s\n", errinfo);
}
int main(){
     …
     // Create the context.
     context = clCreateContext (NULL, num_devices, device, &oclContextCallback, NULL, &status);
     …
}
If the number of live events in the system exceeds the threshold limit of 1000 event objects, the callback function prints the following warning message:
[Runtime Warning]: Too many 'event' objects in the host. This causes deterioration in runtime performance.