Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

DEPEND Clause

Parallel Directive Clause: Enforces additional constraints on the scheduling of a task or loop iterations by enabling dependences between sibling tasks in the task region.

Syntax

It takes one of the following forms:

In Synchronization Directive !$OMP ORDERED

DEPEND (SOURCE) -or-

DEPEND (SINK:vec)

The above forms of the DEPEND clause have been deprecated and replaced by the DOACROSS clause in the ORDERED construct.

In all other directives:

DEPEND ([depend-modifier,] dependence-type : locator-list)

depend-modifier

ITERATOR clause modifier

dependence-type

Can be any one of the following clauses: IN, OUT, or INOUT, MUTEXINOUTSET, INOUTSET, or DEPOBJ. Clauses MUTEXINOUTSET, INOUTSET, and DEPOBJ are only supported for ifx.

locator

If dependence-type is DEPOBJ, locator must be a depend object in the initialized state.

Otherwise, it is a variable or a non-zero length array section. Zero-sized arrays and common block names are not permitted as locator-list items.

Any locator-list item used in a DEPEND clause of the same task or sibling tasks must indicate identical storage or disjoint storage; partial overlap is not permitted. Two locators match if their storage locations are the same, or if the OpenMP reserved locator symbol OMP_ALL_MEMORY appears in the list; in that case, all list items match.

If dependence-type is OUT or INOUT, locator must not be the OpenMP reserved locator OMP_ALL_MEMORY.

The behavior is undefined in these cases:

  • If locator has the POINTER attribute and its association status is disassociated or undefined

  • If locator has the ALLOCATABLE attribute and its allocation status is unallocated

Note that this enforced task dependence establishes a synchronization of accesses to each locator-list item performed by a dependent task, with respect to accesses to the same locator-list item performed by any previous tasks. You must properly synchronize access with respect to other concurrent accesses to each locator-list item.

SOURCE

Specifies the satisfaction of cross-iteration dependences that arise from the current iteration.

SINK

Specifies a cross-iteration dependence, where the iteration vector vec indicates the iteration that satisfies the dependence.

vec

Is the iteration vector. It has the form:

where n is the value specified by the ORDERED clause in the DO loop directive, xi denotes the loop iteration variable of the i-th nested loop associated with the loop directive, and di is a non-negative integer scalar constant.

If vec does not occur in the iteration space, the DEPEND clause is ignored. Note that if vec does not indicate a lexicographically earlier iteration, it can cause a deadlock.

For a vec element form of xi + di or xi - di, the expression xi + di or xi - di for any value of the integer loop iteration variable xi that can encounter the ordered construct must be computable in the loop iteration variable's type without overflow.

Rules related to sibling task dependency:

  • The generated task is a dependent task of the sibling task if any of the following are true:

    • If one or more locator-list items specified in dependence-type IN matches a locator-list item appearing in any of the following DEPEND clause dependence-types on a construct that previously generated a sibling task: OUT, INOUT, MUTEXINOUTSET, or INOUTSET.

    • If one or more locator-list items specified in dependence-type OUT or INOUT matches a locator-list item appearing in any of the following DEPEND clause dependence-types on a construct that previously generated a sibling task: IN, OUT, INOUT, MUTEXINOUTSET, or INOUTSET.

    • If one or more locator-list items specified in dependence-type INOUTSET matches a locator-list item appearing in any of the following DEPEND clause dependence-types on a construct that previously generated a sibling task: IN, OUT, INOUT, or MUTEXINOUTSET.

    • If one or more locator-list items specified in dependence-type MUTEXINOUTSET matches a locator-list item appearing in any of the following DEPEND clause dependence-types on a construct that previously generated a sibling task: IN, OUT, INOUT, or INOUTSET.

  • The sibling tasks are mutually exclusive if the following is true:

    • If one or more locator-list items specified in dependence-type MUTEXINOUTSET matches a locator-list item appearing in a DEPEND clause with MUTEXINOUTSET dependence-type on a different task generating construct and both constructs generate sibling tasks.

When dependence-type is DEPOBJ, the locators must all be depend objects. The dependence-types are derived from the depend objects. For each depend object, the behavior is as if the current construct contained the DEPEND clause of the most recently executed DEPOBJ construct that initialized or updated the depend object.

If a DEPEND clause appears in a TARGET or TARGET UPDATE directive, it is treated as if it had appeared on the implicit task construct that encloses the TARGET construct.

See Also