I have been having a bit of trouble compiling a kernel with a static array of integers. When compiling the kernel (see code below) on the GPU, I receive the following:

For test only: Expires on Sun Feb 28 00:00:00 2010

CL Error: clBuildProgram (-11)

Build Log:

Link failed

Press any key to continue . . .

__kernel void combination(const int n, const int k, __global int *out) { size_t gid = get_global_id(0); int a[k]; int index = gid*100; for(int i = 0; i < k; i++) a[i] = gid+i; while(index != -1) { for(int i = 0; i < k; i++) out[index++] = a[i]; int j = k - 1; if(a[j] < n - 1) { ++a[j]; continue; } while(a[j] - a[j-1] == 1) --j; if(j == 1) { index = -1; continue; } int z = ++a[j-1]; while(j < k) { a[j] = ++z; ++j; } } }

This is not possible in OpenCL and violates the spec, section 6.8.d. "Variable length arrays and structures with flexible(or unsized) arrays are not supported."