Visible to Intel only — GUID: GUID-7562368A-9222-46D8-8D1F-89F01450BD13
Visible to Intel only — GUID: GUID-7562368A-9222-46D8-8D1F-89F01450BD13
IN_REDUCTION
Parallel Directive Clause: Specifies that a task participates in a reduction. The IN_REDUCTION clause is a reduction participating clause.
Syntax
IN_REDUCTION (reduction-identifier : list)
reduction identifier and list |
These are defined in the REDUCTION clause description. All the common restrictions for the REDUCTION clause apply to the IN_REDUCTION clause. |
A list item that appears in an IN_REDUCTION clause must appear in a TASK_REDUCTION clause or a REDUCTION clause with the TASK reduction modifier. The construct associated with the innermost region that meets this condition must specify the same reduction-identifier as the IN_REDUCTION clause.
If the IN_REDUCTION clause appears in a TARGET construct, the target task becomes the task participating in the reduction. A private copy of each list item is created in the data environment of the target task. The copy is implicitly mapped into the data environment of the target device if the target device is not the parent device.
If the IN_REDUCTION clause is associated with a TASK construct, the generated task is the participating task, and a private copy of each list item may be created.
At the end of the region, the value of private copies of list items are combined with the value of a private copy created by a reduction scoping clause, and finally with the original list item.
The list items specified in an IN_REDUCTION clause must match the list items that appear in a TASK_REDUCTION clause or in a REDUCTION clause with the TASK reduction modifier. The construct specifying the TASK_REDUCTION or REDUCTION clause corresponds to a region in which the participating task’s region is closely nested. The innermost enclosing construct that meets this condition must also specify the same reduction-identifier specified in the IN_REDUCTION clause.
In the following example, the IN_REDUCTION clause at (3) must name the same operator (+) and variable (a) as in the TASK_REDUCTION clause in (2). The IN_REDUCTION clause at (4) must name the same operator (*) and variable (a) as in the TASK_REDUCTION clause in (1).
!$omp taskgroup task_reduction(*:a) ! (1) *:a ... !$omp taskgroup task_reduction(+:a) ! (2) +:a !$omp task in_reduction(+:a) ! (3) +:a matches (2) a = a + x !$omp end task ! ends (3) +:a ... !$omp end taskgroup ! ends (2) +:a ... !$omp task in_reduction(*:a) ! (4) *:a matches (1) a = a * y !$omp end task ! ends (4) *:a !$omp end taskgroup ! ends (1) *:a