This article presents an introduction to OpenMP, an API jointly defined by a group of major computer hardware and software vendors. OpenMP provides a portable, scalable model for developers of shared memory parallel applications. The API supports C/C++ and Fortran on multiple architectures, including UNIX and Windows NT. This tutorial covers most of the major features of OpenMP, including its various constructs and directives for specifying parallel regions, work sharing, synchronization and data environment. Provided courtesy Lawrence Livermore National Laboratory.
What is OpenMP?
OpenMP is:
- An Application Program Interface (API) that may be used to explicitly direct multithreaded, shared memory parallelism
- Comprised of three primary API components:
- Compiler Directives
- Runtime Library Routines
- Environment Variables
- Portable:
- The API is specified for C/C++ and Fortran
- Most major platforms have been implemented including Unix/Linux platforms and Windows NT
- Standardized:
- Jointly defined and endorsed by a group of major computer hardware and software vendors
- Expected to become an ANSI standard later???
What does OpenMP stand for?
- Short version: Open Multi-Processing
- Long version: Open specifications for multiprocessing via collaborative work between interested parties from the hardware and software industry, government and academia.
OpenMP is not:
- Meant for distributed memory parallel systems (by itself)
- Necessarily implemented identically by all vendors
- Guaranteed to make the most efficient use of shared memory
- Required to check for data dependencies, data conflicts, race conditions,
or deadlocks
- Required to check for code sequences that cause a program to be classified
as non-conforming
- Meant to cover compiler-generated automatic parallelization and
directives to the compiler to assist such parallelization
- Designed to guarantee that input or output to the same file is synchronous when executed in parallel. The programmer is responsible for synchronizing input and output.
References:
- OpenMP website:
openmp.org
API specifications, FAQ, presentations, discussions, media releases, calendar, membership application and more... - Wikipedia: en.wikipedia.org/wiki/OpenMP
Introduction
History
Ancient History:
- In the early 90's, vendors of shared-memory machines supplied similar,
directive-based, Fortran programming extensions:
- The user would augment a serial Fortran program with directives specifying which loops were to be parallelized
- The compiler would be responsible for automatically parallelizing such loops across the SMP processors
- Implementations were all functionally similar, but were diverging (as usual)
- First attempt at a standard was the draft for ANSI X3H5 in 1994. It was never adopted, largely due to waning interest as distributed memory machines became popular.
Which Led To?
- The OpenMP standard specification started in the spring of 1997, taking over where ANSI X3H5 had left off, as newer shared memory machine architectures started to become prevalent.
- Led by the OpenMP Architecture Review Board (ARB). Original ARB members
included:
(Disclaimer: all partner
names derived from the OpenMP web site)
- Compaq / Digital
- Hewlett-Packard Company
- Intel Corporation
- International Business Machines (IBM)
- Kuck & Associates, Inc. (KAI)
- Silicon Graphics, Inc.
- Sun Microsystems, Inc.
- U.S. Department of Energy ASCI program
- Other contributors included:
- Endorsing application developers:
- ADINA R&D, Inc.
- ANSYS, Inc.
- Dash Associates
- Fluent, Inc.
- ILOG CPLEX Division
- Livermore Software Technology Corporation (LSTC)
- MECALOG SARL
- Oxford Molecular Group PLC
- The Numerical Algorithms Group Ltd.(NAG)
- ADINA R&D, Inc.
- Endorsing software vendors:
- Absoft Corporation
- Edinburgh Portable Compilers
- GENIAS Software GmBH
- Myrias Computer Technologies, Inc.
- The Portland Group, Inc. (PGI)
- For more news and membership information about the OpenMP ARB, visit: openmp.org/wp/about-openmp.
Release History
Goals of OpenMP
Standardization:
- Provide a standard among a variety of shared memory architectures/platforms
Lean and Mean:
- Establish a simple and limited set of directives for programming shared memory machines. Significant parallelism can be implemented by using just 3 or 4 directives.
Ease of Use:
- Provide capability to incrementally parallelize a serial program, unlike message-passing libraries which typically require an all or nothing approach
- Provide the capability to implement both coarse-grain and fine-grain
parallelism
Portability:
- Supports Fortran (77, 90, and 95), C, and C++
- Public forum for API and membership


