Is there any way to stop OpenCL kernel from execution?
For example, I launch the kernel, do some computations, and then stop it if some conditions were met, otherwise, I wait until it finishes:
clEnqueueNDRange(queue, ...); // start kernel function
// do other stuff...
// ...
if (some condition met) {
stopKernel();
} else {
clFinish(queue);
}
Thank you for help
No. Once you have enqueued your kernel, it will run to completion.
One way to accomplish something like the above is to do this:
This allows you avoid processing ALL the data, with the obvious tradeoff that you’re now submitting work in smaller chunks, which will probably have a performance impact.