Tuesday, June 24, 2008

What is Cuda?

nvidia_geforce_300 Graphics cards used to have a very fixed purpose - just graphics, but over the last eight or so years they've become more and more programmable, to the point that they're now becoming quite a bit like regular CPU's.
I recently took a look into Cuda. It's a technology from nVidia which allows you to run C code on the GPU of the GeForce 8 series and above.
The cool thing is that the top end nVidia card currently has 240 processing units, and you can put a couple in one machine. So for perhaps around a couple of grand, you can get a 480 core PC - kinda. You don't have to spend that much though; at the time of writing, a 128 processor GeForce 9800 is $200, and a 32 processor 8800 is only $70.


So the promise is that you can write bits of C code, and then execute the same code many times in parallel on the graphics card, beating how long it would take on CPU.
The Cuda website lists almost a hundred projects which have used Cuda, with performance improvements ranging from 2x to 240x. The main reason for the big range is that Cuda's not good for everything. If the piece of code gets large, uses a lot of memory, contains branching and random/scattered memory access, then performance goes down. The highest performance is for short programs with little branching and little memory access.
Some problems are inherently more suited to Cuda-fying than others, but the programmer can still make a big difference by writing their code with the hardware in mind. Working at a low level like this, learning the hardware, and optimizing code to run as efficiently as possible on it, is very similar to the kind of skills used when coding for high performance on games systems, and in particular to PS3 Cell programming. So if you're looking to get into games, then impressing the programmers who interview you with your Cuda skills would be a great way to get your foot in the door!

3 comments:

Methodman said...

so i would like to know which is the best graphic card with cuda technology?

Mark Pope said...

Basically it's the most expensive Nvidia card you can afford :)

The more expensive cards have more cores. As an example, you could currently get a GeForce GTX 550 for $120, and it has 192 cores. Wow, it's not often that 'cores' are 63c each :)

Rafael Cacique said...

The GTX680, from Nvidia's next family (Kepler) will have 1536 CUDA cores!
Is a wild number cruncher just inside your computer's case (: