Channels ▼
RSS

Parallel

Introduction to OpenMP



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:

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)
  • 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


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video