A tutorial on how to start programming with CUDA?

I’ve read the Programming Guide, I’ve searched the forums and found many scattered bits of info, but I’d like to see a step-by-step introduction to programming in CUDA in Windows XP for a complete Newbie.

Let’s say I’ve just bought a new GF8xxx card, installed a proper driver, installed CUDA Toolkit 1.1, SDK 1.1 and MS Visual Studio 2005. I’ve checked that the applications in “(…)\NVIDIA CUDA SDK\bin\win32\Release” work (oooh, look at them balls bouncing in particles.exe).

Now what do I need to do to write my own “hello world” or “2.5+2.5=5.0” program?

I know I can copy the template project and modify it but that won’t make me understand what’s happening or how the nvcc compiler works within Visual Studio. I’d like to know how I should configure the environment and how to set up my projects so I can start from scratch instead of copying the template.

Is there such a tutorial somewhere?

first step for me was to compile the SDK examples, and then to understand how the reduction was working. After that I copied a template and started to edit away until I had a program that did what I needed. But I would advise you to start by understanding the simple examples, it is much more interesting how to program parallel, than how to make nvcc work in visual studio if you ask me.

Thanks for the reply.

I’ve managed to compile the SDK projects but I haven’t yet looked much into them. I’ll do that in a few days when I have time. Is editing the template regarded as a more or less standard way of making CUDA software?

Hmm, I cannot really tell, as I am mostly using CUDA from matlab, so I am just compiling using nvmex, but I did copy the example for matlab-cuda and just edited the makefile.

But then again, if copying the template works, why not do it ? :D


I would like to say that a good way to start would be to look at the examples and try to figure out if and how your problem can be reduced to one of the examples…(well at least that’s how I did mine).

You could always start afresh with the template project but if you’re working with OpenGL or DirectX then by all means use simpleGL or simpleD3D, they have the groundwork done on which you can base your solution.



It is certainly heavy :)

To me too,

But show me a place where it is normally painted both about blocks and about threads?

I shall be grateful

Well I know a parallel method and how to realize, but…


Thanks, that seems like a good place to start!

I have some tutorial which i had received from a semina about cuda in japan

this tutorial is very easy to getting start with cuda.

You should enjoy it. :D

examples.zip (35.1 KB)

I’ve been writing a series of tutorials on parallel programming at llpanorama.wordpress.com. I’ve just started writing a section on CUDA. These may help you as they appear, but I expect you’ll progress more rapidly by going through the examples in the CUDA SDK.

If you can read Chinese, maybe my blog will help you to start~

For tutorials, people may want to look at the series of articles on CUDA by Rob Farber published in Dr. Dobbs Journal: http://ddj.com/hpc-high-performance-computing/207402986

He’s publishing an article about every two weeks.

I’ve also published my second entry on CUDA programming: http://llpanorama.wordpress.com/2008/05/21…t-cuda-program/

It shows how to get a simple CUDA program setup and compiled using Visual C++ 2005 Express Edition.

Also, for people who just want CUDA-enable their MATLAB code with minimal code rewrite (all you need to do is cast your matrices to ‘gsingle’ data type), AccelerEyes just released Jacket: A GPU Engine for MATLAB.

Download the free beta release at: http://www.accelereyes.com


I know this is a long time ago, but do you by any chance have some text for this tutorial?