HOME
| OPENMP API Specification: Version 5.0 November 2018

2  Directives

This chapter describes the syntax and behavior of OpenMP directives.

SVG-Viewer needed.

In C/C++, OpenMP directives are specified by using the #pragma mechanism provided by the C and C++ standards.

SVG-Viewer needed.

SVG-Viewer needed.

In Fortran, OpenMP directives are specified by using special comments that are identified by unique sentinels. Also, a special comment form is available for conditional compilation.

SVG-Viewer needed.

Compilers can therefore ignore OpenMP directives and conditionally compiled code if support of the OpenMP API is not provided or enabled. A compliant implementation must provide an option or interface that ensures that underlying support of all OpenMP directives and OpenMP conditional compilation mechanisms is enabled. In the remainder of this document, the phrase OpenMP compilation is used to mean a compilation with these OpenMP features enabled.

SVG-Viewer needed.

 2.1  Directive Format
  2.1.1  Fixed Source Form Directives
  2.1.2  Free Source Form Directives
  2.1.3  Stand-Alone Directives
  2.1.4  Array Shaping
  2.1.5  Array Sections
  2.1.6  Iterators
 2.2  Conditional Compilation
  2.2.1  Fixed Source Form Conditional Compilation Sentinels
  2.2.2  Free Source Form Conditional Compilation Sentinel
 2.3  Variant Directives
  2.3.1  OpenMP Context
  2.3.2  Context Selectors
  2.3.3  Matching and Scoring Context Selectors
  2.3.4  Metadirectives
  2.3.5  declare variant Directive
 2.4  requires Directive
 2.5  Internal Control Variables
  2.5.1  ICV Descriptions
  2.5.2  ICV Initialization
  2.5.3  Modifying and Retrieving ICV Values
  2.5.4  How ICVs are Scoped
  2.5.5  ICV Override Relationships
 2.6  parallel Construct
  2.6.1  Determining the Number of Threads for a parallel Region
  2.6.2  Controlling OpenMP Thread Affinity
 2.7  teams Construct
 2.8  Worksharing Constructs
  2.8.1  sections Construct
  2.8.2  single Construct
  2.8.3  workshare Construct
 2.9  Loop-Related Directives
  2.9.1  Canonical Loop Form
  2.9.2  Worksharing-Loop Construct
  2.9.3  SIMD Directives
  2.9.4  distribute Loop Constructs
  2.9.5  loop Construct
  2.9.6  scan Directive
 2.10  Tasking Constructs
  2.10.1  task Construct
  2.10.2  taskloop Construct
  2.10.3  taskloop simd Construct
  2.10.4  taskyield Construct
  2.10.5  Initial Task
  2.10.6  Task Scheduling
 2.11  Memory Management Directives
  2.11.1  Memory Spaces
  2.11.2  Memory Allocators
  2.11.3  allocate Directive
  2.11.4  allocate Clause
 2.12  Device Directives
  2.12.1  Device Initialization
  2.12.2  target data Construct
  2.12.3  target enter data Construct
  2.12.4  target exit data Construct
  2.12.5  target Construct
  2.12.6  target update Construct
  2.12.7  declare target Directive
 2.13  Combined Constructs
  2.13.1  Parallel Worksharing-Loop Construct
  2.13.2  parallel loop Construct
  2.13.3  parallel sections Construct
  2.13.4  parallel workshare Construct
  2.13.5  Parallel Worksharing-Loop SIMD Construct
  2.13.6  parallel master Construct
  2.13.7  master taskloop Construct
  2.13.8  master taskloop simd Construct
  2.13.9  parallel master taskloop Construct
  2.13.10  parallel master taskloop simd Construct
  2.13.11  teams distribute Construct
  2.13.12  teams distribute simd Construct
  2.13.13  Teams Distribute Parallel Worksharing-Loop Construct
  2.13.14  Teams Distribute Parallel Worksharing-Loop SIMD Construct
  2.13.15  teams loop Construct
  2.13.16  target parallel Construct
  2.13.17  Target Parallel Worksharing-Loop Construct
  2.13.18  Target Parallel Worksharing-Loop SIMD Construct
  2.13.19  targetparallelloop Construct
  2.13.20  target simd Construct
  2.13.21  target teams Construct
  2.13.22  target teams distribute Construct
  2.13.23  target teams distribute simd Construct
  2.13.24  target teams loop Construct
  2.13.25  Target Teams Distribute Parallel Worksharing-Loop Construct
  2.13.26  Target Teams Distribute Parallel Worksharing-Loop SIMD Construct
 2.14  Clauses on Combined and Composite Constructs
 2.15  if Clause
 2.16  master Construct
 2.17  Synchronization Constructs and Clauses
  2.17.1  critical Construct
  2.17.2  barrier Construct
  2.17.3  Implicit Barriers
  2.17.4  Implementation-Specific Barriers
  2.17.5  taskwait Construct
  2.17.6  taskgroup Construct
  2.17.7  atomic Construct
  2.17.8  flush Construct
  2.17.9  ordered Construct
  2.17.10  Depend Objects
  2.17.11  depend Clause
  2.17.12  Synchronization Hints
 2.18  Cancellation Constructs
  2.18.1  cancel Construct
  2.18.2  cancellation point Construct
 2.19  Data Environment
  2.19.1  Data-Sharing Attribute Rules
  2.19.2  threadprivate Directive
  2.19.3  List Item Privatization
  2.19.4  Data-Sharing Attribute Clauses
  2.19.5  Reduction Clauses and Directives
  2.19.6  Data Copying Clauses
  2.19.7  Data-Mapping Attribute Rules, Clauses, and Directives
 2.20  Nesting of Regions

RestrictionsThe following restriction applies to all OpenMP directives:

SVG-Viewer needed.