6.23.2008

How to teach Parallel Programming

Intel dev blogs just posted an interesting question about 'What 3 things students need to know about parallel programming'. I'm sure we're all aware that the answer is '3 things aren't enough..' But for shits & giggles (which i always found was an odd combination of words for an expression...) let's run with this question..


I moonlight as an adjunct professor at SMU GUILDHALL for game development. I've been teaching there since about 2004, and have taught various courses on Math, Phsyics, Advanced Rendering, and am now teaching a course on concurrent programming for video games. This is my first time teaching this course on threading, but since I got to make the curriculum myself, it came pretty easy to me ;) The class is 8 weeks, and I was lucky enough to have Rich Geldreich and Andrew Foster along to help lecture along the way. All in all, we've had a really good result in terms of getting the students to understand and use the data in a practical application.

Here's the basic breakdown of what the kids need to know:



Introduction to threading.
Introduction of basic threading concept at both hardware & software levels. Introduce low level threading primitives : Event, Mutex, Critical Section, Semaphore, Monitor. Introduce basic threading control (waitFor*Object(s)...)

Thread safe Memory; Thread safe Code
Introduce importance of memory models & ownership between threads. Discuss various memory models and how they relate to threading. Also discuss thread safe code, and how to make your code thread safe.

Thread safe Containers
Introduce synchronization concepts (fine grain / course grain synchronization). Introduce various thread safe containers (fifo, vector, etc).

High level threading control
Introduce message passing & memory transfer between threads. Introduce Producer / consumer architecture; Fork & Join; Thread Pool.

Task Synchronization
Discuss task generation & work distribution. Discuss task identification and data decomposition for threading. Introduce parallel_* concepts and how they fit into everything. Discuss higher level locks & task dependency

Lock Free & Wait Free algorithms
Introduce lock free containers & algorithms.

I have to say that the kids have been responding very, very well to the class work. Besides their brains melting w/ lock free algorithms, they have been picking up and running with threading and memory safety quite well.

Quite frankly, we need to start pushing parallel programming to our students. Hardware manufactures are quite obvious about the lack of desire to make single core chips any faster, and things like LARRABEE just prove that we should be jumping on the multi threaded bandwagon!


~Main

0 comments: