OpenMP is a standard for parallel programming on shared-memory systems, including multicore systems. It consists primarily of a set of compiler directives for sharing work among multiple threads. OpenMP is supported by all the Fortran, C, and C++ compilers installed on OSC systems.
Availability and Restrictions
OpenMP is available to all OSC users. It is supported by the Intel, PGI, and gnu compilers. If you have any questions, please contact OSC Help.
Usage
Set-up
OpenMP support is built into the compilers. There is no separate module to load.
Building With OpenMP
To build a program with OpenMP, use the compiler flag appropriate to your compiler. The correct libraries are included implicitly.
Compiler Family | Flag |
---|---|
Intel | -qopenmp or -openmp |
gnu | -fopenmp |
PGI | -mp |
Batch Usage
An OpenMP program by default will use a number of threads equal to the number of processor cores available. To use a different number of threads, set the environment variable OMP_NUM_THREADS.
Further Reading
- See the OpenMP® website for API specifications for parallel programming.