What Is OpenMP?
What is OpenMP?
OpenMP is an acronym for Open Multi-Processing. OpenMP is a directive-based Application Programming Interface (API) for developing parallel programs on shared memory architectures. The OpenMP standard is maintained by the OpenMP ARB, a corporation whose board of directors includes representatives from many major computer hardware and software vendors.
The OpenMP ARB (Architecture Review Boards) mission is to standardize directive-based multi-language high-level parallelism that is performant, productive and portable.
The OpenMP API supports shared memory parallel programming in C/C++ and Fortran on many platforms.
OpenMP consists of:
- Compiler directives
- A runtime library
- Environment variables
Compiler directives specify what type of code should be generated, such as threaded code, using commands starting with pragma directives in code comments. For example, an OpenMP compiler directive in C code might look like:
#pragma omp parallel for
OpenMP directives embedded in your code tell the compiler to create a parallel application. If your compiler does not understand the directives or OpenMP is not enabled, then it will create a serial program.
The runtime library is a set of routines that can be used to modify the execution environment at runtime, manipulate locks on memory locations, and time sections of code.
OpenMP-specific environment variables are available to control how your programs are executed at runtime.
Why OpenMP?
The effectiveness of shared memory parallel programming is strongly influenced by the number of cores that share a common memory bank. With 48 - 68 cores per node, Stampede2 is a platform where OpenMP can deliver much more parallelism than it can on older machines that have only 2 or 4 cores/node. Because OpenMP is available on many platforms, modifications you make to your program that help it to run efficiently on Stampede2 should be useful on most other platforms too.