Particles example I need clarrification

I’m trying to make a CUDA program that does not use the CPU except for initialisation, to avoid overhead between CPU and GPU. I’m an absolute beginner, so stick with me.

I’ve been looking at the particles example, and it confused me somewhat. For one, the particlesystem.h file said “// CUDA BodySystem: runs on the GPU”, referring to the class below it.

I thought it was impossible to use C++ (and hence classes) on device code. How is it possible that this class somehow runs on the gpu anyway?

When looking at the main display function, I notice it calls functions on this class, of which some are defined in the header file, and others in a cu file. But none of them are kernels. So does this mean the CPU does all the work? And who has all the data? CPU or GPU?

I’m really confused as my original intention was to make a particle system using VBO’s to store the position of the particles, and render them with openGL. Isn’t this the appropriate way of rendering particles while avoiding cpu/gpu overhead?

thx in advance

has your code any line with <<<param1, param2 >>> (param3, param4…)???
can you put the main here?

This isn’t about my code, I need help explaining the particles example that came with the cuda sdk. It’s a shame it doesn’t have a pdf explaining its implementation.

in particleSystem.h you have the definition “update”.
then in particlesSystem.cpp you have its implementation with other void called “integrateSystem”.
Integratesystem is implemented in particlesystem.cu and call a kernel called “integrate”.
This kernel is implemented in particles_kernel.cu and these lines are executed in GPU!!
it may be a little messy but I hope that you help. if you don’t ask again.

Thanks, that actually helped.