OpenMP Constructs

Christopher Cameron, Steve Lantz, Peter Vaillancourt, CAC Staff (original)
Cornell Center for Advanced Computing

Revisions: 6/2022, 3/2021, 2/2017 (original)

Parallel sections of an OpenMP program — called parallel constructs — are defined by directives in the code. A parallel construct can be combined with worksharing constructs to control how the work is performed by the parallel workers. This topic describes the parallel construct and the main worksharing constructs. The examples are in Fortran and C, and have been tested on Stampede2.

Objectives

After you complete this segment, you should be able to:

  • List the components of an OpenMP construct
  • Name the three control variables that an OpenMP runtime maintains and how to access them
  • List the available clauses for the OpenMP parallel construct and how to use them
  • Demonstrate using loop constructs in C, C++, or Fortran
  • List the kind values of a loop construct schedule clause
  • Explain the function of an OpenMP sections directive
  • Name restrictions on what can appear in a workshare region
Prerequisites
  • A working knowledge of general programming concepts
  • A working knowledge of Linux; otherwise, try working through the Linux topic first
  • Ability to program in a high-level language such as Fortran or C
  • A basic familiarity with parallel programming concepts
 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement