ParameterCount := 2;
Parameter[0] := vParameterIn.Address; // input integer parameter must be passed as host pointer to host memory.
Parameter[1] := @vParameterOut.Handle; // output integer parameter must be passed as a host pointer to cuda memory pointer.
Address returns host address of host memory.
Handle returns cuda memory pointer.
extern "C"
{ // extern c begin
// para4 is array of 3 integers
// para5 is array of 4 integers
// return some values in them
__global__ void Kernel( int Para1, int Para2, int Para3, int *Para4, int *Para5 )
{
Para4[0] = 111;
Para4[1] = 222;
Para4[2] = 333;
Para5[0] = Para1;
Para5[1] = Para2;
Para5[2] = Para3;
Para5[3] = 666;
}
} // extern c end
The size parameter to the devic to host copy function was zero, little programming mistake in calculating the size somewhere… it wasn’t being assigned/stored.
These kinds of programming mistakes are hard to spot !
Glad I found it !
Now everything is working with above techniques ! External Image
I was already thinking about giving up on cuda and trying opencl… I’m glad it’s working now with cuda ! External Image =D