HOME
| OPENMP API Specification: "Version 5.2 -- GIT rev 95b2e3a44"

7.1  OpenMP Contexts

At any point in a program, an OpenMP context exists that defines traits that describe the active OpenMP constructs, the execution devices, functionality supported by the implementation and available dynamic values. The traits are grouped into trait sets. The following trait sets exist: construct, device, target_device, implementation and dynamic. Traits are categorized as name-list traits, clause-list traits, non-property traits and extension traits. This categorization determines the syntax that is used to match the trait, as defined in Section 7.2.

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. Whether the dispatch construct is added to the construct set is implementation defined. If it is added, it will only be added for the target-call of the associated code. 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 procedures 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 one.
2.
For procedures 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 procedures that are determined to be target function variants by a declare target directive, the target trait is added to the beginning of the set as c1 so the total size of the set is increased by one.

The simd trait is a clause-list trait that is defined with properties that match the clauses accepted by the declare simd directive with the same name and semantics. The simd trait defines at least the simdlen property and one of the inbranch or notinbranch properties. Traits in the construct set other than simd are non-property traits.

The device set includes traits that define the characteristics of the device being targeted by the compiler at that point in the program. For each target device that the implementation supports, a target_device set exists that defines the characteristics of that device. At least the following traits must be defined for the device and all target_device sets:

The kind, isa and arch traits in the device and target_device sets are name-list traits.

Additionally, the target_device set defines the following trait:

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:

The vendor and extension traits in the implementation set are name-list traits.

Implementations can define additional traits in the device, target_device and implementation sets; these traits are extension traits.

The dynamic trait set includes traits that define the dynamic properties of a program at a point in its execution. The data state trait in the dynamic trait set refers to the complete data state of the program that may be accessed at runtime.