2008 Fall CS 525 (GPU Programming)

Sangyoon (James) Lee (sjames @ evl.uic.edu)

Electronic Visualization Laboratory

University of Illinois at Chicago

This document is a part of CS525 GPU Programming Class instructed by Andy Johnson.

26nd, Sep., 2008

1. Setup CUDA project

First of all, you need to install necessary software from nvidia. Follow the instruction on nivida's web page.


This document uses CUDA 2.0 SDK. You also can find many useful contents within CUDA SDK sample directory. For the second project in class (n-body), GPU Gems chapter 31 is included in CUDA SDK nbody example doc directory.

If you have any trouble in setting up your project or this document, please let me know.

2. Mac OSX

Here we are assuming that you installed CUDA tools and SDK in default location. The, setting up cuda project in OSX is relatively simple. SDK include many of useful common library and tools. I grabbed their common configuration to build application (common.mk) and slightly modified to use in any directory.

Here is two necessary files. You copy these two files in your project directory where all your souce code exists.


This file is modified from the original SDK's one slightly. Copy this in your working directory.


Midify this file upon your source code. Basically you add all your source code file names in dedicated section in this file. File itself is fairly simple so I do not expect any trouble in doing so. The last line indicate the common.mk file. So, if you copied above common.mk file somewhere else instead of the directory when this Makefile locate, modify that line too.


Then, you are ready to go. Just build your project. "make" enter. Your executable will go to "yourdir/bin/darwin/realease" or "yourdir/bin/darwin/debug".

Here is hello world source file. (from kyzhao's VS app Wizard. see next session for link).


3. MS Visual Studio 2005

On windows, I would recommend to use Application Wizard. kyzhao wrote this app wizard. You can find it in following link.


Once you install this app wizard, you will see CUDA project tempalte (CUDAWinApp) appeasrs in Visaul C++ project type.

Create your project with this template and you can build at least hello world like simple.cu file.


I tried to make my own by removing default simple.cu and add source files from nvidia SDK sample project... got problems...

In this case, you may play with some custom build setting to indicate compiler, include path and parameters.

Take a look property of .cu file in SDK sample project and use it for your .cu file. Then, it should work.


- Useful VS syntax highlighting

CUDA SDK comes with nice small doc for this. If you wish to see syntax highlighting in cu files, follow nvidia instruction.

"C:\Program Files\NVIDIA Corporation\NVIDIA CUDA\doc\syntax+highlighting\visual_studio8"


* On Vista machine: you must run app wizard installer as administrator (right click on wizard exe and click "run as administrator")