View Full Version : Events usage

02-11-2011, 09:04 AM

Is it any way to reuse Event objects after assosiated queue entry was executed?
Is event.wait() function clean CL_COMPLETE event status?
It looks like I need all the time allocate and deallocate Event objects if they are supposed to be used in iterrative procedure.

02-11-2011, 09:12 AM
You can use events to get profiling information (see clGetEventProfilingInfo), e.g. you can use it to compute the execution time of a command after it has finished.

02-11-2011, 09:17 AM
That's great.
In my case I have to use events for synchronization. I have steam of messages carrying data that I have to accept, put in the image3D memory buffer (non-blocking) and than the buffer is full execute kernel. I can start kernel only after all memory operations are done and then start over. My question is it any way to use the event I created on first iteration on second one?

02-11-2011, 03:00 PM
Sorry, I thought you were asking why en event is still "valid" after the associated command has been executed.

Have you tried using clReleaseEvent() ? At the end of each iteration you could release the event and then use the same variable in the next iteration. I haven't tried it myself, but I don't see why it shouldn't work.

02-16-2011, 08:19 PM
No, cl_events are not reusable. cl_events are allocated by the runtime during the enqueue call and freed when their retain count goes to zero. Your thread should call clReleaseEvent when it is finished with the object, but the retain count might remain greater than zero.