I’ve been looking at learning CUDA as a new interest since it first came out. However, it is only in the last week or so that I have bitten the bullet and written some of my own code. I decided to produce a version of the boid flocking algorithm, using Microsoft’s XNA Game Studio for the graphics. I had some previously developed code for XNA which I used as the base for my app. The .NET interop wasn’t too difficult once I started running parts of the C# code in unsafe mode to help with the managed/unmanaged transition.
I have tuned both the CUDA and C# code to manage 10000 boids running at 30 fps. My main problem with tuning the code now seems to be the CPU rather than the GPU. The CPU is 4.5 years old (don’t laugh!) whilst the GPU is a GTX 285. However I hope to have a Core i7 with a GTX 295 delivered next week.
There is a short video of my app on YouTube. Please take a look if you’re interested and let me know what you think.