This is a simple guide document for getting start with GPU programming by using CUDA SDK, and my working environment is WinXP + VS 2010.
If you are looking for a comprehensive guide of GPU programming, you need to visit http://docs.nvidia.com/cuda/index.html.
Here we go.
1. Installing CUDA Development Tools
- Verify the system has a CUDA-capable GPU.
- Download the NVIDIA CUDA Toolkit.
- Install the NVIDIA CUDA Toolkit.
- Test that the installed software runs correctly and communicated with the hardware.
You can choose what to install from the following packages:
Note: If you want to install the CUDA Driver for new hardware, and have already installed the CUDA Driver before, you can launch the CUDA Driver installer from the Start Menu under:
NVIDIA Corporation\CUDA Toolkit\v5.0, or
NVIDIA Corporation\CUDA Toolkit\v5.0 (64 bit)
The CUDA Driver installation can be done silently or by using a GUI. A silent installation of the driver is done by enabling that feature when choosing what to install.
- Silent: Only the display driver will be installed.
- GUI: A window will appear after the CUDA Toolkit installation if you allowed it at the last dialog with the full driver installation UI. You can choose which features you wish to install.
- CUDA Toolkit
The CUDA Toolkit installation defaults to
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v#.#, where
#.#is version number 3.2 or higher. This directory contains the following:
- the compiler executables and runtime libraries
- the header files needed to compile CUDA programs
- the library files needed to link CUDA programs
- the CUDA C Programming Guide, CUDA C Best Practices Guide, documentation for the CUDA libraries, and other CUDA Toolkit-related documentation
Note: CUDA Toolkit versions 3.1 and earlier installed into
C:\CUDAby default, requiring prior CUDA Toolkit versions to be uninstalled before the installation of new versions. Beginning with CUDA Toolkit 3.2, multiple CUDA Toolkit versions can be installed simultaneously.
- CUDA Samples The CUDA Samples contain source code for many example problems and templates with Microsoft Visual Studio 2008 and 2010 projects.
For Windows XP, the samples can be found here:C++1<span style="color: #0000ff;">C:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\CUDA Samples\v5.0</span>
For Windows Vista, Windows 7, and Windows Server 2008, the samples can be found here:C++1<span style="color: #0000ff;">C:\ProgramData\NVIDIA Corporation\CUDA Samples\v5.0</span>
2. Compiling CUDA Programs
The project files in the CUDA Samples have been designed to provide simple, one-click builds of the programs that include all source code. To build the 32-bit or 64-bit Windows projects (for release or debug mode), use the provided
*.slnsolution files for Microsoft Visual Studio 2008 or 2010 (and likewise for the corresponding versions of Microsoft Visual C++ Express Edition). You can use either the solution files located in each of the examples directories in
or the global solution files
CUDA Samples are organized according to
<category>. Each sample is organized into one of the following folders: (0_Simple, 1_Utilities, 2_Graphics, 3_Imaging, 4_Finance, 5_Simulations, 6_Advanced, 7_CUDALibraries).