shunya
shunya

Reputation: 553

Error in function clbuildprogram... (it returns -11)

I've created a bubble sort code. The clbuildprogram in the user function createProgram is giving an error My kernel looks like:

__kernel void sort_kernel(__global const float *a, __global const float *b)
{
    const int n=100;
    int j;
    float temp;
    int gid = get_global_id(0);
    b[gid]=a[gid];

    for(j=0; j < n-gid; j++)
    {
        if(b[j+1]<b[j])
        {
            temp=b[j];
            b[j]=b[j+1];
            b[j+1]=temp;
        }
    }
}

clbuildprogram is giving an error as per the runtime error.

***Error in kernel: :1:1: error: unknown type name '_kernel'

_kernel void sort_kernel(__global const float *a, __global const float *b) //, ^

:1:9: error: expected identifier or '(' _kernel void sort_kernel(__global const float *a, __global const float *b) //, ^

:21:3: error: expected external declaration } ^

:23:1: error: expected external declaration } ^

:23:1: error: expected external declaration***

Please tell me what is the error and how can I rectify it...?

Upvotes: 0

Views: 1324

Answers (1)

sr01853
sr01853

Reputation: 6121

You missed a _ in your program. The error is obvious.I dont think the code pasted here is the same as you run. Correct your _kernel to __kernel in your program.

Upvotes: 2

Related Questions