0
votes

I've created multiple OpenCL queues with clCreateCommandQueue().

cl_int ret_code = CL_SUCCESS;
cl_command_queue queue1 = clCreateCommandQueue(GPU_context, GPU_device_ID, CL_QUEUE_PROFILING_ENABLE, &ret_code);
...
cl_command_queue queueN = clCreateCommandQueue(GPU_context, GPU_device_ID, CL_QUEUE_PROFILING_ENABLE, &ret_code);

All queues are created with no errors. One of that queues has no commands within for a moment. All kernels execution goes fine, etc. Finally i need to release queues I created. All clFinish() goes ok except one - which waits for queue, that has no commands within (say, queueN has no commands within). So that

clFinish(queue1);
...
clFinish(queueK);

returns correctly, but

clFinish(queueN);

Hangs forever. What can be the solution?

OS is Ubuntu 12.04 x64. GPU is GeForce GTS450. OpenCL SDK 1.1

3

3 Answers

0
votes

Probably is a driver bug. I found many of these when working in "nVIDIA + Linux + OpenCL". In my case, my program hunged after a clReadBuffer() blocking call, which never returned.

Does it happen even if you only create 2 queues?

My advise to overcome this problem is to use as few queues as possible. Normally 2 queues is the best (Kernel processing + I/O). If you use events and out of order queues support, there is no need for more queues.

0
votes

The issue was the difference in OpenCL events releasing on different platforms. After getting rid of that, code starts to work just fine.

0
votes

We were seeing a similar issue (as well as some others including driver hangs) in OS X 10.8, 10.9 and beta 10.10 and found that removing CL_QUEUE_PROFILING_ENABLE solved it.