Simple OpenCL Kernel
- by Yuuta
I'm trying to write a kernel which is a little long but the output is not correct.
I took out a lot almost everything and finally narrowed down the an initialization problem and I found that the following works:
__kernel void k_sIntegral(__global const float* eData,__global const unsigned long* elements,__global float* area){
const int i = get_global_id(0);
if(i < elements[0]){
area[i] = i;
}
}
But the following does not work:
__kernel void k_sIntegral(__global const float* eData,__global const unsigned long* elements,__global float* area){
const int i = get_global_id(0);
if(i < elements[0]){
__local float a,b,c,j,k,h,s;
area[i] = i;
}
}
Using the first kernel, I get:
area[1] = 1
Using the second kernel, I get:
area[1] = 0 (from calloc)
Update:
It seems like the code does work, but I need to change the function name otherwise it somehow calls the previous function even though it was not compiled (?). Any leads to why that happens?
If anyone can let me know what might be the problem I'll be really grateful, thanks in advance!