Intel® C++ Compiler 16.0 User and Reference Guide

linear Clause

Clause for several omp pragmas: Specifies that all variables in a list are private to a SIMD chunk and that they have a linear relationship within the iteration space of a loop.

linear (linear-list[:linear-step][, linear-list:[linear-step]...])

linear-step

Is a compile-time positive, integer, scalar constant expression. If linear-step is not specified, it is assumed to be 1.

linear-list

Takes one of the following forms:

  • list-item
  • modifier (list-item)

Where list is a formal parameter of the specified function or the C++ keyword this.

modifier-list

Determines how a list item is initialized. Possible values are:

ref

Specifies that the storage location of each list item on each lane corresponds to an array at the storage location upon entry to the function indexed by the logical number of the lane times linear-step.

val

Specifies that the value of each list item on each lane corresponds to the value of the list item upon entry to the function plus the logical number of the lane times linear-step.

uval

Similar to val, but each invocation uses the same storage location for each SIMD lane. This storage location is updated with the final value of the logically last lane.

The behavior of the linear clause is dependent on when the clause is specified and whether or not a modifier is specified.

When a linear clause is specified on a construct:

When a linear clause is specified on a declarative directive:

When the ref modifier is specified:

When the uval modifier is specified:

When no modifier is specified or the val or uval modifier is specified:

If modifier is not specified, or if the val or uval modifier is specified, the value of each list item on each lane is the sum of the list item upon entry to the function added to the logical number of the lane, multiplied by linear-step.

You can only use ref, val, or uval if the list item is of a reference type.

If a list item appears without the ref modifier in a linear clause, the list item must be of integral or pointer type, or must be a reference to an integral or pointer type. Additionally, when a list item is of a reference type and appears without the ref modifier, if any write to the list item occurs before any read of the list item, the result is unspecified

A list item in a linear clause on a worksharing construct with a reference type must bind to the same object for all threads of the team. This restriction does not apply to pragma omp declare simd.