This may end up being silly, but I stumbled into this question and I am not being able to answer it myself.
What is the practical difference between using the following two pieces of code when writing to a buffer in OpenCL?
- Blocking write:
queue->enqueueWriteBuffer(d_vec, CL_TRUE, 0, sizeof(int) * vec.size(), vec.data());
- Non-blocking write with event.wait():
cl::Event event;
queue->enqueueWriteBuffer(d_vec, CL_FALSE, 0, sizeof(int) * vec.size(), vec.data(), nullptr, &event);
event.wait();
It seems to me that both codes would behave the same in the end. Can anyone explain the difference?
Thank you!