GPU Programming

CS 179

The use of Graphics Processing Units for rendering is well known, but their power for general parallel computation has only recently been explored. Parallel algorithms running on GPUs can often achieve up to 100x speedup over similar CPU algorithms, with many existing applications for physics simulations, signal processing, financial modeling, neural networks, and countless other fields.

This course will cover programming techniques for the GPU. The course will introduce NVIDIA's parallel computing language, CUDA. Beyond covering the CUDA programming model and syntax, the course will also discuss GPU architecture, high performance computing on GPUs, parallel algorithms, CUDA libraries, and applications of GPU computing. Problem sets will cover performance optimization and specific GPU applications in numerical mathematics, medical imaging, finance, and other fields.

Labwork will require significant programming. A working knowledge of the C programming language will be necessary. Although CS 24 is not a prerequisite, it (or equivalent systems programming experience) is recommended.

9 units; third term.

   
Instructors/TA's: Andrew Zhao - azhao@caltech.edu
Parker Won - jwon@caltech.edu
Nailen Matschke - nailen@caltech.edu
Jordan Bonilla - jordan@caltech.edu
Matthew Cedeno - mcedeno@caltech.edu
Albert Yang - ahyang@caltech.edu
  • Piazza. Please ask through Piazza if you have a question/issue that likely affects other students.
  • cs179.ta@gmail.com. Please send an email to the TA's if you have something that only affects you or your project group.
Supervising professors: Professor Al Barr - barradmin@cs.caltech.edu

 
Time and place: MWF 3:00-3:55 PM
Annenberg 105
 
Office Hours: Jordan Bonilla - Sundays, 9-11 PM
Andrew Zhao - Mondays, 9-11 PM
Albert Yang - Mondays, 8-10 PM
Parker Won - Tuesdays, 6-8 PM
Nailen Matschke - Tuesdays, 8-10 PM
Matthew Cedeno - Tuesdays, 10-12 AM

104 Annenberg, instructional laboratory
 
Grading policy: Here is the grading scheme for the class:
  • 6 labs (60% of grade)
  • 4 week project (40% of grade)
All labs will be scored out of 100 and are weighted equally (meaning each lab is worth 10% of your grade). The final project can be completed individually or as a pair.

Homework extensions may be granted if the TA's see it as appropriate. E grades will not be granted except under extreme circumstances.  

Project: IMPORTANT: see this pdf for project deadlines and information.

Lectures: Week 1 (Introduction), MW Parker, F Nailen
Lecture 1 (Mon. 03/28): PPT PDF
Lecture 2 (Wed. 03/30): PPT PDF
Lecture 3 (Fri. 04/01): PPT PDF
Week 2 (Shared Memory), MW Parker, F Jordan
Lecture 4 (Mon. 04/04): PPT PDF
Lecture 5 (Wed. 04/06): PPT PDF
Lecture 6 (Fri. 04/08): PPT PDF
Week 3 (Reductions, FFT), M Albert, WF Andrew
Lecture 7 (Mon. 04/11): PPT PDF
Lecture 8 (Wed. 04/13): PPT PDF
Lecture 9 (Fri. 04/15): PPT PDF
Week 4 (MRI), MWF Matt
Lecture 10 (Mon. 04/18): PPT PDF
Lecture 11 (Wed. 04/20): PPT PDF
Lecture 12 (Fri. 04/22): PPT PDF
Week 5 (SVD, streaming, etc), MW Jordan, F Nailen
Lecture 13 (Mon. 04/25): PPT PDF
Lecture 14 (Wed. 04/27): PPT PDF
Lecture 15 (Fri. 04/29): PPT PDF
Week 6 (MPI, Multi-GPU, etc.), M Jordan, WF Andrew
Lecture 16 (Mon. 05/02): PPT PDF
Lecture 17a (Wed. 05/04): PPT PDF
Lecture 17b (Wed. 05/04): PPT PDF
Lecture 18 (Fri. 05/06): PPT PDF
Week 7 (Projects) MW (Parker), F (in-class office hour) Nailen
Lecture 19 (Mon. 05/09): PPT PDF
Week 8 (Projects) MW no class, F (in-class office hour) TBD
Week 9 (Projects) MW no class, F (in-class office hour) TBD
Week 10 (Projects) MW no class, F (in-class office hour) TBD

Assignments: Lab 1: assignment text UNIX files Windows files
Lab 2: assignment text UNIX files Windows files
Lab 3: assignment text UNIX files Windows files
Lab 4: assignment text UNIX files Windows files
Lab 5: assignment text UNIX files Windows files
Lab 6: assignment text UNIX files Windows files

Textbook: The CUDA Handbook: A Comprehensive Guide to GPU Programming is recommended but not required. The book is a little more advanced than other CUDA books and might not be very approachable at first, but by the end of the course you should find it to be a valuable reference for both your project as well as any future GPU programming you find yourself doing. Buy through the author's site for a discount.

CUDA Installation Guides: Linux: see our installation guide.
OS X: you shouldn't have too much trouble with NVIDIA's official installation guide, though "CUDA-7.0" should be replaced with "CUDA-7.5" wherever applicable.
Windows: see our installation guide.

Use this code to retrieve your hardware info after you setup CUDA.

Resources: CUDA C Programming Guide
List of NVIDIA GPUs
Mapping from GPU name to Compute Capability

Material from previous year(s): 2015


Less useful, but cool resources: NVIDIA's Parallel Forall Blog
Videos from last several years of NVIDIA's conference on CUDA
How to Write Code the Compiler Can Actually Optimize (2015)
Excellent CPU optimization manuals
What Every Programmer Should Know About Memory
GPU focused systems guide to deep learning