tags:

views:

11

answers:

1

Hi everyone,

i am using atom_inc in one of my kernels. More or less like this:

kernel exampleKernel(
  global volatile int * x, 
  global const int   maxX,
  global const int * buf1, 
  global const int * buf2
  )
{
  if(x < maxX)
  {
    int y = atom_inc(x);
    buf2[y] = buf1[get_global_id(0)];
  }
}

But it gives me an CL_OUT_OF_RESOURCES error when i call it. Replacing atom_inc(x) with 0 resolves this problem ... but makes the kernel useless.

Any ideas what can cause that error?

Edit: i have included these extensions in the program:

#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable

Edit2: actually i initialize x with:

kernel.setArgs(0,0);

Do i have to use a memory object in this place?

Kind Regards, Florian

A: 

Ah ... ok ... it looks like you have to use memory objects in this case.

The solution here was to create a one element OpenCL buffer and set it as the first argument.

I'll leave this question and answer here so that others might not make the same fault.

Florian
Yes, your kernel was crashing (NULL dereference) and that error is reported as CL_OUT_OF_RESOURCES (A bit misleading).
Matias Valdenegro