OpenMP
OpenMP is an application programming interface (API) that supports multi-platform shared-memory multiprocessing programming in C, C++, and Fortran, on many platforms, instruction-set architectures and operating systems, including Solaris, AIX, FreeBSD, HP-UX, Linux, macOS, Windows and OpenHarmony. It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior. OpenMP is managed by the nonprofit technology consortium OpenMP Architecture Review Board (or OpenMP ARB), jointly defined by a broad swath of leading computer hardware and software vendors, including Arm, AMD, IBM, Intel, Cray, HP, Fujitsu, Nvidia, NEC, Red Hat, Texas Instruments, and Oracle Corporation. OpenMP uses a portable, scalable model that gives programmers a simple and flexible interface for developing parallel applications for platforms ranging from the standard desktop computer to the supercomputer. An application built with the hybrid model of parallel...
OpenMP is an application programming interface (API) that supports multi-platform shared-memory multiprocessing programming in C, C++, and Fortran, on many platforms, instruction-set architectures and operating systems, including Solaris, AIX, FreeBSD, HP-UX, Linux, macOS, Windows and OpenHarmony. It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior. OpenMP is managed by the nonprofit technology consortium OpenMP Architecture Review Board (or OpenMP ARB), jointly defined by a broad swath of leading computer hardware and software vendors, including Arm, AMD, IBM, Intel, Cray, HP, Fujitsu, Nvidia, NEC, Red Hat, Texas Instruments, and Oracle Corporation. OpenMP uses a portable, scalable model that gives programmers a simple and flexible interface for developing parallel applications for platforms ranging from the standard desktop computer to the supercomputer. An application built with the hybrid model of parallel programming can run on a computer cluster using both OpenMP and Message Passing Interface (MPI), such that OpenMP is used for parallelism within a (multi-core) node while MPI is used for parallelism between nodes. There have also been efforts to run OpenMP on software distributed shared memory systems, to translate OpenMP into MPI and to extend OpenMP for non-shared memory systems. include include int main(void) { #pragma omp parallel printf("Hello, world.\n"); return 0; } Use flag -fopenmp to compile using GCC: $ gcc -fopenmp hello.c -o hello -ldl Output on a computer with two cores, and thus two threads: Hello, world. Hello, world. However, the output may also be garbled because of the race condition caused from the two threads sharing the standard output. Hello, wHello, woorld. rld. Whether printf is atomic depends on the underlying implementation unlike C++11's std::cout , which is thread-safe by default. // define N as some constant for array length define N 100000 int main(int argc, char* argv[]) { int a[N]; #pragma omp parallel for for (int i = 0; i This example is embarrassingly parallel, and depends only on the value of i . The OpenMP parallel for flag tells the OpenMP system to split this task among its working threads. The threads will each receive a unique and private version of the variable. For instance, with two worker threads, one thread might be handed a version of i that runs from 0 to 49999 while the second gets a version running from 50000 to 99999. ===Variant directives=== Variant directives are one of the major features introduced in OpenMP 5.0 specification to facilitate programmers to improve performance portability. They enable adaptation of OpenMP pragmas and user code at compile time. The specification defines traits to describe active OpenMP constructs, execution devices, and functionality provided by an implementation, context selectors based on the traits and user-defined conditions, and metadirective and declare directive directives for users to program the same code region with variant directives. The metadirective is an executable directive that conditionally resolves to another directive at compile time by selecting from multiple directive variants based on traits that define an OpenMP condition or context. The declare variant directive has similar functionality as metadirective but selects a function variant at the call-site based on context or user-defined conditions. The mechanism provided by the two variant directives for selecting variants is more convenient to use than the C/C++ preprocessing since it directly supports variant selection in OpenMP and allows an OpenMP compiler to analyze and determine the final directive from variants and context. // define array size as some constant for array length: define N 100000 // code adaptation using preprocessing directives int v1[N]; int v2[N]; int v3[N]; if defined(nvptx) pragma omp target teams distribute parallel for map(to:v1,v2) map(from:v3) for (int i = 0; i ==Benchmarks== A variety of benchmarks has been developed to demonstrate the use of OpenMP, test its performance and evaluate correctness. Simple examples OmpSCR: OpenMP Source Code Repository Performance benchmarks include: NAS Parallel Benchmark Barcelona OpenMP Task Suite a collection of applications that allow to test OpenMP tasking implementations. SPEC series SPEC OMP 2012 The SPEC ACCEL benchmark suite testing OpenMP 4 target offloading API The SPEChpc 2002 benchmark CORAL benchmarks Exascale Proxy Applications Rodinia focusing on accelerators. Problem Based Benchmark Suite Correctness benchmarks include: OpenMP Validation Suite OpenMP Validation and Verification Testsuite DataRaceBench is a benchmark suite designed to systematically and quantitatively evaluate the effectiveness of OpenMP data race detection tools. AutoParBench is a benchmark suite to evaluate compilers and tools which can automatically insert OpenMP directives.
References
- ^ Cluster OpenMP (a product that used to be available for Intel C++ Compiler versions 9.1 to 11.1 but was dropped in 13.0) Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Ayguade, Eduard; Copty, Nawal; Duran, Alejandro; Hoeflinger, Jay; Lin, Yuan; Massaioli, Federico; Su, Ernesto; Unnikrishnan, Priya; Zhang, Guansong (2007). A proposal for task parallelism in OpenMP (PDF) . Proc. Int'l Workshop on OpenMP. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "OpenMP Application Program Interface, Version 3.0" (PDF) . openmp.org. May 2008 . Retrieved 2014-02-06 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1391641200.0
- ^ LaGrone, James; Aribuki, Ayodunni; Addison, Cody; Chapman, Barbara (2011). A Runtime Implementation of OpenMP Tasks . Proc. Int'l Workshop on OpenMP. pp. 165– 178. doi : 10.1007/978-3-642-21487-5_13 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "OpenMP 4.0 API Released" . OpenMP.org. 2013-07-26. Archived from the original on 2013-11-09 . Retrieved 2013-08-14 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1376434800.0
- ^ "OpenMP Application Program Interface, Version 4.0" (PDF) . openmp.org. July 2013 . Retrieved 2014-02-06 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1391641200.0
- ^ "OpenMP 5.2 Specification" . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "OpenMP ARB Releases OpenMP 6.0 for Easier Programming" . 14 November 2024. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "C - How to use printf() in multiple threads" . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "std::cout, std::wcout - cppreference.com" . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "Tutorial – Parallel for Loops with OpenMP" . 2009-07-14. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Visual C++ Editions, Visual Studio 2005 Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Visual C++ Editions, Visual Studio 2008 Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Visual C++ Editions, Visual Studio 2010 Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ David Worthington, "Intel addresses development life cycle with Parallel Studio" Archived 2012-02-15 at the Wayback Machine , SDTimes, 26 May 2009 (accessed 28 May 2009) Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "XL C/C++ for Linux Features" , (accessed 9 June 2009) Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "Oracle Technology Network for Java Developers | Oracle Technology Network | Oracle" . Developers.sun.com . Retrieved 2013-08-14 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1376434800.0
- ^ Kennedy, Patrick (2011-09-06). "Intel® C++ and Fortran Compilers now support the OpenMP* 3.1 Specification | Intel® Developer Zone" . Software.intel.com . Retrieved 2013-08-14 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1376434800.0
- ^ "GCC 4.9 Release Series – Changes" . www.gnu.org. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "OpenMP* 4.0 Features in Intel Compiler 15.0" . Software.intel.com. 2014-08-13. Archived from the original on 2018-11-16 . Retrieved 2014-11-10 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1415574000.0
- ^ "GCC 6 Release Series - Changes" . www.gnu.org. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "GOMP — An OpenMP implementation for GCC - GNU Project - Free Software Foundation (FSF)" . gcc.gnu.org . Archived from the original on 2021-02-27 . Retrieved 2020-10-23 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1603407600.0
- ^ "OpenMP* Support" . Intel . Retrieved 2020-10-23 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1603407600.0
- ^ OpenMP Tutorial at Supercomputing 2008 Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Amritkar, Amit; Deb, Surya; Tafti, Danesh (2014). "Efficient parallel CFD-DEM simulations using OpenMP" . Journal of Computational Physics . 256 : 501. Bibcode : 2014JCoPh.256..501A . doi : 10.1016/j.jcp.2013.09.007 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ OpenMP Accelerator Support for GPUs Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Detecting and Avoiding OpenMP Race Conditions in C++ Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "Alexey Kolosov, Evgeniy Ryzhkov, Andrey Karpov 32 OpenMP traps for C++ developers" . Archived from the original on 2017-07-07 . Retrieved 2009-04-15 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1239750000.0
- ^ Stephen Blair-Chappell, Intel Corporation, Becoming a Parallel Programming Expert in Nine Minutes, presentation on ACCU 2010 conference Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Chen, Yurong (2007-11-15). "Multi-Core Software". Intel Technology Journal . 11 (4). doi : 10.1535/itj.1104.08 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "OMPM2001 Result" . SPEC. 2008-01-28. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "OMPM2001 Result" . SPEC. 2003-04-01. Archived from the original on 2021-02-25 . Retrieved 2008-03-28 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1206658800.0
- ^ Using OpenMP – Portable Shared Memory Parallel Programming – Download Book Examples and Discuss Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "OpenAtom OpenHarmony" . docs.openharmony.cn . Retrieved 2025-03-02 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1740870000.0
- ^ Costa, J.J.; et al. (May 2006). "Running OpenMP applications efficiently on an everything-shared SDSM". Journal of Parallel and Distributed Computing . 66 (5): 647– 658. doi : 10.1016/j.jpdc.2005.06.018 . hdl : 2117/370260 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Basumallik, Ayon; Min, Seung-Jai; Eigenmann, Rudolf (2007). "Programming Distributed Memory Systems Using OpenMP". 2007 IEEE International Parallel and Distributed Processing Symposium . New York: IEEE Press. pp. 1– 8. doi : 10.1109/IPDPS.2007.370397 . ISBN 978-1-4244-0909-9 . S2CID 14237507 . A preprint is available on Chen Ding's home page ; see especially Section 3 on Translation of OpenMP to MPI. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ Wang, Jue; Hu, ChangJun; Zhang, JiLin; Li, JianJiang (May 2010). "OpenMP compiler for distributed memory architectures" . Science China Information Sciences . 53 (5): 932– 944. doi : 10.1007/s11432-010-0074-0 . (As of 2016 [update] the KLCoMP software described in this paper does not appear to be publicly available) Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ a b "OpenMP Support — Clang 12 documentation" . clang.llvm.org . Retrieved 2020-10-23 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1603407600.0
- ^ "Absoft Home Page" . Archived from the original on 2022-12-01 . Retrieved 2019-02-12 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1549926000.0
- ^ a b c "About the OpenMP ARB and" . OpenMP.org. 2013-07-11. Archived from the original on 2013-08-09 . Retrieved 2013-08-14 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1376434800.0
- ^ a b "Clang 3.7 Release Notes" . llvm.org . Retrieved 2015-10-10 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1444431600.0
- ^ a b Silberschatz, Abraham; Galvin, Peter Baer; Gagne, Greg (2012-12-17). Operating system concepts (9th ed.). Hoboken, N.J.: Wiley. pp. 181– 182. ISBN 978-1-118-06333-0 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ "OpenMP Compilers & Tools" . openmp.org . www.openmp.org . Retrieved 29 October 2019 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ a b Amritkar, Amit; Tafti, Danesh; Liu, Rui; Kufrin, Rick; Chapman, Barbara (2012). "OpenMP parallelism for fluid and fluid-particulate systems". Parallel Computing . 38 (9): 501. doi : 10.1016/j.parco.2012.05.005 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ a b "IBM XL C/C++ compilers features" . IBM . 13 December 2018. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- ^ a b "OpenMP Compilers & Tools" . OpenMP.org. November 2019 . Retrieved 2020-03-05 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1583362800.0
- ^ a b "openmp – GCC Wiki" . Gcc.gnu.org. 2013-07-30 . Retrieved 2013-08-14 . Wikipedia revision 1369227206, retrieved 2026-11-21 · 1376434800.0
- ^ a b "IBM XL Fortran compilers features" . 13 December 2018. Wikipedia revision 1369227206, retrieved 2026-11-21 · 1795215600.0
- About the OpenMP ARB and . OpenMP.org . 2013-07-11. retrieved 2013-08-14 · 1376434800.0
- OpenMP 4.0 API Released . OpenMP.org . 2013-07-26. retrieved 2013-08-14 · 1376434800.0
- OpenMP Application Program Interface, Version 4.0 . openmp.org . July 2013. retrieved 2014-02-06 · 1391641200.0
- OpenMP 5.2 Specification . · 1786575600.0
- OpenMP ARB Releases OpenMP 6.0 for Easier Programming . 14 November 2024. · 1786575600.0
- C - How to use printf() in multiple threads . · 1786575600.0
- std::cout, std::wcout - cppreference.com . · 1786575600.0
- Tutorial – Parallel for Loops with OpenMP . 2009-07-14. · 1786575600.0
- [http://msdn2.microsoft.com/en-us/library/hs24szh9(vs.80).aspx Visual C++ Editions, Visual Studio 2005] . · 1786575600.0
- [http://msdn2.microsoft.com/en-us/library/hs24szh9(vs.90).aspx Visual C++ Editions, Visual Studio 2008] . · 1786575600.0
- [http://msdn2.microsoft.com/en-us/library/hs24szh9(vs.100).aspx Visual C++ Editions, Visual Studio 2010] . · 1786575600.0
- openmp.org . · 1786575600.0
Cite this
"OpenMP". 1786634500. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1369227206 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy