Particle Engine with CUDA Is there a way to avoid transfering the particles back to CPU Memory?

Let’s say I use a CUDA kernel to update the particles, since the array is on the GPU, can I render it from there and avoid the transfer each time?

I haven’t started on this, but planning is the first step. Wanna make sure I’m doing it right. Do you have any suggestions what to write it in? (OpenGL, DirectX, XNA)


For simple particle paths without inter-particle interaction, an OpenGL or DirectX vertex shader is a good way to go. Can be applied to point sprites. For more complex interactions, maybe investigate geometry shaders.

CUDA may be able to render the particle coordinates to a texture (but the CUDA texture interop calls aren’t always very high performance). But then you could access this data from a vertex shader for rendering.

DirectX and OpenGL would both work for what you intend. XNA has the drawback of requiring managed code and you need a managed interface to CUDA.

There’s a particle tracing demo in the SDK. Is that what you’re talking about?

I would like to do something like this. I know XNA which would be nice, but I think one of the other options is probably better.

I really just have no idea where to start with writing an OpenGL or DirectX tutorial. All the OpenGL tutorials I can find are really old and outdated.

If you want your tutorial/particle system to be more generic, OpenGL. Otherwise XNA and DirectX will tie you to Windows, obviously. I am always a fan of getting a wide spread on things, so IMHO go with OpenGL.