What is error -5 : out of resource

I have this kind of error while compiling the kernel

but I really don’t find any syntex error in my code.

what shall be the problem?

error -5 : out of resource

The problem you see is not due to a syntax error. It is happening because your kernel is consuming too many resources. What does that mean? Typically it could be local memory, but it could be other things like private memory (general-purpose registers), constants, etc.

If compilation failed, the best way to know what is the problem is looking into the program build log. Try doing something like this:

cl_char build_log;
size_t log_len;
cl_int errcode = clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &log_len);

if(errcode) panic();

build_log = calloc(log_len + 1, sizeof(cl_char));

errcode = clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, log_len, build_log, NULL);

if(errcode) panic();

printf("Build log: %s
", build_log);


I’ll try this! have a good day! :slight_smile:

For example, imagine you are working with a graphics card with 512Mb of memory, and you’re trying to pass to your kernel a cl_int array with size of 50000*10000. Making some calculations… you’re trying to pass it more than 1,86 gigabytes!