Standard: F77 F90 F95 F2003 F2008 F2018 Example program


A DO CONCURRENT construct is a DO construct that begins with a DO CONCURRENT statement. The syntax of a DO CONCURRENT statement is as follows:
      [ do-construct-name : ] DO [ label ] [ , ] CONCURRENT concurrent-header
where concurrent-header is
      ( [ integer-type-spec :: ] concurrent-control-list [ , mask-expr ] )
where concurrent-control-list is a comma-separated list of concurrent-control, which is
      index-name = expr1 : expr2 [ : expr3 ]

Each expression exprn must be scalar integer, and the mask-expr (if present) must be scalar logical.


A DO CONCURRENT construct is a DO loop with restrictions and semantics intended to allow efficient execution. The iterations of a DO CONCURRENT construct may be executed in any order, and possibly even in parallel.

Each loop index variable (index-name) is local to the construct; if integer-type-spec appears, each index-name has that type and kind, otherwise it has the type and kind of a variable with the same name outside the construct (and that type shall be Integer). The set of values of a concurrent-control has size
      N = MAX( 0, (expr1expr2 ) ÷ expr3)
where expr3 is equal to 1 if it is not present. The index variable of a concurrent-control takes on the values in the set
      { it{expr}1+(i−1)×expr3, for i = 1 to N }

The set of iterations of a DO CONCURRENT construct is the set of all possible index variable value combinations implied by the concurrent-controls. If there is a mask-expr, only those iterations for which the mask-expr is true are executed.

The restrictions on the DO CONCURRENT construct are:


DO construct, FORALL construct, INTEGER type, PURE attribute