Compiling
Compiler Versions
There is a wide array of compilers and software tools with support for the OpenMP API in C, C++, and Fortran from vendors and the open source community. In Table 1, we provide a subset of available compilers in C, C++, and Fortran with full support for the indicated OpenMP version unless otherwise noted.
OpenMP Version | GNU Compiler Version | Intel Compiler Version |
---|---|---|
4.0 | 4.9.1 | 15.0, 16.0 |
4.5 | 6.1 C/C++ (full support) 7.1 Fortran (partial support) 11.1 Fortran (full support) |
17.0, 18.0, 19.0 |
5.0 | 9.1 C/C++ (partial support) 11.1 Fortran (partial support) |
19.1, 2021.1 (subset available)1 |
1This column refers to versions of Intel Compiler Classic (icc, icpc, ifort). To use the subset of OpenMP 5.0 and 5.1 available in Intel's LLVM-based oneAPI compilers (ifx, icx, icpx, dpcpp), compile with -fiopenmp -fopenmp-targets=spir64
.
This is by no means a comprehensive list of available compilers with OpenMP support, but rather a curated list for comparison to what is available on Frontera. From this table, we can see that Stampede2 Intel and GNU compilers provide support beginning at OpenMP versions 4.0 and above, and Frontera's compilers begin at OpenMP version 4.5 and above. As new compiler versions are released – both Intel and GNU – with more complete support of OpenMP 5.0, one can expect they will be made available on both of these systems as well so users can take advantage of the latest features.
How To Compile
The compiler flag that determines whether the OpenMP directives are interpreted
by the compiler is -fopenmp
for GCC 4.2 and later for Fortran,
C, and C++. The -qopenmp
will work for the Intel icc
(C), icpc
(C++), and ifort
(Fortran) compilers.
For example,
compiling with GNU for a C application with OpenMP would look like:
gcc -fopenmp -c program.c
Whereas the same application compiled with Intel would look like:
icc -qopenmp -c program.c
The Intel compilers have some additional flags related to OpenMP. -qopenmp-stubs
-qopenmp
-qopenmp-stubs
-qopt-report=n -qopt-report-phase=openmp