OpenCL is funny CL_OUT_OF_RESOURCES

My CL program:

constant double LATTICEWEIGHTS[19] = { 1.0 / 36.0, ..... 1.0 / 36.0 }; void computeFeq( double density, double3 velocity, double* feq) { for (int i = 0; i < 19; ++i) { feq[i] = LATTICEWEIGHTS[i]; // Line 1 //feq[i] = 2.0 * LATTICEWEIGHTS[i]; // Line 2 } } __kernel void Kernel(){ ..... double density; double3 velocity; double feq[19]; computeFeq(density, velocity, feq); } 

This code works. But if I comment on Line 1 and uncomment Line2, CL_OUT_OF_RESOURCES will happen immediately.

Any ideas?

I am testing it using the NVIDIA GTX 670M.

+4
source share
1 answer

This seems wrong, but some things to check first are: register usage. Nvidia GPUs support verbose output. Pass this to the clBuildProgram command, and then check the build log. Something like that:

 clBuildProgram(program, 1, &device_id, "-cl-nv-verbose", NULL, NULL); 

This is described in the cl_nv_compiler_options section. View the maximum number of registers for your device in CUDA documents. What can happen is that the total number of registers required by the work item block is more than is available in one SM / SMX, which leads to an error.

If the use of registers is not a problem, perhaps it could be access to memory outside the boundaries. I do not know that the error message does not suggest this, but I have experienced such errors before. Such a mistake can be anywhere, and it is much more difficult to find.

+4
source

Source: https://habr.com/ru/post/1491283/


All Articles