OpenMP (Using the GNU Compiler Collection (GCC)) (original) (raw)


6.7 OpenMP

OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C/C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms. It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior.

GCC implements all of the OpenMP Application Program Interface v4.5, and many features from later versions of the OpenMP specification. See OpenMP Implementation Status in GNU Offloading and Multi Processing Runtime Library, for more details about currently supported OpenMP features.

To enable the processing of OpenMP directives ‘#pragma omp’, ‘[[omp::directive(...)]]’, ‘[[omp::decl(...)]]’, and ‘[[omp::sequence(...)]]’ in C and C++, GCC needs to be invoked with the -fopenmp option. This option also arranges for automatic linking of the OpenMP runtime library. See GNU Offloading and Multi Processing Runtime Library.

See Options Controlling OpenMP and OpenACC, for additional options useful with-fopenmp.