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

5.5.5  Properties Common to All Reduction Clauses

The clause-specification of a reduction clause has a clause-argument-specification that specifies an OpenMP variable list argument and has a required reduction-identifier modifier that specifies the reduction identifier to use for the reduction. The reduction identifier must match a previously declared reduction identifier of the same name and type for each of the list items. This match is done by means of a name lookup in the base language.

The list items that appear in a reduction clause may include array sections.

If the type is a derived class then any reduction identifier that matches its base classes is also a match if no specific match for the type has been specified.

If the reduction identifier is not an id-expression then it is implicitly converted to one by prepending the keyword operator (for example, + becomes operator+).

If the reduction identifier is qualified then a qualified name lookup is used to find the declaration.

If the reduction identifier is unqualified then an argument-dependent name lookup must be performed using the type of each list item.

If a list item is an array or array section, it will be treated as if a reduction clause would be applied to each separate element of the array section.

If a list item is an array section, the elements of any copy of the array section will be stored contiguously.

If the original list item has the POINTER attribute, any copies of the list item are associated with private targets.

Any copies of a list item associated with the reduction are initialized with the initializer value of the reduction identifier. Any copies are combined using the combiner associated with the reduction identifier.

Execution Model Events

The reduction-begin event occurs before a task begins to perform loads and stores that belong to the implementation of a reduction and the reduction-end event occurs after the task has completed loads and stores associated with the reduction. If a task participates in multiple reductions, each reduction may be bracketed by its own pair of reduction-begin/reduction-end events or multiple reductions may be bracketed by a single pair of events. The interval defined by a pair of reduction-begin/reduction-end events may not contain a task scheduling point.

Tool Callbacks

A thread dispatches a registered ompt_callback_reduction with ompt_sync_region_reduction in its kind argument and ompt_scope_begin as its endpoint argument for each occurrence of a reduction-begin event in that thread. Similarly, a thread dispatches a registered ompt_callback_reduction with ompt_sync_region_reduction in its kind argument and ompt_scope_end as its endpoint argument for each occurrence of a reduction-end event in that thread. These callbacks occur in the context of the task that performs the reduction and has the type signature ompt_callback_sync_region_t.

Restrictions

Restrictions common to reduction clauses are as follows:

Cross References