Showing results for 
Search instead for 
Did you mean: 

Archives Discussions


Event remains CL_QUEUED while I keep polling it with clGetEventInfo()


I'm trying to poll a clEvent's completion status similarly like I did it in CAL.

I start the kernel with clEnqueueNDRangeKernel() and then polling it regularly with clGetEventInfo() but it never became CL_COMPLETED, just stays CL_QUEUED. When I use the blocking clWaitEvents() function then it works fine, but I have to check kernel completions asynchronously so I can start the next kernel a little bit earlier, than the actual kernel completes.

My question is that why is the kernel stays queued when I only poll its execution_state? Did I missed something, like a command that make CL start processing its queued jobs (like the first completion poll in CAL initiates the job immediately)?

I've read that CL is starting jobs right at the moment when it was queued (if it's not busy already), so I don't know what's wrong with it.

Thanks for replies

1 Reply

Ok, I've just understood the clFLush() function.

So the correct way to poll is like:

1. clEnqueue...()

2. clFlush()

3. poll regularly with clEventGetInfo() until cl_complete or error