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

11.7  loop Construct

Name: loop

Association: loop-associated

Category: executable

Properties: work-distribution, worksharing, simdizable


bind, collapse, lastprivate, order, private, reduction


The bind clause determines the binding region, which determines the binding thread set.


A loop construct specifies that the logical iterations of the associated loops may execute concurrently and permits the encountering threads to execute the loop accordingly. A loop construct is a worksharing construct if its binding region is the innermost enclosing parallel region. Otherwise it is not a worksharing region. The directive asserts that the iterations of the associated loops may execute in any order, including concurrently. Each logical iteration is executed once per instance of the loop region that is encountered by exactly one thread that is a member of the binding thread set.

At the beginning of each logical iteration, the loop iteration variable or the variable declared by range-decl of each associated loop has the value that it would have if the set of the associated loops was executed sequentially.

If the order clause is not present, the behavior is as if an order clause that specifies concurrent appeared on the construct. The loop schedule for a loop construct is reproducible unless the order clause is present with the unconstrained order-modifier.

If the loop region binds to a teams region, the threads in the binding thread set may continue execution after the loop region without waiting for all logical iterations of the associated loops to complete. The iterations are guaranteed to complete before the end of the teams region. If the loop region does not bind to a teams region, all logical iterations of the associated loops must complete before the encountering threads continue execution after the loop region.

For the purpose of determining its consistency with other schedules, the schedule is defined by the implicit order clause. The schedule is reproducible if the schedule specified through the implicit order clause is reproducible.


Restrictions to the loop construct are as follows:

Cross References

  12.5.1  affinity Clause
  12.5.2  detach Clause