Is it possible to define my own functions in OpenCL code, in order that the kernels could call them? It yes, where can I see some simple example?
Based on the code samples here you can just write functions like:
inline int add(int a,int b)
{
return a+b;
}
(Eg. look at the .cl file in the DXTC or bitonic sort examples.)
I don't know if that's an nvidia only extension but the OpenCL documentation talks about "auxiliary functions" as well as kernels.