CUDA recursive copy

This is a newbie question. I was wondering if CUDA API or some other 3rd party library provides something outside the box which copies a complicated object form the CPU to the GPU.

Basically this object is a struct composed of pointers to other structs etc… So instead of doing cudaMalloc and cudaMemCpy for every single member pointer was wondering if there is something which would iterate through the object and give me the same object on the GPU.

CUDA certainly doesn’t provide anything like this. Without any kind of reflection capabilities in C/C++, I don’t think any library could provide this without some kind of compiler-like frontend to generate copy code specific to a particular struct or class.

There isn’t much demand for this at the moment since these kinds of data structures tend to perform poorly on GPUs. (All that pointer chasing kills your total memory bandwidth.) Most people have better success flattening things into arrays.