Monday, March 9, 2009

OpenMP

OpenMP is a set of compiler directives and a run time environment which enable programmers to implement fork-and-join models very easy.

Fork-and-join means that a sequential program comes to a point where parallel execution is possible and meaningful. At this point multiple threads of execution are started which do all the partial computations in parallel. When everything is done the partial results are collected and aggregated and the threads are joined. From there on the program is sequential again.

With OpenMP's compiler directives you simply specify the programs concurrency structure. Everything else is done automatically by the compiler and the OpenMP run time environment. Your program becomes highly concurrent and you don't see a single lock or a thread. Everything happens behind the scenes. Nevertheless it is possible to configure scheduler algorithms and parameters.

Wikipedia has a great article about OpenMP. No need to repeat everything here. If you have a program which fits the fork-and-join model you definitely want to give OpenMP a try.

No comments:

Post a Comment