HOME
| OPENMP API Specification: Version 5.0 November 2018

2.3.1  OpenMP Context

At any point in a program, an OpenMP context exists that defines traits that describe the active OpenMP constructs, the execution devices, and functionality supported by the implementation. The traits are grouped into trait sets. The following trait sets exist: construct, device and implementation.

The construct set is composed of the directive names, each being a trait, of all enclosing constructs at that point in the program up to a target construct. Combined and composite constructs are added to the set as distinct constructs in the same nesting order specified by the original construct. The set is ordered by nesting level in ascending order. Specifically, the ordering of the set of constructs is c1, …, cN, where c1 is the construct at the outermost nesting level and cN is the construct at the innermost nesting level. In addition, if the point in the program is not enclosed by a target construct, the following rules are applied in order:

1.
For functions with a declare simd directive, the simd trait is added to the beginning of the set as c1 for any generated SIMD versions so the total size of the set is increased by 1.
2.
For functions that are determined to be function variants by a declare variant directive, the selectors c1, …, cM of the construct selector set are added in the same order to the beginning of the set as c1, …, cM so the total size of the set is increased by M.
3.
For functions within a declare target block, the target trait is added to the beginning of the set as c1 for any versions of the function that are generated for target regions so the total size of the set is increased by 1.

The simd trait can be further defined with properties that match the clauses accepted by the declare simd directive with the same name and semantics. The simd trait must define at least the simdlen property and one of the inbranch or notinbranch properties.

The device set includes traits that define the characteristics of the device being targeted by the compiler at that point in the program. At least the following traits must be defined:

The implementation set includes traits that describe the functionality supported by the OpenMP implementation at that point in the program. At least the following traits can be defined:

Implementations can define further traits in the device and implementation sets. All implementation defined traits must follow the following syntax:  

 
identifier[(context-element[, context-element[, ...]])] 
 
context-element: 
  identifier[(context-element[, context-element[, ...]])] 
  or 
  context-value 
 
context-value: 
  constant string 
  or 
  constant integer expression  

where identifier is a base language identifier.