Jacko
Jacko

Reputation: 13205

How do I release a command queue that contains waiting kernels?

In my command queue, I have a user event E and kernels K1, K2 and K3.

I enqueue K1, with wait event to to E.

I enqueue K2, with wait event set to the completion event of K1.

I enqueue K3, with wait event set to the completion event of K2.

Suppose I need to release this command queue before E fires. How do I do this? Currently, release just hangs. Event if I set the event status on E to -1, still does not release.

Upvotes: 0

Views: 336

Answers (1)

DarkZeros
DarkZeros

Reputation: 8420

There is no way to do it at least in < CL 2.0. The only solution is not to queue them in the first place.

I know, it sucks.

Releasing the queue will first call a clFinish() in the queue, leading to a lock situation.


I suffered myself this situation, when I had enough GPU resources, and the CPU was the bottleneck. So I was queuing the next iterations in the GPU, and depending on the CPU result, whether it was enough or not, I run more iterations or I discarded the GPU result.

It would have been great to be able to stop the queued execution as soon as the CPU knows that the data it no longer needed. But you either queue it later (leading to some GPU idle time), or you run it all the time, but dont wait for the result if it is not needed (leading to extra GPU usage).

Upvotes: 1

Related Questions