CUDA has taken the computing world with storm. This seems a lot exaggerated but this is where all indicators are pointing to. Introduced in late 2006 by NVIDIA, CUDA which is short for Compute Unified Device Architecture allows programmers with minimal extra effort to code massively parallel algorithms on GPUs. So why GPU when we have been running the same tasks on CPU for ages now? The answer is pretty simple: Massively parallel tasks run best in parallel and GPU offers upto 512 cores (latest NVIDIA’s card) which means you can run 512*512 = almost quarter of a million threads (of course theoretically) in parallel whereas that’s still a dream for any given CPU.
For those who have already started and facing problems running their CUDA code on Visual Studio 2008 (this applies of the earlier versions too but with minute modifications) here’s a quick starter guide:
What you require:
1) Visual Studio 2008
2) CUDA SDK
3) CUDA Toolkit
The best thing is that you can code and run CUDA apps without CUDA enabled Graphics Card installed but your applications will run on emulator which of course won’t show any improvement from your previously coded sequential code.
Step 1: Adding cuda.rules to your project
Step 2: Now setup your BIN, INCLUDE and LIB directories.
Goto Tools –> Options –> Projects and Solutions –> VC++ Directories
First, lets specify the INCLUDE directories. Select Include Directories from the “Show Directories for” dropdown menu.
Final Step: Specify the CUDA Runtime and CUTIL32D Linkers
Linkers work during compilation when your code is linked to external libraries that you use.
Alas! You’re done! Now you can try Rebuilding the sample code that comes with CUDA SDK. Simply open the project folder and then open the .sln file in it to open it in VS08 and then Right click on the project and click Rebuild and run it for yourself!
If everything has been properly setup, The Rebuild should be Successful and if not then don’t hesitate to comment on here with your specific problem.
Note: Kindly specify your CUDA Toolkit version, CUDA SDK Version and your OS in your questions.
P.S: Since CUDA Toolkit version 3.2 the Cuda.rules file is now shipped with the toolkit. In the older versions the rules file was shipped with the SDK and not the Toolkit so you had to download the both to write CUDA programs.