How to kill a hung/slow kernel

Hi, newbie question here. I have started playing around with OpenCL. The application I’m thinking of would run an OpenCL kernel which will perform a possibly long computation that depends on user input. I want to give the user the option of aborting the computation if it takes too long (theoretically it could become stuck in an infinite loop, for example). However, in the OpenCL specification I see no documented way of killing an OpenCL kernel that is currently running, only the clFinish function call which just waits for the kernel to finish. Am I missing something here? Is it possible to do this? If not, why not, and is this something that might be added in the future?

This is not possible to do at the moment. You need to ensure that your kernels do not take too long. This is particularly true on systems where the display is sharing the GPU. In that case the operating system will generally impose a hard limit on how long your kernel can run, resulting in your program crashing if you run too long.

Thanks! Guess I’ll have to be more careful about my architecture design. Would be nice if this option were added, though…