C OpenMP: Compiler Extensions for Multi-Threading
The Pthreads standard discussed in Appendix B is very flexible and provides a large amount of functionality, but parallel programming with Pthreads can be complicated and requires implementation of code written specifically with multi-threading in mind. OpenMP provides an alternative, and somewhat simpler, way to use multi-threading in parallel applications. OpenMP is an extension to the Fortran, C, and C++ languages designed to make it possible to easily take advantage of multi-threading in both new programs and existing serial code. OpenMP also provides several work-sharing constructs that are much more high level than those provided by Pthreads. OpenMP is used by providing the compiler with code annotations. These annotations are ignored by compilers that do not support OpenMP, making it possible to maintain backwards compatibility. OpenMP has been available in commercial compilers for some time, and it is also available in recent versions of the GNU Compiler Collection (GCC),1 making its adoption rate likely to increase.