OpenMP 5.1 with Vital Usability Enhancements
OpenMP 5.1 with Vital Usability Enhancements
About OpenMP
The mission of the OpenMP Architecture Review Board (ARB) is to standardize directive-based multi-language high-level parallelism that is performant, productive and portable. Jointly defined by a group of major computer hardware and software vendors, and users, the OpenMP API is a portable, scalable model that gives parallel programmers a simple and flexible interface for developing parallel applications for platforms ranging from embedded systems and accelerator devices to multicore systems and shared-memory systems. The OpenMP ARB owns the OpenMP brand, oversees the OpenMP specification and produces and approves new versions of the specification.
OpenMP 5.1 introduction
The OpenMP® Architecture Review Board (ARB) has released Version 5.1 of the OpenMP API. With this release of the standard, OpenMP strengthens its handling of accelerator devices, allows improved optimization and supports the latest versions of C, C++ and Fortran.
OpenMP 5.1 represents the culmination of the past two years of work within the OpenMP Language Committee,” said Bronis R. de Supinski, the LC Chair. “While the primary focus has been enhancements, clarifications and corrections to the 5.0 specification, we have added several useful new features, such as support for interoperability with lower level APIs like CUDA and HIP.
New Features
Version 5.1 of the OpenMP specification was jointly developed by the OpenMP ARB, a group of major computer hardware and software vendors, as well as users throughout the OpenMP community. The updated specification includes the following key additions:
- Improvements in accelerator device interactions:
- The interop construct, which enables interoperability with non-OpenMP device execution contexts, provides support for interactions with native device interfaces (e.g., for CUDA streams, HIP or OpenCL);
- Function pointers can now be mapped to a device or accelerator; and
- Device-specific environment variables have been added.
- Providing more information to the compiler to allow improved optimization:
- The assume directive gives the implementation additional information about the way a program uses OpenMP, which allows additional optimizations to be safely applied by compilers, or safe OpenMP subsets to be implemented; and
- Loop transformation directives have been introduced, starting with the tile directive, which can improve data locality, and the unroll directive, which fully or partially unrolls a loop.
- Filtering of execution by thread
- The masked directive can restrict execution of a code region to a subset of the threads.
- Allowing the user to generate compile-time errors and warnings:
- A new error directive has been added.
- Improvements in modern C++ usage of OpenMP:
- Instead of the traditional pragma form, C++ attribute syntax can be used to specify OpenMP directives, which simplifies their integration with templates; and
- Full support for C11, C18, C++11, C++14, C++17 and C++20: Programs written in these languages can now be parallelized with OpenMP.
- Improvements in the support for Fortran:
- Fortran 2008 is now fully supported and initial support for Fortran 2018 has been added.
- Easier declaration of environment-specific functions:
- Multiple functions can now be included in a single declare variant construct, and code can be more closely tailored to a specific environment.
Implementations
Major vendors and open source compilers have implemented parts of the OpenMP 5 specification in their products. LLVM, GCC, AMD, Intel, HPE, NVIDIA, Mentor Graphics to name just a few. In addition, debugging and performance tools are being extended with OpenMP 5 features.
Demo code
1 | /* |
1 | ./openmp-demo |
1 | C:\>.\openmp-demo |
Reference
- OpenMP Specifications
- OpenMP 5.1 Specification - HTML
- OpenMP 5.1 Specification - PDF
- OpenMP API 5.1 Reference Guide
- GCC Option Summary
- GCC x86 Options
- GNU Offloading and Multi Processing Runtime Library
- https://docs.microsoft.com/en-us/cpp/build/reference/c-cpp-building-reference
- https://docs.microsoft.com/en-us/cpp/parallel/openmp/openmp-in-visual-cpp
- https://docs.microsoft.com/en-us/cpp/parallel/openmp/reference/openmp-directives
- https://docs.microsoft.com/en-us/cpp/parallel/parallel-programming-in-visual-cpp
- https://docs.microsoft.com/en-us/cpp/parallel/amp/cpp-amp-cpp-accelerated-massive-parallelism
- https://docs.microsoft.com/en-us/cpp/parallel/concrt/migrating-from-openmp-to-the-concurrency-runtime
- https://docs.microsoft.com/en-us/cpp/parallel/concrt/concurrency-runtime
- https://docs.microsoft.com/en-us/cpp/parallel/concrt/parallel-patterns-library-ppl