OpenCL Best Practices Guide ( https://www.cs.cmu.edu/afs/cs/academic/class/15668-s11/www/cuda-doc/OpenCL_Best_Practices_Guide.pdf ) suggests in the section 3.1.3 to use clFlush
to ensure that commands happen in the right order, e.g. processing doesn't happen before data transfer:
- Transfer the data for queue0
clFlush
for queue0- Run the kernel for queue0, transfer the data for queue1
clFlush
for queue0 and queue1- Run the kernel for queue1 and retrieve the data for queue0
clFlush
for them both- Retrieve the data for queue1
The reply here https://stackoverflow.com/a/12389713/4634819 suggests to use events to achieve, as it seems, the same.
My question is: Did I get it right, and do both clFlush
and events serve the same purpose (avoiding simultaneous execution) in this case? Does it matter which of them to use?