HOME
| OPENMP API Specification: Version 5.1 November 2020

2.4.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 data environment
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
tool-verbose-init-var global
debug-var global
num-procs-var device
thread-num-var implicit task
final-task-var data environment
implicit-task-var data environment
team-size-var team
def-allocator-var implicit task
nteams-var device
teams-thread-limit-var device


Description

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

2.4.4.1 How the Per-Data Environment ICVs Work

When a task construct, a parallel construct or a teams construct is encountered, each generated task inherits the values of the data environment scoped ICVs from each generating task’s ICV values.

When a parallel construct is encountered, the value of each ICV with implicit task scope is inherited 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 implicit tasks 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 implicit tasks 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 an active 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.

When a target task executes an inactive target region, the generated initial task uses the values of the data environment scoped ICVs from the data environment of the task that encountered the target construct.

If a target construct with a thread_limit clause is encountered, the thread-limit-var ICV from the data environment of the generated initial task is instead set to an implementation defined value between one and the value specified in the clause.

If a target construct with no thread_limit clause is encountered, the thread-limit-var ICV from the data environment of the generated initial task is set to an implementation defined value that is greater than zero.

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 an implementation defined value between one and the value specified in the clause.

If a teams construct with no thread_limit clause is encountered, the thread-limit-var ICV from the data environment of the initial task of each team is set to an implementation defined value that is greater than zero and does not exceed teams-thread-limit-var, if teams-thread-limit-var is greater than zero.

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.