Intel® Fortran Compiler 17.0 Developer Guide and Reference
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.
!$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.
By default, the TASKLOOP construct executes as if it was enclosed in a TASKLOOP construct with no statements or directives outside of the TASKLOOP construct. This means that unless NOGROUP is specified, the TASKLOOP construct creates an implicit taskgroup.
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.
The following restrictions also apply:
A program that branches into or out of a TASKLOOP region is non-conforming.
All loops associated with the TASKLOOP construct must be perfectly nested. There must be no intervening code nor any other OpenMP* directive between any two loops.