OpenMP®: Support for the OpenMP language
The OpenMP subproject of LLVM contains the components required to build an executable OpenMP program that are outside the compiler itself.
Here you can find :-
- the code for the runtime library against which code compiled by clang -fopenmp must be linked before it can run.
- the library that supports offload to target devices (in "libomptarget")
Support for the parts of the OpenMP 4.0 (and later) language that are not associated with the "target" constructs are contained in the "runtime" directory. Support for offloading computation via the "target" directive is in the separate "libomptarget" directory.
All of the code here is dual licensed under the MIT license and the UIUC License (a BSD-like license). The LICENSE.txt file at the top of the OpenMP project contains the license text and associated patent grants.
With the release of Clang 3.8.0, OpenMP 3.1 support is enabled in Clang by default, and the OpenMP runtime is therefore built as a normal part of the Clang build, and distributed with the binary distributions.You do not, therefore, need explicitly to check out this code, or build it out of tree; a normal Clang check out and build will automatically include building these runtime libraries.
Features and Goals
- Support for the OpenMP 3.1 standard (PDF) has been achieved in the Clang 3.8.0 release.
- Support for the OpenMP 4.0 standard (PDF) and OpenMP 4.5 standard (PDF) is now being implemented. (Some OpenMP 4.0 and 4.5 features are already available).
- High performance.
- ABI compatibility with Gcc and Intel's existing OpenMP compilers. We currently have binary compatibility with OpenMP 3.1 code compiled by gcc 4.9, however we do not have support for OpenMP 4.0 code that uses task cancellation when compiled by gcc 4.9. How we will support such code remains a research issue.
Why have the runtime code here?
It makes sense to have the runtime sources in the same place (and with the same license) as the compiler.
The runtime can be built with gcc, icc or clang. However, note that a runtime built with clang cannot be guaranteed to work with OpenMP code compiled by the other compilers, since clang does not support a 128-bit float type, and cannot therefore generate the code used for reductions of that type (which may occur in user code compiled by the other compilers).
The OpenMP runtime is known to work on
- ARM® architecture processors
- PowerPC™ processors
- 32 and 64 bit X86 processors when compiled with clang, with the Intel compiler or with gcc, and also the Intel® Xeon Phi™ product family, when compiled with the Intel compiler.
- MIPS and MIPS64
- RISC-V 64-bit
A full OS and architecture compatibility matrix is in README.txt
Get it and get involved!
First please review our Developer's Policy.
To check out the code, use:
git clone https://github.com/llvm/llvm-project.git
mkdir build && cd build
cmake ../llvm -DLLVM_ENABLE_PROJECTS=openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
mkdir build-openmp && cd build-openmp
cmake ../openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
Full details of how to build are in the README.txt and README.rst in the source code repository.
Send discussions to the (OpenMP mailing list).
- The OpenMP name and the OpenMP logo are registered trademarks of the OpenMP Architecture Review Board.
- Intel is a trademark of Intel Corporation in the U.S. and/or other countries.
- PowerPC is a trademark of IBM Corporation in the U.S. and/or other countries.
- ARM is a trademark of ARM Corporation in the U.S. and/or other countries.
- MIPS is a trademark of MIPS Computer Systems in the U.S. and/or other countries.