インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

TASKLOOP

OpenMP* Fortran Compiler Directive: Specifies that the iterations of one or more associated DO loops should be executed in parallel using OpenMP* tasks. The iterations are distributed across tasks that are created by the construct and scheduled to be executed.

Syntax

!$OMP TASKLOOP [clause[[,] clause]... ]

   do-loop

[!$OMP END TASKLOOP]

clause

Is one of the following:

do-loop

Is one or more DO iterations (DO loops). The DO iteration cannot be a DO WHILE or a DO loop without loop control. The DO loop iteration variable must be of type integer.

If an END TASKLOOP directive follows a DO construct in which several loop statements share a DO termination statement, then the directive can only be specified for the outermost of these DO statements. The TASKLOOP construct inherits the restrictions of the loop construct.

If any of the loop iteration variables would otherwise be shared, they are implicitly made private for the loop-iteration tasks created by the TASKLOOP construct. Unless the loop iteration variables are specified in a LASTPRIVATE clause on the TASKLOOP construct, their values after the loop are unspecified.

You cannot branch out of a DO loop associated with a TASKLOOP directive.

If you do not specify GRAINSIZE or NUM_TASKS, the number of loop tasks created and the number of logical loop iterations assigned to these tasks is implementation defined. The GRAINSIZE clause and NUM_TASKS clauses are mutually exclusive; they cannot appear in the same TASKLOOP directive.

The binding thread set of the TASKLOOP region is the current team. A TASKLOOP region binds to the innermost enclosing parallel region.

When a thread encounters a TASKLOOP construct, the construct partitions the associated loops into tasks for parallel execution of the loop iterations. The data environment of the created tasks is created according to the clauses specified in the TASKLOOP construct, any data environment ICVs, and any defaults that apply. The order of the creation of the loop tasks is unspecified. Programs that rely on any execution order of the logical loop iterations are non-conforming.

If used, the END TASKLOOP directive must appear immediately after the end of the loop. If you do not specify an END TASKLOOP directive, an END TASKLOOP directive is assumed at the end of the do-loop.

By default, the TASKLOOP construct executes as if it was enclosed in a TASKGROUP construct with no statements or directives outside of the TASKLOOP construct. Therefore, the TASKLOOP construct creates an implicit TASKGROUP region.

When a REDUCTION clause appears in a TASKLOOP construct, it behaves as if a TASK_REDUCTION clause was applied to the implicit TASKGROUP construct enclosing the TASKLOOP construct. For each task that is generated by the TASKLOOP construct, an IN_REDUCTION clause with the same reduction operator and the same list items that appear in the REDUCTION clause is applied to the task.

When an IN_REDUCTION clause appears in a TASKLOOP construct, an IN_REDUCTION clause with the same reduction operation and the same list items of the IN_REDUCTION clause is applied to the generated tasks.

The following restrictions also apply:

See Also