CL_OUT_OF_RESOURCES on clEnqueueReadBuffer

Hi folks,

My first few steps with OpenCL and I am facing this below problem.

The Kernel signature looks like


__kernel void knapsack(__global value_type *val,
                       __global weight_type *wgt,
                       __global value_type *soln,
		       __global int *i)

where

  • value_type and weight_type are unsigned int
  • val, wgt, soln and i are allocated using clCreateBuffer
  • val, wgt (5 elements each) are of type CL_MEM_READ_ONLY and soln (126 elements) and i (single element) are CL_MEM_READ_WRITE

I set the arguments as required and launch the kernel. I enqueue a blocking read on ā€˜iā€™ to find the following

  • if in the kernel, a write is performed on soln, the clEnqueueReadBuffer returns with a CL_OUT_OF_RESOURCES
  • if no writes are performed (reads are OK, writes on ā€˜iā€™ are OK) on soln the clEnqueueReadBuffer returns with a CL_SUCCESS

I would like to know if I am doing something wrong.
I am using an Nvidia card. Please let me know if you need more information.

/Bharath