krishnan

Simple matrix initialisation kernel failing

Discussion created by krishnan on Mar 31, 2011
Latest reply on Apr 4, 2011 by krishnan

Hi folks

I am doing some small test codes on OpenCL to get the hang of it before I use it for a larger project I have planned. I wrote a kernel that simply intializes two floats.

I have some error handling in my test code, and I get the error "Error Building Program 1", which is immediately after `clBuildProgram(program, 0, NULL, NULL, NULL, NULL)'. I get no errors on creating contexts or program objects before this point. So I am assuming that the problem lies in my kernel. I have attached the kernel code to this post.

To explain, I have two integers `m' and `n'. `n' is smaller than `m'. I have two floats `inputA' and `inputB' of size `m+2' and `n+2' respectively. The kernel takes these two floats, a float `h' as well as `n', and intializes `inputA' and `inputB'. The kernel is supposed to run over `m+2' iterations. (To clarify, `m' does not appear in the kernel itself. I mentioned it only to help understand the purpose of the kernel).

Any help would be much appreciated.

const char *KernelSource= "__kernel void initialize (__global float *inputA, __global float *inputB, float h, int n)\n"\ "{\n"\ " float id = get_global_id(0);\n"\ " inputA = h*((float)id-0.5);\n"\ " if(id<n+2);\n"\ " inputB = h*((float)id-0.5)-7.5'\n"\ "}\n"\ "\n";

Outcomes