DO CONCURRENT

Statement: Specifies that there are no data dependencies between the iterations of a DO loop. It takes the following form:

Syntax

DO[,] CONCURRENT forall-header

forall-header

Is ( [ type :: ] forall-spec [, mask-expr] )

type

(Optional) Is an integer data type.

forall-spec

Is an assignment using a triplet specification in the form index-name = forall-limit : forall-limit [ : forall-step]

index-name

Is a named scalar variable of type integer. It becomes defined when the index-name value set is evaluated. It has the scope of the construct.

forall-limit

Is a scalar integer expression.

forall-step

(Optional) Is a scalar integer expression.

mask-expr

(Optional) Is a mask expression that is scalar and of type logical.

The DO CONCURRENT range is executed for every active combination of the index-name values.

Each execution of the range is an iteration. The executions can occur in any order.

When all of the iterations have completed execution, the loop terminates, and the DO construct becomes inactive.

When the DO CONCURRENT construct terminates, a variable that is defined or becomes undefined during more than one iteration of the construct becomes undefined.

Execution of a CYCLE statement that belongs to a DO CONCURRENT construct completes execution of that iteration of the construct.

A branch within a DO CONCURRENT construct must not have a branch target that is outside the construct.

If type appears, the index-name has the specified type and type parameters. Otherwise, it has the type and type parameters that it would have if it were the name of a variable in the innermost executable construct or scoping unit.

If type does not appear, the index-name must not be the same as a local identifier, an accessible global identifier, or an identifier of an outer construct entity, except for a common block name or a scalar variable name.

The index-name of a contained FORALL or DO CONCURRENT construct must not be the same as an index-name of any of its containing FORALL or DO CONCURRENT constructs.

The following cannot appear in a DO CONCURRENT construct:

An EXIT statement must not appear within a DO CONCURRENT construct if it belongs to that construct or an outer construct.

The following are additional rules for DO CONCURRENT constructs:

The restrictions on referencing variables defined in an iteration of a DO CONCURRENT construct also apply to any procedure invoked within the loop.

These restrictions ensure no interdependencies occur that might affect code optimizations.

Note that if compiler option -parallel (Linux and Mac OS X) or /Qparallel (Windows) is specified, the compiler will attempt to parallelize the construct.

Example

The following shows a DO CONCURRENT construct:

REAL :: Q
   DO CONCURRENT (I = 1:N)
      Q = B(I) + C(I)
      D(I) = Q + SIN(Q) + 2
   END DO

Submit feedback on this help topic

Copyright © 1996-2010, Intel Corporation. All rights reserved.