Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

OpenMP* Contexts

This feature is only available for ifx.

At each point of an OpenMP* program, an OpenMP context exists that describes the following traits: the devices where parts of the program execute, the implementation supported functionality, such as target instruction sets, the active OpenMP constructs, and the available dynamic values.

A number of trait sets exist: construct, dynamic, device, implementation, and target_device. The category of the trait determines the syntax of the context selector used to match the trait.

At minimum, the following traits must be defined for each device and for all target device trait sets:

  • The CONSTRUCT trait set

    This is the set of directive names of all enclosing constructs at that point in the program up to a TARGET construct. Each enclosing directive name is a trait. Composite and combined constructs are added to the trait set as distinct constructs in the same nesting order specified by the construct.

    It is implementation defined if an implementation adds a DISPATCH construct to the trait set. If a DISPATCH trait is added, it is only added for the target call of the code. Constructs are ordered c1, … cN, with c1 being the outermost nested construct, and cN being the innermost nested construct. At a point in the program not enclosed in a TARGET construct, the following rules are applied in the order shown:

    1. Procedures with the DECLARE SIMD directive have the SIMD trait added as the construct trait c1 for generated SIMD versions, increasing the size of the trait set by one.

    2. Procedures that are function variants generated by a DECLARE VARIANT directive have the constructs c1 to cM added to the beginning of their set of construct traits as c1, … cM, increasing their construct trait set size by M.

    3. The TARGET trait is added to the beginning of a device routine as c1 for versions of the procedure generated for TARGET regions, increasing their construct trait set size by one.

    The clause list trait SIMD is defined with properties matching the clauses accepted in a DECLARE SIMD directive with the same names and semantics as the clauses. The SIMD trait minimally defines the SIMDLEN property, and either the INBRANCH or the NOTINBRANCH property. Construct traits other than SIMD are non-property traits.

  • The DEVICE trait set

    This is the set that defines the characteristics of the device targeted by the compiler at that point in the program. A target-device set exists for each target device supported by an implementation, and includes traits that specify the characteristics of that device. The following traits must be defined for the DEVICE and TARGET_DEVICE trait sets:

    • The KIND (kind-name-list) trait indicates the kind of the device. Defined kind-name values are as follows:

      • ANY, which has the same effect as if no KIND selector was specified

      • HOST, which indicates that the device is the host device

      • NOHOST, which indicates that the device is not the host device

      • Additional values defined in the OpenMP Additional Definitions document

    • The ARCH (architecture-name-list) specifies implementation defined architectures supported by the device.

    • The ISA (isa-name-list) lists the implementation-defined instruction set architectures supported by the device.

    • The VENDOR (vendor-name-list)) is a supported vendor-name value defined in OpenMP Additional Definitions document.

    • The TARGET_DEVICE set also must include the DEVICE_NUM trait, which specifies the device number of the device.

    ARCH, ISA, KIND, and VENDOR traits in the device and target device traits are name-list traits.

  • The IMPLEMENTATION trait set

    This is the set that contains traits that describe the supported functionality of the OpenMP implementation at that point in the program. The following traits can be defined:

    • EXTENSION (extension-name-list), which lists implementation-specific extensions to the OpenMP specification. Extension names are implementation defined.

    • VENDOR (vendor-name-list)).

    • A REQUIRES (requires-clause-list) trait, which is a clause-list trait whose properties are the clauses that have been specified in the REQUIRES directive prior to the point in the program, including any implementation-defined implicit requirements.

    The VENDOR and EXTENSION implementation set traits are name-list traits.

An implementation may define additional DEVICE, TARGET_DEVICE, and IMPLEMENTATION traits. These additional traits are extension traits.

The dynamic properties of a program at any point in its execution are specified by the dynamic trait set. The DATA STATE trait is a dynamic trait that refers to the complete data state of the program that can be accessed at runtime.