Click here to Skip to main content
15,908,673 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The original C code is

C#
void GaussianArray(float* Gauss, int variable){
    for(int i = 1; i < variable; i++ )
    {
        Gauss[i] = 1;
        for(int j = i - 1; j > 0; j-- )
        {
            Gauss[j] += Gauss[j - 1];
        }
    }
}


-----------------------------------------------------
I'm trying to make opencl kernel code.
how to change above function to kernel?
Posted

1 solution

You misunderstand something very basic in computing. First, OpenCL is not a language, this is a framework: http://en.wikipedia.org/wiki/OpenCL[^].
So, first, the C language remains C language. Second: high-level languages languages produce the same code, for kernel or not, does not matter. In particular, the code of the body of the function works on stack, which is always available, as well as the stack pointer. The only problem is the first parameter, the pointer: it should point to the valid point in memory. But this is a matter of calling code, not the code you show, which is just fine.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900