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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -