OpenMP: Threaded Programming for Mortals
CS 441 Lecture, Dr. Lawlor
There's a newish language extension out there called OpenMP, designed to make it easier to write multithreaded code.
Here's how you enable OpenMP
in various compilers. Visual C++ 2005, Intel C++ version 9.0, and
gcc version 4.2 all support OpenMP, although earlier versions do not!
idiomatic OpenMP program: slap "#pragma parallel for" in front of your main loop. You're done!
Here's a more complex "who am I"-style OpenMP program from Lawrence Livermore National Labs. Note the compiler "#pragma" statements!
On the powerwall, you can compile and run OpenMP code as follows:
g++ get_info.c -o get_info -fopenmp
Chris Granade has a nice page on OpenMP on
the Cell Broadband Engine.