pointers - How to pass device function as an input argument to host-side function? -


i want pass device function argument of host function, of cause, host function can launch kernels device side function.

i tried usual c++ way (pass pointer/reference) , cuda debugger told me kernel cannot launch.

update:

what want is:

__host__ void hostfunction(int a, int (*devicefunction)(int)) {    /...do something.../    somekernel<<<blocks, threads>>>(int * in, devicefunction); } 

and launch host with:

hostfunction(x, &somedevicefunctiontemplate<int>); 

it'd helpful if post example of trying do, 1 thing check compiling , running on fermi (sm_20) or later since older gpus did not support non-inlined function calls.

check compute capability of device (needs 2.0 or later) , check nvcc command line (needs -arch=sm_20 or later, or -gencode equivalent).


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -