A simple guide to start GPU programming 1


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

Key steps:

  • 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.

URL: https://developer.nvidia.com/cuda-downloads

For WinXP(32 bit): http://developer.download.nvidia.com/compute/cuda/5_0/rel-update-1/installers/cuda_5.0.35_winxp_general_32-3.msi

You can choose what to install from the following packages:

  1. 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)

    CUDA Driver

    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.
  2. 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:

    Bin\
    the compiler executables and runtime libraries
    Include\
    the header files needed to compile CUDA programs
    Lib\
    the library files needed to link CUDA programs
    Doc\
    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.

  3. 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:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\CUDA Samples\v5.0

    For Windows Vista, Windows 7, and Windows Server 2008, the samples can be found here:

    C:\ProgramData\NVIDIA Corporation\CUDA Samples\v5.0

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

CUDA Samples\v5.0\C\<category>\<sample_name>

or the global solution files

Samples*.slnlocated in

CUDA Samples\v5.0\C

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).


Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “A simple guide to start GPU programming