I had the same problem as mine (took me all day to fix). I am sure that people with the same problem will stumble on this, so I am posting this old question.
You may not have checked the maximum size of the kernel workgroup. .
Here's how you do it:
size_t kernel_work_group_size; clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &kernel_work_group_size, NULL);
My devices (2x NVIDIA GTX 460 and Intel i7 CPU) support a maximum workgroup size of 1024, but the code above returns around 500 when I transfer my path tracking kernel. When I used workgroup size 1024, it obviously failed and gave me the CL_OUT_OF_RESOURCES error.
The more complex your kernel, the smaller the maximum workgroup size for it will become (or at least what I experienced).
Edit:
I just realized that you said "clEnqueueReadBuffer" instead of "clEnqueueNDRangeKernel" ...
My answer was related to clEnqueueNDRangeKernel.
I'm sorry for the mistake.
I hope this is still useful for other people.
source share