使用OpenCL C++ 绑定(文档),是否可以让排队的命令只等待一个 cl::Event
?
我们以enqueueReadBuffer()
's 的签名为例:
cl_int cl::CommandQueue::enqueueReadBuffer(
...
const VECTOR_CLASS<Event>* events = NULL,
... )
它需要一个指向 a VECTOR_CLASS
(eg std::vector
) of的指针,cl::Event
并且对于单个 的情况没有重载cl::Event
。当然,可以将单个包装cl::Event
成VECTOR_CLASS
1 号的,但这似乎不是一个很好的解决方案。我想知道是否有更好的解决方案,因为等待单身cl::Event
似乎是一件很常见的事情......
请注意, OpenCL C API(文档)中不存在此问题,您将指针传递给 acl_event
和cl_event
读取的 s 数量。
cl_int clEnqueueReadBuffer (
cl_command_queue command_queue,
...
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
... )