Enabling OpenMP (GNU libgomp) (original) (raw)


To activate the OpenMP extensions for C/C++ and Fortran, the compile-time flag -fopenmp must be specified. For C and C++, this enables the handling of the OpenMP directives using #pragma omp and the[[omp::directive(...)]], [[omp::sequence(...)]] and[[omp::decl(...)]] attributes. For Fortran, it enables for free source form the !$omp sentinel for directives and the!$ conditional compilation sentinel and for fixed source form thec$omp, *$omp and !$omp sentinels for directives and the c$, *$ and !$ conditional compilation sentinels. The flag also arranges for automatic linking of the OpenMP runtime library (OpenMP Runtime Library Routines).

The -fopenmp-simd flag can be used to enable a subset of OpenMP directives that do not require the linking of either the OpenMP runtime library or the POSIX threads library.

A complete description of all OpenMP directives may be found in theOpenMP Application Program Interface manuals. See also OpenMP Implementation Status.