cuda - OpenCL application with 3 different kernels -
i started opencl , want port app have in cuda. problem i'm facing kernel stuff. in cuda have kernel functions in same file, on contrary, opencl asks read file kernel source code , other stuff.
my question is: can have 1 single file kernel functions , build program in opencl or have have 1 file each of kernel functions?
it nice if give little example.
the difference between opencl , cuda (in specific regard) cuda allows mix device host code in same source file, while opencl requires load program source external string , compile @ runtime.
but nevertheless absolutely no problem put many kernel functions single opencl program, or single opencl program source string. kernels (say c api kernel objects) extracted program object using respective function names.
pseudocode simplifying opencl's ugly c interface:
single opencl file:
__kernel void a(...) {} __kernel void b(...) {}
c file:
source = read_cl_file(); program = clcreateprogramwithsource(source); clbuildprogram(program); kernel_a = clcreatekernel(program, "a"); kernel_b = clcreatekernel(program, "b");
Comments
Post a Comment