Q:

PyOpenCL: What is Event.wait() for?

This function is uncommented in the PyOpenCL documentation: http://documen.tician.de/pyopencl/runtime.html?highlight=enqueue#pyopencl.Event.wait
My problem is: I have to call a kernel in a for-loop and after each call enqueue a copy operation with pyopencl.enqueue_copy_buffer(dest, src, size). First I did this with .wait() appended (i.e. pyopencl.enqueue_copy_buffer(dest, src, size).wait()) because I found this in an example. Then I removed .wait() and got a very significant speedup.
So what is this function for and under which conditions can it be abandoned? Thanks.

A:

.wait() will wait for the operation to be completed. If your code can proceed without it being finished (or even started), you can leave it out. Note that this is not related to the order of operations in the queue: they will be executed (unless you use out-of-order queue) in the order you enqueued them, one after another.

