1
votes

I need to dequeue a queued OpenCL kernel, if order to free GPU resources. Is it even possible?

What I am doing is queueing a kernel and a I/O copy. Then check in the host side if this result is correct or not. But since 70% of the time is not correct, I queue another run while I check for the result in the host (CPU+GPU is parallel!). This way the GPU is 100% in use.

However, as soon as I found that the result is correct I can't cancel the ongoing kernel. With is wasting GPU resources.

I am using many OpenCL queues and kernels in parallel, so this is effectively slowing me down and putting the bottleneck in the GPU. Is it even possible to dequeue that kernel?

Thanks.

Problem description

1
I had a use case like this and I broke the kernel into several runs with different offsets to process each section of the data. That way I could have better control over the ability to stop when I didn't need to process all the data. This obviously won't work in every case but as most optimized GPGPU code is already broken into small parallel processing groups this shouldn't be too much of a problem. So for your case you would have RUN_A_PART_1, RUN_A_PART_2 then RUN_B_PART_1, RUN_B_PART_2 then when you release the command queue it will only finish the small subset currently being executed. - Jim V

1 Answers

2
votes

This is not possible. Even clReleaseCommandQueue will wait that the kernel finishes its execution.