Using the OpenCL C++ bindings (documentation), is it possible to have enqueued commands wait for only one cl::Event?
Let's take a look at enqueueReadBuffer()'s signature as an example:
cl_int cl::CommandQueue::enqueueReadBuffer(
...
const VECTOR_CLASS<Event>* events = NULL,
... )
It expects a pointer to a VECTOR_CLASS (e.g. std::vector) of cl::Event and there is no overload for the case of a single cl::Event. Of course one could wrap a single cl::Event into a VECTOR_CLASS of size 1, but that does not seem to be a very good solution. I was wondering if there is a better solution, since waiting on a single cl::Event seems like a pretty common thing to do ...
Notice that this problem does not exist in the OpenCL C API (documentation), where you pass a pointer to a cl_event and the number of cl_events that are read.
cl_int clEnqueueReadBuffer (
cl_command_queue command_queue,
...
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
... )
Maybe you can just execute event.wait() and then enqueue another event. See this link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With