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

ID 767251
Date 3/22/2024
Public

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

Document Table of Contents

OpenMP* Context Selectors

This feature is only available for ifx.

Context selectors define properties that can match an OpenMP* context. OpenMP defines different selectors sets, each set contains one or more different selectors.

Syntax

context-selector

Is trait-set-selector [, trait-set-selector [, . . . ]]

trait-set-selector

Is trait-set-selector-name= {trait-selector [, trait-selector [, . . .]]}

Note that the curly braces are part of the required syntax.

trait-set-selector-name

Is CONSTRUCT, DEVICE, IMPLEMENTATION, TARGET_DEVICE, or USER.

trait-selector

Is trait-set-selector-name [ ( [trait-score : ] trait-property [, trait-property [, . . .]] ) ]

trait-score

Is SCORE (score-expression)

score-expression

Is a scalar-integer-constant-expression with a non-negative value.

trait-property

Is trait-property-name

or trait-property-clause

or trait-property-expression

or trait-property-extension

trait-property-name

Is KIND, ISA, ARCH, or VENDOR

or a default-character-constant

trait-property-clause

Is a clause, as defined in the OpenMP 5.2 Specification.

trait-property-expression

Is a scalar-logical-expression

or a scalar-integer-expression

trait-property-extension

Is trait-property-name

or identifier ( trait-property-extension [, trait-property-extension [, . . .]] )

or a constant-integer-expression

For trait-selectors that are name-list traits (KIND, ISA, and ARCH in the DEVICE and TARGET_DEVICE trait sets), a specified trait-property should be trait-property-name. For these trait-selectors, at least one trait-property must be specified.

For trait-selectors that correspond to clause-list traits (a SIMD trait in the construct trait set, or a REQUIRES clause in the implementation trait set), a trait-property should be a trait-property-clause. The trait-property-clause syntax is the same as for a matching OpenMP clause. At least one trait-property must be specified for a REQUIRES selector.

The ISA construct context selector set specifies the construct traits that should be active in the OpenMP context. The trait selectors that can be specified in a CONSTRUCT context selector are OpenMP directive names of context-matching constructs.

The syntax of a trait-property-clause for a trait-property of a SIMD trait-selector-name in a CONSTRUCT trait-selector set is that of a valid clause for a DECLARE SIMD directive with the same restriction for that clause.

The DEVICE and IMPLEMENTATION selector sets define the traits that should be active in the trait sets of the OpenMP context. The TARGET_DEVICE selector set specifies traits that should be active in the target device trait set for the device identified by the DEVICE_NUM selector. If the DEVICE_NUM selector is specified for TARGET_DEVICE, only one trait-property-expression can be specified.

The KIND selector of the DEVICE and the TARGET_DEVICE selector sets can specify HOST, NOHOST, or ANY. If ANY is specified, neither HOST nor NOHOST can appear in the same selector.

ATOMIC_DEFAULT_MEM_ORDER can be specified as a selector for the IMPLEMENTATION trait set. In this case, only a single trait-property can appear and it must be an identifier that is one of the valid arguments to the ATOMIC_DEFAULT_MEM_ORDER clause in a REQUIRES directive.

The REQUIRES selector can also be specified as a selector of the IMPLEMENTATION set. In this case, the syntax is the same as for a valid clause of a REQUIRES directive, and the same restrictions apply.

The USER selector defines a CONDITION selector that specifies additional user-defined conditions. The CONDITION selector must contain one trait-property-expression that is a logical expression; it must evaluate to .TRUE for the selector to be true. If the expression is not a constant expression, the selector is dynamic; otherwise, it is static.

The dynamic part of a context selector is its USER selector set (if is it not static) and its TARGET_DEVICE selector set. All other parts of the context selector are static.

In the MATCH clause of a DECLARE VARIANT directive, the following are rules for a context selector expression:

  • A reference to a dummy argument of the base procedure is a reference to the actual argument associated with the dummy argument.

  • Otherwise, a reference to a variable or procedure in an context selector expression is a reference to the variable or procedure that is accessible in the scope of the directive in which the context selector appears.

Except in a CONSTRUCT selector set, each trait-property can be specified only once. Each trait-set-selector-name can appear once in context selector. A given trait-selector-name can appear only once in a context selector.

A trait-score cannot be specified for CONSTRUCT, DEVICE, or TARGET_DEVICE trait selector sets.

The expression specified for DEVICE_NUM must evaluate to a non-negative integer value that is less than or equal to the value returned by a call to OMP_GET_NUM_DEVICES ().