First thoughts on CUDA
Jun 5, 2012
I've now watched a few lectures on CUDA and I have also played around with it a little bit and here are the first impressions.

Cuda is cool

CUDA is seriously cool. We all remember loop unrolling in regards to optimizing the code run on the CPU. CUDA takes this one step further. The example I most recently watched two matrices were multiplied together, normal maths stuff.
1 2 7
3 4 8
5 6 9
9 8
3 2 1
A naive implementation for the above matrices would be to just loop over each row multiplying with each column and thus producing the new matrix. Not all that efficient, three nested loops (look up matrix multiplication if you are unsure of why three loops are needed for this type of implementation). How would we do it in CUDA? We would spawn a thread for each element in the resulting matrix. Again this is a naive implementation and optimisations can be made. We would have 9 thread doing their thing in parallel. Considerably quicker.

Cool things exists

CUDA comes with many cool libraries to give you the power to do your stuff. Optix is an NVIDIA provided library for doing ray-tracing on the GPU. This feels natural of course since the graphics card is good at, well, graphics. Other things comes as well, like CUBLAS which is a CUDA implementation of the BLAST libraries. In short there is good library support for what you want to do. This is very good, you do not need to implement all the gritty boring things again.

The not so cool stuff

Some things are not quite 'there' just yet. The tooling support is not really great. Running non beta software leaves you without a good tool to write in. VI, Emacs, Gedit, Notepad etc are fine for trivial things, but once you progress from sort of one file programs it becomes hard. Debugging means attaching and using GDB directly, not great. I tried Code::Blocks, Anjuta and Netbeans for my CUDA work, and could not get any of them to work well. However NVIDIA seems to be aware of this problem has their NSight Eclipse edition in beta for registered developers. I have installed it and played with it and it seems to be quite good. If they deliver on the promise they've set out with it will cover this last ugly patch. I will continue to use the beta of Nsight Eclipse edition from now on.

Category: CUDA, Programming 

 Add a comment 
Your Name:
Additional Comments: