Using set_event_callback
Closed this issue · 3 comments
Firstly, thank you very much for this library, I'm new to both Rust and OpenCL and find this library with its tests and examples as a great resource.
I'm trying to use set_event_callback
from opencl3/cl3
but cannot find any documentation or examples on how this can be done. Can you please point me to a doc/test if one is available for this?
My goal is for my code to be able to run kernel executions repeatedly while utilizing the GPUs to the maximum possible. So my plan was to avoid blocking actions in the execution path and use event callbacks in order to determine when the kernel execution has been completed. Once it completes, I can flag it and allow my code to start a new execution again. As I mentioned I'm new to this, so maybe what I'm trying to achieve is not possible.
Thank you Itay, I'm glad to hear that you find the library useful.
I'm sorry about the lack of a call to set_event_callback
from opencl3
, that was an oversight by me.
I've added a new method set_callback
to the opencl3
Event
struct and I've also added an example in test_event
to show how it can be used to call a callback function. They are in the develop
branch. Please let me know if you have any problems with them.
BTW, set_callback
calls the OpenCL clSetEventCallback function.
As for your goal, it may be easier to achieve using OpenCL event lists to wait_for_events
(see, clWaitForEvents) than by using callback functions.
Thank you Itay, if you are happy with the new method then please feel free to close this issue.