What else causes CL_OUT_OF_RESOURCES

I’m just getting my feet wet with OpenCL, but I’m a little stumped with this.

I’m trying to offload some image sampling to the GPU in a fairly monolithic application that I work on, and I’m getting this return code when I try to enqueue my kernel even if the implementation doesn’t DO anything.

The documentation says this can mean just about anything, but suggests:

  • Too many work items for the kernel
  • Too many image parameters
  • Too many sampler parameters

Considering that I still get this when using clEnqueueTask, and the kernel only takes one image and one sampler, I’m fairly confident it’s not any of those. That would only require a single work item, and according to clGetKernelWorkGroupInfo, this device should be able to handle 512 work items with the register requirements of this kernel.

Someone else on this forum suggested that you can get this return code if you specify an incorrect name for your kernel in clCreateKernel. I was really hoping that would be my problem, but sadly I had typed it correctly the first time.

Does anyone have any helpful insight, or suggestions how to tackle this problem? At this point, I’ll entertain even inane suggestions, so please fire away.

Does the kernel name passed to clCreateKernel match the one in the program?

I found that clCreateKernel doesn’t fail immediately if you give it an unknown kernel name. clEnqueueKernel later gives CL_OUT_OF_RESOURCES if you try to execute it.

Copy/Pasted… just to be sure; no dice. :(

Well, I figured it out after enough trial and error…

The image that I was passing into my kernel was causing it to return this error.

“What was wrong with the image?”, you ask…

Apparently, the image channel order CL_RGB was causing the problem; CL_R, or CL_RGBA work fine.

“But surely it would have told you that was an unsupported image format when you ran clCreateImage2D?”

No, it didn’t. It would tell me that CL_INTENSITY was not supported, but had no problem with CL_RGB… until I tried to run the kernel.

I hope this will help someone else.

Ah, yes, I’ve run into that one too!

The OS X driver correctly gives the unsupported image format error. The Linux driver lets you create it and fails with odd errors later.

Possible to get a sample of your programm with ClEnqueueTask

Possible to get a sample of your programm with ClEnqueueTask