Getting Started: Openmp 5.2 Api Syntax Reference Guide
Getting Started: Openmp 5.2 Api Syntax Reference Guide
2 www.openmp.org Page 1
Getting Started
Navigating this reference guide OpenMP directive syntax
Directives and Constructs ....... 1 Environment Variables ...... 14 A directive is a combination of the base-language
Clauses ................................... 9 ICV values .......................... 15 Examples:
Runtime Library Routines ..... 10 Using OpenMP Tools ......... 16 mechanism and a directive-specification (the directive- C/C++ #pragma omp directive-specification
name followed by optional clauses). A construct consists
of a directive and, often, additional base language code. C++ [[omp :: directive( directive-specification )]]
OpenMP Examples Document C++ [[using omp : directive( directive-specification )]]
C/C++ C directives are formed exclusively with pragmas.
An Examples Document and a link to a GitHub repository C++ directives are formed from either pragmas or attributes. For !$omp directive-specification
with code samples is at link.openmp.org/examples51. For !$omp directive-specification
Fortran Fortran directives are formed with comments in
!$omp end directive-name
free form and fixed form sources (codes).
Fortran C/C++
worksharing-loop, worksharing-loop SIMD, or simd directive. #pragma omp allocate (list) [clause[ [, ]clause] ... ]
having its own copy. Each copy of a threadprivate variable
is initialized once prior to the first reference to that copy. {
structured-block-sequence !$omp allocate (list) [clause[ [,]clause] ... ]
C/C++
Declares a reduction-identifier that can be used in a type var) [clause[ [,] clause] ... ] !$omp allocators [clause[ [, ]clause] ... ]
Fortran
map-type : ] list) 9
(reduction-identifier : type-list : combiner)
map-type: alloc, from, to, tofrom
Variant directives
[initializer-clause]
combiner: map-modifier: always, close, present, mapper(default), [begin ]metadirective [7.4.3, 7.4.4] [2.3.4]
C/C++ An expression iterator(iterator-definitions) A directive that can specify multiple directive variants,
one of which may be conditionally selected to replace the
For An assignment statement or a subroutine mapper-identifier: metadirective based on the enclosing OpenMP context.
name followed by an argument list. A base-language identifier or default 9
#pragma omp metadirective [clause[ [,] clause] ... ]
initializer-clause: initializer (initializer-expr) type: A valid type in scope - or -
C/C++
initializer-expr: omp_priv = initializer or var: A valid base-language identifier #pragma omp begin metadirective [clause[ [,] clause] ... ]
function-name (argument-list) stmt(s)
reduction-identifier: Memory management directives #pragma omp end metadirective
C/C++ A base language identifier (for C), or an !$omp metadirective [clause[ [,] clause] ... ]
id-expression (for C++), or one of the following Memory spaces [6.1] [2.13.1] - or -
Fortran
Fortran C/C++
[#pragma omp declare variant(variant-func-id) \ #pragma omp requires clause [ [ [,] clause] ... ]
C/C++
clause [[ [,] clause] ... ] [#pragma omp declare simd [clause[ [, clause] ... ] ]
[ ... ]] [... ]
C/C++
function definition or declaration function definition or declaration !$omp requires clause [ [ [,] clause] ... ]
- or -
Fortran
!$omp declare simd [(proc-name)] [clause[ [,]clause] ... ] clause:
#pragma omp begin declare variant clause-match atomic_default_mem_order (seq_cst | acq_rel | relaxed)
declaration-definition-seq
#pragma omp end declare variant clause: dynamic_allocators
aligned (argument-list[ : alignment]) Enables memory allocators to be used in a target
Fortran
!$omp declare variant ([base-proc-name : ] & Declares one or more list items to be aligned to region without specifying the uses_allocators
variant-proc-name) clause [[ [,] clause] ... ] the specified number of bytes. clause on the corresponding target construct.
(See target on page 5 of this guide.)
clause: alignment: Optional constant positive integer
adjust_args (adjust-op : argument-list) expression reverse_offload
adjust-op: nothing, need_device_ptr inbranch Requires an implementation to guarantee that
linear (linear-list[ : linear-step]) 9 if a target construct specifies a device clause in
append_args (append-op[[, append-op ]... ]) which the ancestor modifier appears, the target
append-op: interop ( notinbranch
region can execute on the parent device of an
interop-type[ [ , interop-type ]... ]) simdlen (length)
enclosing target region. (See target on page 5.)
enter Specifies the preferred number of iterations to
be executed concurrently. unified_address
link Requires that all devices accessible through
match (context-selector-specification) uniform (argument-list)
OpenMP API routines and directives use a
REQUIRED. Specifies how to adjust the Declares arguments to have an invariant value unified address space.
arguments of the base function when a specified for all concurrent invocations of the function in
the execution of a single SIMD loop. unified_shared_memory
variant function is selected for replacement.
Guarantees that in addition to the requirement
C/C++ variant-func-id of unified_address, storage locations in memory
The name of a function variant that is a base [begin ]declare target [7.8.1-2] [2.14.7] are accessible to threads on all available devices.
language identifier, or for C++, a template-id. A declarative directive that specifies that variables,
functions, and subroutines are mapped to a device.
For variant-proc-name assume, [begin ]assumes [8.3.2-4] [2.5.2]
#pragma omp declare target (extended-list) Provides invariants to the implementation that may be
The name of a function variant that is a base
language identifier. - or - used for optimization purposes.
#pragma omp declare target clause[ [,]clause ... ]
clause-match: #pragma omp assumes clause [ [ [,] clause] ... ]
C/C++
- or -
match (context-selector-specification) - or -
REQUIRED match clause #pragma omp begin declare target \
[clause[[,]clause] ... ] #pragma omp begin assumes clause [ [ [,] clause] ... ]
declaration-definition-seq
C/C++
declarations-definition-seq
dispatch [7.6] [2.3.6] #pragma omp end declare target #pragma omp end assumes
Controls whether variant substitution occurs for a function !$omp declare target (extended-list) - or -
Fortran
call in the structured block. - or - #pragma omp assume clause [ [ [,] clause] ... ]
structured-block
#pragma omp dispatch [clause [ [,] clause] ... ] !$omp declare target [clause[ [,]clause] ...]
C/C++
clause: procedure names, and named common blocks. !$omp end assume
depend ([depend-modifier, ] dependence-type : locator-list) indirect[(invoked-by-fptr)] - or -
9 Determines if the procedures in an enter clause !$omp assume clause [ [ [,] clause] ... ]
device (omp-integer-expression) 9 may be invoked indirectly. strictly-structured-block
Identifies the target device that is associated link (list) [ !$omp end assume]
with a device construct.
Supports compilation of functions called in a clause:
is_device_ptr (list) target region that refer to the list items. absent (directive-name [ [, directive-name] ... ])
list: device pointers Lists directives absent in the scope.
nocontext (omp-logical-expression) • For the second C/C++ form of declare target, at least
one clause must be enter or link. contains (directive-name [ [, directive-name] ... ])
If omp-logical-expression evaluates to true, the Lists directives likely to be in the scope.
construct is not added to the construct set of • For begin declare target, the enter and link clauses
the OpenMP context. holds (omp-logical-expression)
are not permitted.
An expression guaranteed to be true in the
novariants (omp-logical-expression)
scope.
If omp-logical-expression evaluates to true, no
function variant is selected for the call in the no_openmp
applicable dispatch region. Indicates that no OpenMP code is in the scope.
nowait 9 no_openmp_routines
Indicates that no OpenMP runtime library calls
are executed in the scope.
no_parallelism
Indicates that no OpenMP tasks or SIMD
constructs will be executed in the scope.
4
Continued
#pragma omp nothing #pragma omp teams [clause[ [,]clause] ... ] by only one of the threads in the team.
C/C++
structured-block
#pragma omp single [clause[ [,]clause] ... ]
C/C++
!$omp nothing !$omp teams [clause[ [,]clause] ... ] structured-block
loosely-structured-block
!$omp end teams !$omp single [clause[ [,]clause] ... ]
Fortran
error [8.5] [2.5.4] - or -
loosely-structured-block
Instructs the compiler or runtime to display a message and !$omp end single [end-clause[ [,]end-clause] ...]
Fortran
!$omp teams [clause[ [,]clause] ...] - or -
to perform an error action. strictly-structured-block
[!$omp end teams] !$omp single [clause[ [,]clause] ...]
Fortran C/C++
Fortran
clause: sizes (size-list) aligned (list[ : alignment]) - or -
Declares one or more list items to be aligned to !$omp workshare [clause]
unroll [9.2] [2.11.9.2] the specified number of bytes. strictly structured-block
Fully or partially unrolls a loop. [!$omp end workshare [clause]]
alignment: Optional constant positive integer
#pragma omp unroll [clause] clause:
Fortran C/C++
expression
loop-nest nowait 9
collapse (n) 9
!$omp unroll [clause] if ([simd : ] omp-logical-expression) 9
loop-nest lastprivate ([lastprivate-modifier : ] list) 9 scope [11.2] [2.9]
[!$omp end unroll] linear (list[ : linear-step]) 9 Defines a structured block that is executed by all threads
clause: nontemporal (list) in a team but where additional OpenMP operations can
full Accesses to the storage locations in list have low be specified.
partial [(unroll-factor)] temporal locality across the iterations in which #pragma omp scope [clause[ [,]clause] ... ]
C/C++
simdlen (length)
- or - nowait 9
Specifies the preferred number of iterations to private (list) 9
!$omp parallel [clause[ [,]clause] ...] be executed concurrently.
strictly-structured-block reduction 9
[ !$omp end parallel]
clause: masked [10.5] [2.8]
allocate 9 Specifies a structured block that is executed by a subset
copyin (list) of the threads of the current team.
default (data-sharing-attribute) 9 #pragma omp masked [ clause ]
C/C++
Fortran C/C++
executed by the threads in a team. #pragma omp taskloop [clause[ [,]clause] ... ]
loop-nest
Fortran C/C++
#pragma omp sections [clause[ [,] clause] ... ] loop-nest
!$omp distribute [clause[ [,]clause] ... ]
{ loop-nest !$omp taskloop [clause[ [,]clause] ... ]
[#pragma omp section] [!$omp end distribute] loop-nest
structured-block-sequence
C/C++
static: Iterations are divided into chunks of size strictly-structured-block #pragma omp taskyield
chunk_size and assigned to team threads in [!$omp end task]
round-robin fashion in order of thread number. clause: !$omp taskyield
dynamic: Each thread executes a chunk of affinity ([aff-modifier : ] locator-list)
iterations then requests another chunk until aff-modifier: iterator(iterators-definition)
none remain.
guided: Same as dynamic, except chunk size is
allocate 9 Device directives and construct
default (data-sharing-attribute) 9 target data [13.5] [2.14.2]
different for each chunk, with each successive detach (event-handle)
chunk smaller than the last. Maps variables to a device data environment for the
Task does not complete until given event is extent of the region.
auto: Compiler and/or runtime decides. fulfilled. (Also see omp_fulfilled_event)
runtime: Uses run-sched-var ICV. #pragma omp target data clause[ [ [,]clause] ... ]
C/C++
event-handle: structured-block
Values for schedule modifier: C/C++ type omp_event_handle_t
For kind omp_event_handle_kind $omp target data clause [ [ [,] clause] ... ]
monotonic: Each thread executes its assigned loosely-structured-block
chunks in increasing logical iteration order. A if ([ task : ] omp-logical-expression) 9 !$omp end target data
Fortran
#pragma omp target enter data [clause[ [,]clause] ... ] according to the specified motion clauses. the team encounter the barrier.
Fortran C/C++
Fortran C/C++
#pragma omp target update clause[ [ [,]clause] ... ] #pragma omp barrier
!$omp target enter data [clause[ [,]clause] ... ]
C/C++
motion-modifier: present, mapper (mapper- structured-block
target exit data [13.7] [2.14.4] identifier), iterator (iterators-definition) !$omp taskgroup [clause[ [, ]clause] ... ]
Unmaps variables from a device data environment. loosely-structured-block
if ([ target update : ] omp-logical-expression) 9
!$omp end taskgroup
Fortran C/C++
#pragma omp target exit data [clause[ [,]clause] ... ] to ([motion-modifier[, ] [motion-modifier[, ] ... ] : ]
Fortran
locator-list) - or -
motion-modifier: present, mapper (mapper- !$omp taskgroup [clause[ [, ]clause] ... ]
!$omp target exit data [clause[ [,]clause] ... ] identifier), iterator (iterators-definition) strictly-structured-block
clause: Any clause used for target enter data. See [!$omp end taskgroup]
exception for the map clause. clause:
Interoperability construct allocate 9
target [13.8] [2.14.5] interop [14.1] [2.15.1] task_reduction (reduction-identifier : list)
Map variables to a device data environment and execute Retrieves interoperability properties from the OpenMP reduction-identifier: See reduction 9
the construct on that device. implementation to enable interoperability with foreign
execution contexts. taskwait [15.5] [2.19.5]
#pragma omp target [clause[ [,]clause] ... ]
C/C++
Fortran C/C++
!$omp interop clause [ [ [,] clause] ... ] #pragma omp taskwait [clause[ [,] clause] ... ]
!$omp end target
Fortran
- or -
clause: !$omp taskwait [clause[ [,] clause] ... ]
!$omp target [clause[ [,]clause] ... ] device(omp-integer-expression) 9
strictly-structured-block depend ([depend-modifier, ] dependence-type : locator-list)
[!$omp end target] clause:
9
clause: depend ([depend-modifier, ] dependence-type : locator-list)
destroy(interop-var) 9
allocate 9 init([ interop-modifier,] [interop-type,] nowait 9
allocator: interop-type: interop-var)
C/C++ Identifier of type omp_allocator_handle_t interop-modifier: prefer_type(preference-list)
For Integer expression of interop-type: target, targetsync flush [15.8.5] [2.19.8]
omp_allocator_handle_kind kind There can be at most only two interop-type. Makes a thread’s temporary view of memory consistent
with memory, and enforces an order on the memory
defaultmap (implicit-behavior[: variable-category]) nowait 9 operations of the variables.
implicit-behavior: alloc, default, firstprivate, use(interop-var)
Fortran C/C++
from, none, present, to, tofrom #pragma omp flush [memory-order-clause] [(list)]
variable-category: aggregate, all, pointer, scalar, Synchronization constructs
For allocatable
critical [15.2] [2.19.1] !$omp flush [memory-order-clause] [(list)]
depend ([depend-modifier, ] dependence-type : locator-list)
9 Restricts execution of the associated structured block to a
single thread at a time. memory-order-clause:
device([device-modifier: ] omp-integer-expression) 9 seq_cst, acq_rel, release, acquire, relaxed
device-modifier: ancestor, device_num #pragma omp critical [(name) [[,] hint (hint-expression)]]
C/C++
Fortran C/C++
target device. May include array sections. - or - #pragma omp depobj (depend-object) clause
if ([ target : ] omp-logical-expression) 9 !$omp critical [(name) [ [,] hint (hint-expression)] ]
in_reduction (reduction-identifier : list) 9 strictly-structured-block !$omp depobj (depend-object) clause
is_device_ptr(list) [ !$omp end critical [(name)] ]
Indicates list items are device pointers. hint-expression: clause:
map ([ [map-modifier, [map-modifier, ... ] ] omp_sync_hint_uncontended depend (dependence-type : locator) 9
map-type : ] list) 9 omp_sync_hint_contended destroy (depend-object)
nowait 9 private (list) 9 omp_sync_hint_speculative update (task-dependence-type)
thread_limit (omp-integer-expression) omp_sync_hint_nonspeculative Sets the dependence type of an OpenMP
uses_allocators ([[alloc-mod ,] alloc-mod]: allocator) depend object to task-dependence-type.
Enables the use of each specified allocator in the task-dependence-type: in, out, inout, inoutset,
region associated with the directive. mutexinoutset
alloc-mod:
memspace( mem-space-handle )
traits( traits-array )
mem-space-handle:
C/C++ Variable of memspace_handle_t type
For Integer of memspace_handle_kind kind
traits-array: Constant array of traits each of type:
C/C++ omp_alloctrait_t
For type(omp_alloctrait)
4
Continued
For statement:
statement if atomic clause is... statement: of the type specified.
!$omp atomic [clause[ [ [,] clause] ... ] ] #pragma omp cancel construct-type-clause[ [ , ] \
Fortran C/C++
read v=x
statement if-clause]
write x = expr
[!$omp end atomic]
- or - update x = x operator expr !$omp cancel construct-type-clause[ [ , ] if-clause]
x = expr operator x
!$omp atomic [clause[ [ [,] clause] ... ] [, ] ] capture & x = intrinsic_procedure_name (x, expr-list)
[ [,] clause [ [ [,] clause] ...] ] if-clause: if ([ cancel : ] omp-logical-expression)
x = intrinsic_procedure_name (expr-list, x)
statement construct-type-clause:
Fortran
capture-statement intrinsic_procedure_name: MAX, MIN, IAND, IOR, IEOR C/C++ parallel, sections, taskgroup, for
[!$omp end atomic] operator is one of +, *, /, .AND., .OR., .EQV., .NEQV. For parallel, sections, taskgroup, do
- or - if capture is present and statement x = expr, in addition to
!$omp atomic [clause[ [ [,] clause] ... ] [, ] ] capture & is preceded or followed by
[ [,] clause [ [ [,] clause] ...] ] capture-statement
any other allowed cancellation point [16.2] [2.20.2]
capture-statement Introduces a user-defined cancellation point at which
if (x == e) then
statement x=d tasks check if cancellation of the innermost enclosing
[!$omp end atomic] if compare is present end if region of the type specified has been activated.
clause:
Fortran C/C++
atomic-clause: read, write, update if (x == e) x = d #pragma omp cancellation point construct-type-clause
memory-order-clause: seq_cst, acq_rel, release, if the compare and capture clauses if (x == e) then
acquire, relaxed are both present, and statement is x=d !$omp cancellation point construct-type-clause
extended-atomic: capture, compare, fail, weak not preceded or followed by else v = x
capture: Capture the value of the variable being capture-statement end if
construct-type-clause:
updated atomically. parallel
compare: Perform the atomic update
ordered [15.10.2] [2.19.9] sections
Specifies a structured block that is to be executed in loop taskgroup
conditionally. iteration order in a parallelized loop, or it specifies cross C/C++ for
fail (seq_cst | acquire | relaxed): Specify iteration dependences in a doacross loop nest. For do
the memory ordering requirements for #pragma omp ordered [clause [[,] clause] ]
any comparison performed by any atomic structured-block
C/C++
!$omp ordered [clause [[,] clause] ] Specifies that the iterations of associated loops will
C/C++ statement: strictly-structured-block be executed in parallel by threads in the team and the
if atomic clause is... statement: [ !$omp end ordered] iterations executed by each thread can also be executed
read v = x; - or - concurrently using SIMD instructions.
write x = expr; !$omp ordered clause[ [ [,] clause] ... ]
#pragma omp for simd [clause[ [,]clause] ... ]
C/C++
x++; x--; ++x; --x; clause (for the structured-block forms only): loop-nest
update x binop = expr; x = x binop expr; threads
!$omp do simd [clause[ [,]clause] ... ]
Fortran
4
Continued
C/C++
#pragma omp distribute parallel for simd \ !$omp end parallel workshare [clause[ [, ]clause] ... ]
Fortran
C/C++
Fortran
!$omp distribute parallel do simd [clause[ [,]clause] ... ] clause] ... ]
Fortran
C/C++
loop-nest
#pragma omp taskloop simd [clause[ [,]clause] ... ] loop-nest
Fortran C/C++
Fortran
!$omp taskloop simd [clause[ [,]clause] ... ] [!$omp end parallel do simd] loop-nest
loop-nest clause: Any clause used for parallel, for simd, or do simd [!$omp end teams distribute]
[!$omp end taskloop simd] [C/C++ except the nowait clause]. clause: Any clause used for teams or distribute.
clause: Any clause used for simd or taskloop.
parallel masked [17] [2.16.6] teams distribute simd [17] [2.16.12]
parallel do and parallel for [17] [2.16.1] Shortcut for specifying a parallel construct containing a Shortcut for specifying a teams construct containing a
Specifies a parallel construct containing a worksharing- masked construct and no other statements. distribute simd construct and no other statements.
loop construct with a canonical loop nest and no other #pragma omp teams distribute simd \
#pragma omp parallel masked [clause[ [,]clause] ... ]
C/C++
statements.
C/C++
structured-block [clause[ [,] clause] ... ]
#pragma omp parallel for [clause[ [,]clause] ... ] loop-nest
Fortran C/C++
Fortran
!$omp parallel do [clause[ [,]clause] ... ] loosely-structured-block
!$omp end parallel masked loop-nest
loop-nest
Fortran
loop-nest
loop-nest
!$omp parallel loop [clause[ [,]clause] ... ]
Fortran
clause] ... ]
[!$omp end parallel loop] loop-nest loop-nest
clause: Any clause used for parallel or loop. [$omp end masked taskloop] [!$omp end teams distribute parallel do]
clause: Any clause used for taskloop or masked. clause: Any clause used for teams, distribute parallel for, or
parallel sections [17] [2.16.3] distribute parallel do.
Shortcut for specifying a parallel construct containing a masked taskloop simd [17] [2.16.8]
sections construct and no other statements. Shortcut for specifying a masked construct containing a teams distribute parallel do simd and
taskloop simd construct and no other statements.
#pragma omp parallel sections [clause[ [,]clause] ... ] teams distribute parallel for simd [17] [2.16.14]
{ #pragma omp masked taskloop simd \ Shortcut for specifying a teams construct containing a
C/C++
[#pragma omp section] [clause[ [,]clause] ... ] distribute parallel for simd or distribute parallel do simd
structured-block-sequence loop-nest construct and no other statements.
C/C++
structured-block-sequence]
C/C++
[!$omp section Shortcut for specifying a parallel construct containing a [!$omp end teams distribute parallel do simd]
structured-block-sequence] masked taskloop construct and no other statements. clause: Any clause used for teams, distribute parallel
... for simd, or distribute parallel do simd.
!$omp end parallel sections #pragma omp parallel masked taskloop \
C/C++
loop-nest
#pragma omp teams loop [clause[ [,]clause] ... ]
C/C++
loop-nest
[!$omp end teams loop]
clause: Any clause used for teams or loop.
4
Continued
#pragma omp target simd [clause[ [,]clause] ... ] #pragma omp target teams loop [clause[ [, ]clause] ... ]
C/C++
C/C++
structured-block loop-nest loop-nest
$omp target parallel [clause[ [,]clause] ... ] !$omp target simd [clause[ [,]clause] ... ] !$omp target teams loop [clause[ [, ]clause] ... ]
Fortran
Fortran
loosely-structured-block loop-nest loop-nest
!$omp end target parallel [!$omp end target simd] [!$omp end target teams loop]
Fortran
- or - clause: Any clause used for target or simd. clause: Any clause used for target or teams loop.
!$omp target parallel [clause[ [,]clause] ... ]
strictly-structured-block target teams [17] [2.16.21] target teams distribute parallel do and
[!$omp end target parallel] Shortcut for specifying a target construct containing a
teams construct and no other statements.
target teams distribute parallel for
clause: Clauses used for target or parallel except for copyin. [17] [2.16.25]
#pragma omp target teams [clause[ [,]clause] ... ] Shortcut for specifying a target construct containing
C/C++
target parallel do and structured-block teams distribute parallel for, teams distribute parallel do
target parallel for [17] [2.16.17] and no other statements.
Shortcut for specifying a target construct with a parallel $omp target teams [clause[ [, ]clause] ... ]
worksharing-loop construct and no other statements. loosely-structured-block #pragma omp target teams distribute parallel for \
C/C++
!$omp end target teams [clause[ [, ]clause] ... ]
Fortran
- or - loop-nest
loop-nest
!$omp target teams [clause[ [,]clause] ... ] !$omp target teams distribute parallel do &
strictly-structured-block
Fortran
!$omp target parallel do [clause[ [,]clause] ... ] [clause[ [, ]clause] ... ]
Fortran
Fortran
[clause[ [, ]clause] ... ] clause: Any clause used for target, teams distribute
Shortcut for specifying a target construct containing a parallel for simd, or teams distribute parallel do
parallel loop construct and no other statements. loop-nest
simd.
!$omp target teams distribute simd [clause[ [, ]clause] ... ]
Fortran
loop-nest
[!$omp end target parallel loop]
clause: Clauses used for target or parallel loop except copyin.
Notes
Clauses
All list items appearing in a clause must be visible according to the scoping rules of the base language.
Data sharing attribute clauses [5.4] [2.21.4] collapse clause [4.4.3] map clause [5.8.3] [2.21.7.1]
Additional data sharing attribute clauses are is_device_ptr, collapse (n) map ([[map-modifier, [map-modifier, ... ]
use_device_ptr, has_device_addr, and use_device_addr. A constant positive integer expression that specifies how map-type : ] locator-list)
These clauses are described at the directives that accept many loops are associated with the construct. Maps data from the task’s environment to the device
them. environment.
Used in: distribute (4), do and for (4), loop (4), simd (3),
taskloop (4) map-type: alloc, to, from, tofrom, release, delete
default (shared | firstprivate | private | none)
For the target or target data directives:
Default data-sharing attributes are disabled. All variables
depend clause [15.9.5] [2.19.11] map-type: alloc, to, from, tofrom, release
in a construct must be declared inside the construct or
appear in a data-sharing attribute clause. Enforces additional constraints on the scheduling of For the target enter data directive:
tasks or loop iterations, establishing dependences only map-type: alloc, to, from, tofrom
Used in: parallel (3), task (4), taskloop (4), teams (3) For the target exit data directive:
between sibling tasks or between loop iterations.
map-type: to, from, tofrom, release, delete
shared (list) depend ([depend-modifier,]dependence-type : locator-list)
map-modifier: always, close, present,
Variables in list are shared between threads or explicit depend-modifier: iterator (iterators-definition) mapper(mapper-id), iterator(iterators-definition)
tasks executing the construct. dependence-type: in, out, inout, mutexinoutset,
Used in: declare mapper (1), target (5), target data (4),
Used in: parallel (3), task (4), taskloop (4), teams (3) inoutset, depobj target enter data (5), target exit data (5)
• in: The generated task will be a dependent task of
private (list) all previously generated sibling tasks that reference
Creates a new variable for each item in list that is private at least one of the list items in an out or inout order clause [10.3] [2.11.3]
to each thread or explicit task. The private variable is not dependence-type list. order ([order-modifier : ] concurrent)
given an initial value. • out and inout: The generated task will be a order-modifier: reproducible, unconstrained
Used in: distribute (4), do and for (4), loop (4), parallel (3), dependent task of all previously generated sibling
scope (3), section (4), simd (3), single (3), target (5), tasks that reference at least one of the list items Specifies an expected order of execution for the iterations
task (4), taskloop (4), teams (3)
in an in, out, mutexinoutset, inout, or inoutset of the associated loops of a loop-associated directive.
dependence-type list. Used in: distribute (4), do and for (4), loop (4), simd (3)
firstprivate (list)
Declares list items to be private to each thread or explicit • mutexinoutset: If the storage location of at least
task and assigns them the value the original variable has one of the list items is the same as that of a list item nowait clause [15.6]
at the time the construct is encountered. appearing in a depend clause with an in, out, inout,
nowait
or inoutset dependence-type on a construct from
Used in: distribute (4), do and for (4), parallel (3), which a sibling task was previously generated, then Overrides any synchronization that would otherwise
scope (3), section (4), simd (3), target (5), task (4),
the generated task will be a dependent task of that occur at the end of a construct. It can also specify that
taskloop (4), teams (3)
sibling task. If the storage location of at least one an interoperability requirement set includes the nowait
of the list items is the same as that of a list item property. If the construct includes an implicit barrier, the
lastprivate ([ lastprivate-modifier:] list) nowait clause specifies that the barrier will not occur.
appearing in a depend clause with a mutexinoutset
After the last loop ends, the variables in list will be copied dependence-type on a construct from which a sibling Used in: dispatch (2), do and for (4), interop (5), scope (3),
to the primary thread. task was previously generated, then the sibling tasks section (4), single (3), target (5), target enter data (5),
lastprivate-modifier: conditional will be mutually exclusive tasks. target exit data (5), target update (5), taskwait (5),
workshare (3)
conditional: Uses the value from the thread that • inoutset: If the storage location of at least one of the
executed the highest index iteration number. list items matches the storage location of a list item
Used in: distribute (4), do and for (4), loop (4), section (4), appearing in a depend clause with an in, out, inout, reduction clause [5.5.8] [2.21.5.4]
simd (3), taskloop (4) or mutexinoutset dependence-type on a construct reduction ([ reduction-modifier , ] reduction-identifier : list)
from which a sibling task was previously generated, Specifies a reduction-identifier and one or more list items.
linear (linear-list [ : linear-step] ) then the generated task will be a dependent task of
reduction-modifier: inscan, task, default
linear (linear-list [: linear-modifier [, linear-modifier]]) that sibling task.
C++ reduction-identifier:
Declares each linear-list item to have a linear value or • depobj: The task dependences are derived from the
address with respect to the iteration space of the loop. depend clause specified in the depobj constructs Either an id-expression or one of the following
that initialized dependences represented by the operators: +, *, &, |, ^, &&, ||
linear-list: list (or for declare simd argument-list)
depend objects specified in the depend clause as if C reduction-identifier:
linear-modifier: step(linear-step), linear-type-modifier the depend clauses of the depobj constructs were Either an identifier or one of the following operators:
linear-step: OpenMP integer expression (1 is default) specified in the current construct. +, *, &, |, ^, &&, ||
linear-type-modifier: val, ref, uval (val is default) Used in: depobj (5), dispatch (2), interop (5), target (5), For reduction-identifier:
val: The value is linear
target enter data (5), target exit data (5), target update (5), Either a base language identifier, a user-defined
task (4), taskwait (5)
operator, one of the following operators:
ref: The address is linear (C++ and Fortran only) +, *, .and., .or., .eqv., .neqv.,
uval: The value is linear, may not be modified device clause [13.2] or one of the following intrinsic procedure names:
(C++ and Fortran only) device ([ancestor | device_num : ] device-description) max, min, iand, ior, ieor.
The ref and uval modifiers may only be specified for a Identifies the target device that is associated with a Used in: do and for (4), loop (4), parallel (3), scope (3),
linear clause on the declare simd directive, and only for device construct. section (4), simd (3), taskloop (4), teams (3)
arguments that are passed by reference. device-description: An expression of type integer that
Used in: declare simd (2), distribute (4), do and for (4), refers to the device number or, if ancestor modifier is iterator [3.2.6] [2.1.6]
simd (3) specified, must be 1. Identifiers that expand to multiple values in the clause
Used in: dispatch (2), interop (5), target (5), target data (4), on which they appear.
allocate clause [6.6] [2.13.4] target enter data (5), target exit data (5), target update (5) iterator (iterators-definition)
allocate ([allocator : ] list) iterators-definition:
allocate(allocate-modifier [, allocate-modifier ] : list) if clause [3.4] [2.18] iterator-specifier [, iterators-definition ]
The effect of the if clause depends on the construct iterators-specifier:
allocate-modifier: to which it is applied. For combined or composite [ iterator-type ] identifier = range-specification
allocator (allocator) constructs, it only applies to the semantics of the
allocator: is an expression of: identifier: A base language identifier.
C/C++ type omp_allocator_handle_t construct named in the directive-name-modifier if one
For kind omp_allocator_handle_kind is specified. If no modifier is specified for a combined range-specification: begin : end[: step]
align (alignment) or composite construct then the if clause applies to all begin, end: Expressions for which their types
alignment: A constant positive integer power of 2. constructs to which an if clause can apply. can be converted to iterator-type
if ([directive-name-modifier : ] omp-logical-expression) step: An integral expression.
Used in: distribute (4), do and for (4), parallel (3), scope (3),
section (4), single (3), target (5), task (4), taskgroup (5), Used in: cancel (6), parallel (3), simd (3), target (5), iterator-type: C/C++ A type name. For A type specifier.
taskloop (4), teams (3) target data (4), target enter data (5), target exit data (5),
target update (5), task (4), taskloop (4), teams (3)
Fortran C/C++
constructs not specifying a num_threads clause, by setting int omp_get_ancestor_thread_num (int level);
the value of the first element of the nthreads-var ICV of the void omp_set_schedule(omp_sched_t kind,
C/C++
current task to num_threads. int chunk_size); integer function omp_get_ancestor_thread_num (level)
integer level
Fortran C/C++
Fortran
integer (kind=omp_sched_kind) kind omp_get_team_size [18.2.19] [3.2.19]
subroutine omp_set_num_threads (num_threads) integer chunk_size
Returns, for a given nested level of the current thread,
integer num_threads See omp_get_schedule for kind. the size of the thread team to which the ancestor or the
current thread belongs.
omp_get_num_threads [18.2.2] [3.2.2] omp_get_schedule [18.2.12] [3.2.12]
Fortran C/C++
Returns the number of threads in the current team. The Returns the schedule applied when runtime schedule is int omp_get_team_size (int level);
binding region for an omp_get_num_threads region is used. ICV: run-sched-var
the innermost enclosing parallel region. If called from the integer function omp_get_team_size (level)
void omp_get_schedule (
C/C++
sequential part of a program, this routine returns 1. integer level
omp_sched_t *kind, int *chunk_size);
Fortran C/C++
Fortran C/C++
implementation-defined schedule or: int omp_get_active_level (void);
Returns an upper bound on the number of threads that omp_sched_static
could be used to form a new team if a parallel construct omp_sched_dynamic
without a num_threads clause were encountered after omp_sched_guided integer function omp_get_active_level ()
execution returns from this routine. omp_sched_auto
Use + or | operators (C/C++) or the + operator (For)
Fortran C/C++
int omp_get_max_threads (void); to combine the kinds with the modifier Thread affinity routines
omp_sched_monotonic. omp_get_proc_bind [18.3.1] [3.3.1]
integer function omp_get_max_threads () Returns the thread affinity policy to be used for the
omp_get_thread_limit [18.2.13] [3.2.13]
subsequent nested parallel regions that do not specify a
Returns the maximum number of OpenMP threads proc_bind clause.
omp_get_thread_num [18.2.4] [3.2.4] available in contention group. ICV: thread-limit-var
Returns the thread number of the calling thread, within the
Fortran C/C++
omp_proc_bind_t omp_get_proc_bind (void);
Fortran C/C++
Returns true if the active-levels-var ICV is greater than zero; int omp_get_supported_active_levels (void); omp_proc_bind_close
otherwise it returns false. omp_proc_bind_spread
Fortran C/C++
new nested parallel region is generated by the current task, int omp_get_num_places (void);
omp_set_dynamic [18.2.6] [3.2.6] by setting max-active-levels-var ICV.
Enables or disables dynamic adjustment of the number of
integer function omp_get_num_places ()
Fortran C/C++
threads available for the execution of subsequent parallel void omp_set_max_active_levels (int max_levels);
regions by setting the value of the dyn-var ICV.
subroutine omp_set_max_active_levels (max_levels) omp_get_place_num_procs [18.3.3] [3.3.3]
Fortran C/C++
void omp_set_dynamic (int dynamic_threads); integer max_levels Returns the number of processors available to the
execution environment in the specified place.
subroutine omp_set_dynamic (dynamic_threads) omp_get_max_active_levels [18.2.16] [3.2.16]
C/C++
logical dynamic_threads Returns the maximum number of nested active parallel int omp_get_place_num_procs (int place_num);
regions when the innermost parallel region is generated by
omp_get_dynamic [18.2.7] [3.2.7] the current task. ICV: max-active-levels-var integer function &
Fortran
threads is enabled for the current task. ICV: dyn-var int omp_get_max_active_levels (void); integer place_num
Fortran C/C++
omp_get_cancellation [18.2.8] [3.2.8] Returns the number of nested parallel regions on the int place_num, int *ids);
device that enclose the task containing the call.
Returns true if cancellation is enabled; otherwise it returns ICV: levels-var
false. ICV: cancel-var subroutine omp_get_place_proc_ids(place_num, ids)
Fortran
integer place_num
Fortran C/C++
4
Continued
Fortran C/C++
int omp_get_partition_num_places (void); routine. ICV: nteams-var void omp_set_default_device (int device_num);
Fortran C/C++
integer function omp_get_partition_num_places () int omp_get_max_teams (void); subroutine omp_set_default_device (device_num)
integer device_num
omp_get_partition_place_nums [18.3.7] [3.3.7] integer function omp_get_max_teams()
omp_get_default_device [18.7.3] [3.7.3]
Returns the list of place numbers corresponding to the Returns the value of the default-device-var ICV, which
places in the place-partition-var ICV of the innermost omp_set_teams_thread_limit [18.4.5] [3.4.5] determines the default target device.
implicit task. Sets the maximum number of OpenMP threads that can
Fortran C/C++
void omp_get_partition_place_nums ( participate in each contention group created by a teams int omp_get_default_device (void);
Fortran C/C++
C/C++
subroutine omp_get_partition_place_nums( & void omp_set_teams_thread_limit(int thread_limit); integer function omp_get_default_device ()
place_nums)
integer place_nums (*) subroutine & omp_get_num_devices [18.7.4] [3.7.4]
Fortran
omp_set_affinity_format [18.3.8] [3.3.8] omp_set_teams_thread_limit(thread_limit) Returns the number of non-host devices available for
Sets the affinity format to be used on the device by setting integer thread_limit offloading code or data.
the value of the affinity-format-var ICV.
omp_get_teams_thread_limit [18.4.6] [3.4.6]
Fortran C/C++
int omp_get_num_devices (void);
Fortran C/C++
void omp_set_affinity_format (const char *format); Returns the maximum number of OpenMP threads available
to participate in each contention group created by a teams
construct. integer function omp_get_num_devices ()
subroutine omp_set_affinity_format (format)
character(len=*), intent(in) :: format
Fortran C/C++
Fortran C/C++
int omp_get_device_num (void);
size_t omp_get_affinity_format (char *buffer,
Fortran C/C++
Fortran C/C++
int omp_is_initial_device (void);
Fortran C/C++
int omp_get_team_num (void); integer function omp_pause_resource_all (kind) omp_target_free [18.8.2] [3.8.2]
integer (kind=omp_pause_resource_kind) kind Frees the device memory allocated by the
integer function omp_get_team_num () omp_target_alloc routine.
Device information routines void omp_target_free (void *device_ptr,
C/C++
void omp_set_num_teams (int num_teams); int omp_get_num_procs (void); type(c_ptr), value :: device_ptr
integer(c_int), value :: device_num
subroutine omp_set_num_teams(num_teams) integer function omp_get_num_procs ()
integer num_teams
4
Continued
C/C++
int omp_target_is_present (const void *ptr,
C/C++
int device_num); const void *src, size_t length, size_t dst_offset, int device_num);
C/C++
size_t src_offset, int dst_device_num,
integer(c_int) function omp_target_is_present( & int src_device_num, int depobj_count, type(c_ptr) function omp_get_mapped_ptr( &
ptr, device_num) bind(c) omp_depend_t *depobj_list); ptr, device_num) bind(c)
Fortran
Fortran
use, intrinsic :: iso_c_binding, only : c_ptr, c_int use, intrinsic :: iso_c_binding, only : c_ptr, c_int
type(c_ptr), value :: ptr integer(c_int) function omp_target_memcpy_async( & type(c_ptr), value :: ptr
integer(c_int), value :: device_num dst, src, length, dst_offset, src_offset, & integer(c_int), value :: device_num
dst_device_num, src_device_num, depobj_count, &
omp_target_is_accessible [18.8.4] [3.8.4] depobj_list) bind(c)
Tests whether host memory is accessible from a given use, intrinsic :: iso_c_binding, only : c_ptr, c_int, & Lock routines
Fortran
device. c_size_t General-purpose lock routines. Two types of locks are
type(c_ptr), value :: dst, src supported: simple locks and nestable locks. A nestable
int omp_target_is_accessible (const void *ptr, integer(c_size_t), value :: length, dst_offset, src_offset lock can be set multiple times by the same task before
C/C++
size_t size, int device_num); integer(c_int), value :: dst_device_num, & being unset; a simple lock cannot be set if it is already
src_device_num, depobj_count owned by the task trying to set it.
integer(c_int) function omp_target_is_accessible( & integer(omp_depend_kind), optional :: depobj_list(*)
ptr, size, device_num) bind(c) Initialize lock [18.9.1] [3.9.1]
use, intrinsic :: iso_c_binding, only : & omp_target_memcpy_rect_async [18.8.8] [3.8.8]
Fortran
c_ptr, c_size_t, c_int Asynchronously performs a copy between any combination void omp_init_lock (omp_lock_t *lock);
C/C++
type(c_ptr), value :: ptr of host and device pointers.
integer(c_size_t), value :: size void omp_init_nest_lock (omp_nest_lock_t *lock);
integer(c_int), value :: device_num int omp_target_memcpy_rect_async (void *dst, subroutine omp_init_lock (svar)
const void *src, size_t element_size, int num_dims, integer (kind=omp_lock_kind) svar
Fortran
omp_target_memcpy [18.8.5] [3.8.5] const size_t *volume, const size_t *dst_offsets,
C/C++
Copies memory between any combination of host and const size_t *src_offsets, const size_t *dst_dimensions, subroutine omp_init_nest_lock (nvar)
device pointers. const size_t *src_dimensions, int dst_device_num, integer (kind=omp_nest_lock_kind) nvar
int src_device_num, int depobj_count,
int omp_target_memcpy (void *dst, const void *src, omp_depend_t *depobj_list); Initialize lock with hint [18.9.2] [3.9.2]
C/C++
C/C++
dst, src, length, dst_offset, src_offset, & dst_offsets, src_offsets, dst_dimensions, &
dst_device_num, src_device_num) bind(c) src_dimensions, dst_device_num, src_device_num, & void omp_init_nest_lock_with_hint (
use, intrinsic :: iso_c_binding, only : c_ptr, & depobj_count, depobj_list) bind(c) omp_nest_lock_t *lock,
Fortran
c_int, c_size_t use, intrinsic :: iso_c_binding, only : c_ptr, c_int, & omp_sync_hint_t hint);
Fortran
const size_t *src_offsets, routines, to a host pointer. void omp_destroy_lock (omp_lock_t *lock);
C/C++
c_size_t type(c_ptr), value :: host_ptr, device_ptr Sets an OpenMP lock. The calling task region is suspended
type(c_ptr), value :: dst, src integer(c_size_t), value :: size, device_offset until the lock is set.
integer(c_size_t), value :: element_size integer(c_int), value :: device_num void omp_set_lock (omp_lock_t *lock);
C/C++
use, intrinsic :: iso_c_binding, only : c_ptr, c_int void omp_unset_lock (omp_lock_t *lock);
C/C++
4
Continued
C/C++
int omp_test_lock (omp_lock_t *lock); omp_interop_t interop, omp_allocator_handle_t allocator);
C/C++
omp_interop_property_t property_id);
C
int omp_test_nest_lock (omp_nest_lock_t *lock); void *omp_aligned_alloc (size_t alignment,
omp_get_interop_type_desc [18.12.6] [3.12.6] size_t size, omp_allocator_handle_t allocator);
logical function omp_test_lock (svar) Retrieves a description of the type of a property associated
integer (kind=omp_lock_kind) svar void *omp_alloc (size_t size,
Fortran
C/C++
omp_interop_t interop,
C++
void *omp_aligned_alloc (size_t size,
omp_interop_property_t property_id); size_t alignment,
Timing routines omp_allocator_handle_t allocator
Timing routines support a portable wall clock timer. These omp_get_interop_rc_desc [18.12.7] [3.12.7] = omp_null_allocator);
record elapsed time per-thread and are not guaranteed to Retrieves a description of the return code associated with
be globally consistent across all the threads participating an omp_interop_t object. type(c_ptr) function omp_alloc (size, allocator) bind(c)
in an application. use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t
const char* omp_get_interop_rc_desc (
C/C++
integer(c_size_t), value :: size
omp_get_wtime [18.10.1] [3.10.1] omp_interop_t ret_code); integer(omp_allocator_handle_kind), value :: allocator
Fortran
Returns elapsed wall clock time in seconds. type(c_ptr) function omp_aligned_alloc ( &
Memory management routines alignment, size, allocator) bind(c)
Fortran C/C++
C
omp_atk_X where X may be one of sync_hint, alignment, omp_allocator_handle_t allocator);
Fortran C/C++
C++
omp_allocator_handle_t allocator
For integer omp_alloctrait_val_kind = omp_null_allocator);
double precision function omp_get_wtick ()
omp_atv_X where X may be one of false, true, default,
contended, uncontended, serialized, private, all, subroutine omp_free (ptr, allocator) bind(c)
Fortran
thread, pteam, cgroup, default_mem_fb, null_fb, use, intrinsic :: iso_c_binding, only : c_ptr
Event routine abort_fb, allocator_fb, environment, nearest, type(c_ptr), value :: ptr
Event routines support OpenMP event objects, which blocked, interleaved integer(omp_allocator_handle_kind), value :: allocator
must be accessed through the routines described in this
section or through the detach clause. omp_init_allocator [18.13.2] [3.13.2] omp_calloc and omp_aligned_calloc [18.13.8] [3.13.8]
Initializes allocator and associates it with a memory space. Request a zero-initialized memory allocation from a
omp_fulfill_event [18.11.1] [3.11.1] memory allocator.
Fulfills and destroys an OpenMP event. omp_allocator_handle_t omp_init_allocator (
C/C++
void omp_fulfill_event (omp_event_handle_t event); int ntraits, const omp_alloctrait_t traits[]); omp_allocator_handle_t allocator);
integer (kind=omp_allocator_handle_kind) function & void *omp_aligned_calloc (size_t alignment,
C
subroutine omp_fulfill_event (event) omp_init_allocator (memspace, ntraits, traits size_t nmemb, size_t size,
integer (kind=omp_event_handle_kind) event
Fortran
int omp_get_num_interop_properties (
C/C++
Sets the default memory allocator to be used by allocation type(c_ptr) function omp_aligned_calloc ( &
omp_interop_property_t property_id, calls, allocate directives, and allocate clauses that do not alignment, nmemb, size, allocator) bind(c)
int *ret_code ); specify an allocator. use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t
integer(c_size_t), value :: alignment, nmemb, size
omp_get_interop_ptr [18.12.3] [3.12.3] void omp_set_default_allocator (
C/C++
void *omp_get_interop_ptr (
const omp_interop_t interop, integer (kind=omp_allocator_handle_kind), &
C/C++
omp_get_default_allocator (void);
omp_interop_property_t property_id,
int *ret_code ); integer (kind=omp_allocator_handle_kind) &
function omp_get_default_allocator ()
Continued
4
© 2021 OpenMP ARB www.openmp.org OMPSC21
OpenMP API 5.2 C/C++ C/C++ content | Fortran or For Fortran content | [n.n.n] Sections in 5.2. spec | [n.n.n] Sections in 5.1. spec | 9 See Clause info on pg. 9 14
C/C++
void *omp_realloc (void *ptr, size_t size,
Fortran C/C++
omp_allocator_handle_t allocator, void *arg); void omp_display_env (int verbose);
C
Fortran
void *omp_realloc (void *ptr, size_t size, modifier)
omp_allocator_handle_t allocator integer (kind=omp_control_tool_kind) command logical, intent(in) :: verbose
integer modifier
C++
= omp_null_allocator,
omp_allocator_handle_t free_allocator command:
= omp_null_allocator); omp_control_tool_start
type(c_ptr) function omp_realloc ( & Start or restart monitoring if it is off. If monitoring
ptr, size, allocator, free_allocator) bind(c) is already on, this command is idempotent. If
use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t monitoring has already been turned off permanently,
Fortran
Environment Variables
Environment variable names are upper case. The values assigned to them are case insensitive and may have leading and trailing white space.
OMP_AFFINITY_FORMAT format [21.2.5] [6.14] Allocator traits & allowed values [Table 6.2 2.9] OMP_DISPLAY_AFFINITY var [21.2.4] [6.13]
Sets the initial value of the affinity-format-var ICV defining sync_hint contended, uncontended, serialized, private Instructs the runtime to display formatted affinity
the format when displaying OpenMP thread affinity alignment 1 byte; Positive integer value that is a power of 2 information for all OpenMP threads in the parallel
information. The format is a character string that may access all, cgroup, pteam, thread region. The information is displayed upon entering the
contain as substrings one or more field specifiers, in first parallel region and when there is any change in the
pool_size Positive integer value (default is impl. defined)
addition to other characters. The value is case-sensitive, information accessible by the format specifiers listed
and leading and trailing whitespace is significant. The fallback default_mem_fb, null_fb, abort_fb, allocator_fb in the table for OMP_AFFINITY_FORMAT. If there is
format of each field specifier is: %[[[0].]size]type, where fb_data An allocator handle (No default) a change of affinity of any thread in a parallel region,
the field type may be either the short or long names pinned true, false thread affinity information for all threads in that region
listed below [Table 21.2 6.2]. partition environment, nearest, blocked, interleaved will be displayed. var may be true or false.
t team_num n thread_num
T num_teams N num_threads
Predefined allocators, memory space, and trait values [Table 6.3 2.10] OMP_DISPLAY_ENV var [21.7] [6.12]
omp_default_mem_alloc omp_default_mem_space If var is true, instructs the runtime to display the OpenMP
L nesting_level a ancestor_tnum fallback:null_fb version number and the value of the ICVs associated with
P process_id A thread_affinity
omp_large_cap_mem_alloc omp_large_cap_mem_space the environment variables as name=value pairs. If var is
H host i native_thread_id (none) verbose, the runtime may also display vendor-specific
omp_const_mem_space variables. If var is false, no information is displayed.
OMP_ALLOCATOR [21.5.1] [6.22] omp_const_mem_alloc (none)
OpenMP memory allocators can be used to make
allocation requests. This environment variable sets the omp_high_bw_mem_alloc omp_high_bw_mem_space
(none)
OMP_DYNAMIC var [21.1.1] [6.3]
Sets the initial value of the dyn-var ICV. var may be true
initial value of def-allocator-var ICV that specifies the omp_low_lat_mem_space or false. If true, the implementation may dynamically
default allocator for allocation calls, directives, and omp_low_lat_mem_alloc (none) adjust the number of threads to use for executing
clauses that do not specify an allocator. The value is Implementation defined parallel regions.
a predefined allocator or a predefined memory space omp_cgroup_mem_alloc access:cgroup
optionally followed by one or more allocator traits. Implementation defined OMP_MAX_ACTIVE_LEVELS levels [21.1.4] [6.8]
omp_pteam_mem_alloc access:pteam
• Predefined memory spaces are listed in Table 6.1 2.8 Sets the initial value of the max-active-levels-var ICV that
• Allocator traits are listed in Table 6.2 2.9 omp_thread_mem_alloc Implementation defined controls the maximum number of nested active parallel
• Predefined allocators are listed in Table 6.3 2.10 access:thread regions.
Environment Variables
OMP_PROC_BIND policy [21.1.7] [6.4] OMP_TARGET_OFFLOAD [21.2.8] [6.17] OMP_TOOL_LIBRARIES library-list [21.3.2] [6.19]
Sets the initial value of the global bind-var ICV, setting Sets the initial value of the target-offload-var ICV. The Sets the tool-libraries-var ICV to a list of tool libraries
the thread affinity policy to use for parallel regions at the value must be one of mandatory, disabled, or default. that will be considered for use on a device where an
corresponding nested level. policy can have the values OpenMP implementation is being initialized. library-list is
true, false, or a comma-separated list of primary, close, OMP_TEAMS_THREAD_LIMIT [21.6.2] [6.24] a space-separated list of dynamically-linked libraries, each
or spread in quotes. Sets the maximum number of OpenMP threads to use in specified by an absolute path.
each contention group created by a teams construct by
OMP_SCHEDULE [modifier:]kind[, chunk] [21.2.1] [6.1] setting the teams-thread-limit-var ICV. OMP_TOOL_VERBOSE_INIT [21.3.3] [6.20]
Sets the run-sched-var ICV for the runtime schedule Sets the tool-verbose-init-var ICV, which controls whether
kind and chunk size. modifier is one of monotonic or OMP_THREAD_LIMIT limit [21.1.3] [6.10] an OpenMP implementation will verbosely log the
nonmonotonic; kind is one of static, dynamic, guided, Sets the maximum number of OpenMP threads to use in registration of a tool. The value must be a filename or one
or auto. a contention group by setting the thread-limit-var ICV. of disabled, stdout, or stderr.
OMP_STACKSIZE size[ B | K | M | G ] [21.2.2] [6.6] OMP_TOOL (enabled|disabled) [21.3.1] [6.18] OMP_WAIT_POLICY policy [21.2.3] [6.7]
Sets the stacksize-var ICV that specifies the size of Sets the tool-var ICV. If disabled, no first-party tool will be Sets the wait-policy-var ICV that provides a hint to an
the stack for threads created by the OpenMP imple- activated. If enabled the OpenMP implementation will try OpenMP implementation about the desired behavior of
mentation. size is a positive integer that specifies stack to find and activate a first-party tool. waiting threads. Valid values for policy are active (waiting
size. B is bytes, K is kilobytes, M is megabytes, and G is threads consume processor cycles while waiting) and
gigabytes. If unit is not specified, size is in units of K. passive. Default is implementation defined.
Copyright © 2021 OpenMP Architecture Review Board. based on one or more of the OpenMP specifications must
Permission to copy without fee all or part of this material is acknowledge the copyright by displaying the following
granted, provided the OpenMP Architecture Review Board statement: “OpenMP is a trademark of the OpenMP
copyright notice and the title of this document appear. Architecture Review Board. Portions of this product/
®
Notice is given that copying is by permission of the OpenMP publication may have been derived from the OpenMP
Architecture Review Board. Products or publications Language Application Program Interface Specification.”