Name: declare reduction | Association: none |
Category: declarative | Properties: pure |
|
Arguments
declare reduction(reduction-specifier) Name | Type | Properties |
reduction-specifier | OpenMP reduction specifier | |
|
Clauses
Semantics
The declare reduction directive declares a reduction-identifier that can be used in a reduction clause as a user-defined reduction. The directive argument reduction-specifier uses the following syntax:
reduction-identifier : typename-list : combiner
where reduction-identifier is a reduction identifier, typename-list is a type-name list, and combiner is an OpenMP combiner expression.
The reduction-identifier and the type identify the declare reduction directive. The reduction-identifier can later be used in a reduction clause that uses variables of the types specified in the declare reduction directive. If the directive specifies several types then the behavior is as if a declare reduction directive was specified for each type. The visibility and accessibility of a user-defined reduction are the same as those of a variable declared at the same location in the program.
The enclosing context of the combiner and of the initializer-expr that is specified by the initializer clause is that of the declare reduction directive. The combiner and the initializer-expr must be correct in the base language as if they were the body of a function defined at the same location in the program.
If the reduction-identifier is the same as the name of a user-defined operator or an extended operator, or the same as a generic name that is one of the allowed intrinsic procedures, and if the operator or procedure name appears in an accessibility statement in the same module, the accessibility of the corresponding declare reduction directive is determined by the accessibility attribute of the statement.
If the reduction-identifier is the same as a generic name that is one of the allowed intrinsic procedures and is accessible, and if it has the same name as a derived type in the same module, the accessibility of the corresponding declare reduction directive is determined by the accessibility of the generic name according to the base language.
Restrictions
Restrictions to the declare reduction directive are as follows:The typename-list must not declare new types.
Cross References