OpenMP

Welcome to the Wikibook Parallel Programming with OpenMP! This short book serves as a tutorial for the OpenMP framework for parallel programming, using the C programming language. It discusses how to easily create parallel programs in C, or add parallel constructs to existing sequential code to make it run faster on multiprocessor and multicore machines.


 * This book assumes you are already familiar with either C or C++. While the examples are in C, OpenMP works very similarly in C++ and the techniques discussed usually carry over to C++ with few modifications. We won't discuss OpenMP support in Fortran.
 * The examples in this book are mostly numerical algorithms, but it is not too heavy on the math. OpenMP is popular in the scientific computing world, but it can just as easily be employed in games, server programs, or any other program that has to do a lot of computation.
 * The emphasis in this book is on the OpenMP 3 standard and programming for multicore CPUs. While OpenMP 4 adds interesting new features including support for vector instructions, GPUs and accelerators, OpenMP 3 is better supported by current C and C++ compilers.

Contents

 * Overview of OpenMP
 * Setting up
 * Parallel loops
 * Reductions: summing floating point numbers
 * Parallel tasks and recursion