|Home > Optimizing OpenCL for Mali GPUs > Load balancing between control threads and OpenCL threads > Do not use clFinish() for synchronization|
Sometimes the application processor must access data written by OpenCL. This process must be synchronized.
You can perform the synchronization with clFinish() but Arm recommends you avoid this if possible because it serializes execution. Calls to clFinish() introduce delays because the control thread must wait until all of the jobs in the queue to complete execution. The control thread is idle while it is waiting for this process to complete.
Instead, where possible, use clWaitForEvents() or callbacks to ensure that the control thread and OpenCL can work in parallel.