Hello, I am posting to inform everyone I published a hopefully stand-alone class to implement some sort of wait-till-first-event functionality for OpenCL.
Let me be clear: I’m not very sold on it myself. In particular, there’s no way to cancel a wait even though those could be trivially added.
This sure needs some additional work but since I have little experience in OpenCL (or mostly the context in which CL is used, not to mention I have access to a single machine) I would like to hear some opinions on what you would need most.
At the end of the day, I couldn’t figure out a way to use clWaitForEvents reliably, nor a way to set up a callback system without relying on polling. The code is C++ (11), RAII style with exceptions. It uses multiple threads and mutex+condition variable synchronization. It has been tested to work as expected on my system.
I’d say the only slightly surprising thing is the use of a ScopedFuncCall object. Those are exactly what you think they are: a function call to be performed when the object goes out of scope. Fairly dangerous for nontrivial operations but they allow me to avoid catch() blocks which I consider ugly.
Opinions/suggestions welcome.