Simple OpenCL Kernel

Posted by Yuuta on Stack Overflow See other posts from Stack Overflow or by Yuuta
Published on 2012-03-25T16:50:01Z Indexed on 2012/03/25 17:29 UTC
Read the original article Hit count: 150

Filed under:
|
|
|

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!

© Stack Overflow or respective owner

Related posts about c

    Related posts about initialization