CS 385 Lab 8, Spring 2009


In this lab, you will port your IncrementAll program to CUDA. You can use this lab to troubleshoot your CUDA setup at home, or you can use our server when it comes online. Keep watching this page for infrastructure updates.

Preparation

Be sure to set up your environment variables to link to the CUDA compiler and libraries. On my personal Mac, I added the following two lines to my ~/.bashrc file:

export PATH=/usr/local/cuda/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
The default installation paths for CUDA will be different on Linux and Windows systems. If you do try CUDA at home, run some of the sample programs in the SDK (template, reduction, etc.) to make sure these tests pass.

Specification

You will need to write the following code in yourlastnameL8.cu, some of which can be copied from previous labs:

Check that your code works for values of N that are both large and small, as well as values that do not evenly divide the number of thread blocks or threads.

Compiling your code

You should be able to compile your code using nvcc -o outputfile sourcefile.cu -- if you run into problems other than syntax errors, the likely culprit is your environment variables.

Submitting your file

Make sure that your file is correctly named and then copy it to ~srivoire/cs385/submit. Wait 2 minutes, and then check that it was correctly submitted by visiting http://rivoire.cs.sonoma.edu/cs385/lab8sub.txt.