Possible Duplicate:
Copying a struct containing pointers to CUDA device
I have a structure of device pointers, pointing to arrays allocated on the device. like this
struct mystruct{
int* dev1;
double* dev2;
.
.
}
There are a large number of arrays in this structure. I started writing a CUDA kernel in which
I passed the pointer to mystruct
and then derefernce it within the
CUDA kernel code like this mystruct->dev1[i]
.
But I realized after writing a few lines that this will not work since by CUDA first principles
you cannot derefernce a host pointer (in this case to mystruct
) within a CUDA kernel.
But this is kind of inconveneint, since I will have to pass a larger number of arguments to my kernels. Is there any way to avoid this. I would like to keep the number of arguments to my kernel calls as short as possible.