HOME
| OPENMP API Specification: Version 5.0 November 2018

PIC

OpenMP
Application Programming
Interface

Version 5.0 - November 2018


This HTML version of the specification is a translation from the official PDF specification. If the translation process has introduced any differences, the official PDF version takes precedent.


Copyright 1997-2018 OpenMP Architecture Review Board.
Permission to copy without fee all or part of this material is granted, provided the OpenMP Architecture Review Board copyright notice and the title of this document appear. Notice is given that copying is by permission of the OpenMP Architecture Review Board.

____________________________________________________________________

Contents
List of Figures
List of Tables
1  Introduction
 1.1  Scope
 1.2  Glossary
  1.2.1  Threading Concepts
  1.2.2  OpenMP Language Terminology
  1.2.3  Loop Terminology
  1.2.4  Synchronization Terminology
  1.2.5  Tasking Terminology
  1.2.6  Data Terminology
  1.2.7  Implementation Terminology
  1.2.8  Tool Terminology
 1.3  Execution Model
 1.4  Memory Model
  1.4.1  Structure of the OpenMP Memory Model
  1.4.2  Device Data Environments
  1.4.3  Memory Management
  1.4.4  The Flush Operation
  1.4.5  Flush Synchronization and Happens Before
  1.4.6  OpenMP Memory Consistency
 1.5  Tool Interfaces
  1.5.1  OMPT
  1.5.2  OMPD
 1.6  OpenMP Compliance
 1.7  Normative References
 1.8  Organization of this Document
2  Directives
 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
3  Runtime Library Routines
 3.1  Runtime Library Definitions
 3.2  Execution Environment Routines
  3.2.1  omp_set_num_threads
  3.2.2  omp_get_num_threads
  3.2.3  omp_get_max_threads
  3.2.4  omp_get_thread_num
  3.2.5  omp_get_num_procs
  3.2.6  omp_in_parallel
  3.2.7  omp_set_dynamic
  3.2.8  omp_get_dynamic
  3.2.9  omp_get_cancellation
  3.2.10  omp_set_nested
  3.2.11  omp_get_nested
  3.2.12  omp_set_schedule
  3.2.13  omp_get_schedule
  3.2.14  omp_get_thread_limit
  3.2.15  omp_get_supported_active_levels
  3.2.16  omp_set_max_active_levels
  3.2.17  omp_get_max_active_levels
  3.2.18  omp_get_level
  3.2.19  omp_get_ancestor_thread_num
  3.2.20  omp_get_team_size
  3.2.21  omp_get_active_level
  3.2.22  omp_in_final
  3.2.23  omp_get_proc_bind
  3.2.24  omp_get_num_places
  3.2.25  omp_get_place_num_procs
  3.2.26  omp_get_place_proc_ids
  3.2.27  omp_get_place_num
  3.2.28  omp_get_partition_num_places
  3.2.29  omp_get_partition_place_nums
  3.2.30  omp_set_affinity_format
  3.2.31  omp_get_affinity_format
  3.2.32  omp_display_affinity
  3.2.33  omp_capture_affinity
  3.2.34  omp_set_default_device
  3.2.35  omp_get_default_device
  3.2.36  omp_get_num_devices
  3.2.37  omp_get_device_num
  3.2.38  omp_get_num_teams
  3.2.39  omp_get_team_num
  3.2.40  omp_is_initial_device
  3.2.41  omp_get_initial_device
  3.2.42  omp_get_max_task_priority
  3.2.43  omp_pause_resource
  3.2.44  omp_pause_resource_all
 3.3  Lock Routines
  3.3.1  omp_init_lock and omp_init_nest_lock
  3.3.2  omp_init_lock_with_hint and
omp_init_nest_lock_with_hint

  3.3.3  omp_destroy_lock and omp_destroy_nest_lock
  3.3.4  omp_set_lock and omp_set_nest_lock
  3.3.5  omp_unset_lock and omp_unset_nest_lock
  3.3.6  omp_test_lock and omp_test_nest_lock
 3.4  Timing Routines
  3.4.1  omp_get_wtime
  3.4.2  omp_get_wtick
 3.5  Event Routine
  3.5.1  omp_fulfill_event
 3.6  Device Memory Routines
  3.6.1  omp_target_alloc
  3.6.2  omp_target_free
  3.6.3  omp_target_is_present
  3.6.4  omp_target_memcpy
  3.6.5  omp_target_memcpy_rect
  3.6.6  omp_target_associate_ptr
  3.6.7  omp_target_disassociate_ptr
 3.7  Memory Management Routines
  3.7.1  Memory Management Types
  3.7.2  omp_init_allocator
  3.7.3  omp_destroy_allocator
  3.7.4  omp_set_default_allocator
  3.7.5  omp_get_default_allocator
  3.7.6  omp_alloc
  3.7.7  omp_free
 3.8  Tool Control Routine
4  OMPT Interface
 4.1  OMPT Interfaces Definitions
 4.2  Activating a First-Party Tool
  4.2.1  ompt_start_tool
  4.2.2  Determining Whether a First-Party Tool Should be Initialized
  4.2.3  Initializing a First-Party Tool
  4.2.4  Monitoring Activity on the Host with OMPT
  4.2.5  Tracing Activity on Target Devices with OMPT
 4.3  Finalizing a First-Party Tool
 4.4  OMPT Data Types
  4.4.1  Tool Initialization and Finalization
  4.4.2  Callbacks
  4.4.3  Tracing
  4.4.4  Miscellaneous Type Definitions
 4.5  OMPT Tool Callback Signatures and Trace Records
  4.5.1  Initialization and Finalization Callback Signature
  4.5.2  Event Callback Signatures and Trace Records
 4.6  OMPT Runtime Entry Points for Tools
  4.6.1  Entry Points in the OMPT Callback Interface
  4.6.2  Entry Points in the OMPT Device Tracing Interface
  4.6.3  Lookup Entry Points: ompt_function_lookup_t
5  OMPD Interface
 5.1  OMPD Interfaces Definitions
 5.2  Activating an OMPD Tool
  5.2.1  Enabling the Runtime for OMPD
  5.2.2  ompd_dll_locations
  5.2.3  ompd_dll_locations_valid
 5.3  OMPD Data Types
  5.3.1  Size Type
  5.3.2  Wait ID Type
  5.3.3  Basic Value Types
  5.3.4  Address Type
  5.3.5  Frame Information Type
  5.3.6  System Device Identifiers
  5.3.7  Native Thread Identifiers
  5.3.8  OMPD Handle Types
  5.3.9  OMPD Scope Types
  5.3.10  ICV ID Type
  5.3.11  Tool Context Types
  5.3.12  Return Code Types
  5.3.13  Primitive Type Sizes
 5.4  OMPD Tool Callback Interface
  5.4.1  Memory Management of OMPD Library
  5.4.2  Context Management and Navigation
  5.4.3  Accessing Memory in the OpenMP Program or Runtime
  5.4.4  Data Format Conversion: ompd_callback_device_host_fn_t
  5.4.5  Output: ompd_callback_print_string_fn_t
  5.4.6  The Callback Interface
 5.5  OMPD Tool Interface Routines
  5.5.1  Per OMPD Library Initialization and Finalization
  5.5.2  Per OpenMP Process Initialization and Finalization
  5.5.3  Thread and Signal Safety
  5.5.4  Address Space Information
  5.5.5  Thread Handles
  5.5.6  Parallel Region Handles
  5.5.7  Task Handles
  5.5.8  Display Control Variables
  5.5.9  Accessing Scope-Specific Information
 5.6  Runtime Entry Points for OMPD
  5.6.1  Beginning Parallel Regions
  5.6.2  Ending Parallel Regions
  5.6.3  Beginning Task Regions
  5.6.4  Ending Task Regions
  5.6.5  Beginning OpenMP Threads
  5.6.6  Ending OpenMP Threads
  5.6.7  Initializing OpenMP Devices
  5.6.8  Finalizing OpenMP Devices
6  Environment Variables
 6.1  OMP_SCHEDULE
 6.2  OMP_NUM_THREADS
 6.3  OMP_DYNAMIC
 6.4  OMP_PROC_BIND
 6.5  OMP_PLACES
 6.6  OMP_STACKSIZE
 6.7  OMP_WAIT_POLICY
 6.8  OMP_MAX_ACTIVE_LEVELS
 6.9  OMP_NESTED
 6.10  OMP_THREAD_LIMIT
 6.11  OMP_CANCELLATION
 6.12  OMP_DISPLAY_ENV
 6.13  OMP_DISPLAY_AFFINITY
 6.14  OMP_AFFINITY_FORMAT
 6.15  OMP_DEFAULT_DEVICE
 6.16  OMP_MAX_TASK_PRIORITY
 6.17  OMP_TARGET_OFFLOAD
 6.18  OMP_TOOL
 6.19  OMP_TOOL_LIBRARIES
 6.20  OMP_DEBUG
 6.21  OMP_ALLOCATOR
A  OpenMP Implementation-Defined Behaviors
B  Features History
 B.1  Deprecated Features
 B.2  Version 4.5 to 5.0 Differences
 B.3  Version 4.0 to 4.5 Differences
 B.4  Version 3.1 to 4.0 Differences
 B.5  Version 3.0 to 3.1 Differences
 B.6  Version 2.5 to 3.0 Differences

____________________________________________________________________

____________________________________________________________________

[next]