HOME
| OPENMP API Specification: Version 5.0 November 2018

2.5.4  How ICVs are Scoped

Table 2.3 shows the ICVs and their scope.


Table 2.3: Scopes of ICVs


ICV Scope


dyn-var data environment
nthreads-var data environment
run-sched-var data environment
def-sched-var device
bind-var data environment
stacksize-var device
wait-policy-var device
thread-limit-var data environment
max-active-levels-var device
active-levels-var data environment
levels-var data environment
place-partition-var implicit task
cancel-var global
display-affinity-var global
affinity-format-var device
default-device-var data environment
target-offload-var global
max-task-priority-var global
tool-var global
tool-libraries-var global
debug-var global
def-allocator-var implicit task


Description

Calls to OpenMP API routines retrieve or modify data environment scoped ICVs in the data environment of their binding tasks.

2.5.4.1 How the Per-Data Environment ICVs Work

When a task construct or parallel construct is encountered, the generated task(s) inherit the values of the data environment scoped ICVs from the generating task’s ICV values.

When a parallel construct is encountered, the value of each ICV with implicit task scope is inherited, unless otherwise specified, from the implicit binding task of the generating task unless otherwise specified.

When a task construct is encountered, the generated task inherits the value of nthreads-var from the generating task’s nthreads-var value. When a parallel construct is encountered, and the generating task’s nthreads-var list contains a single element, the generated task(s) inherit that list as the value of nthreads-var. When a parallel construct is encountered, and the generating task’s nthreads-var list contains multiple elements, the generated task(s) inherit the value of nthreads-var as the list obtained by deletion of the first element from the generating task’s nthreads-var value. The bind-var ICV is handled in the same way as the nthreads-var ICV.

When a target task executes a target region, the generated initial task uses the values of the data environment scoped ICVs from the device data environment ICV values of the device that will execute the region.

If a teams construct with a thread_limit clause is encountered, the thread-limit-var ICV from the data environment of the initial task for each team is instead set to a value that is less than or equal to the value specified in the clause.

When encountering a worksharing-loop region for which the runtime schedule kind is specified, all implicit task regions that constitute the binding parallel region must have the same value for run-sched-var in their data environments. Otherwise, the behavior is unspecified.