mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-18 12:10:53 +01:00
16 lines
569 B
TeX
16 lines
569 B
TeX
\section{\code{linear} Clause in Loop Constructs}
|
|
\label{sec:linear_in_loop}
|
|
\index{clauses!linear@\code{linear}}
|
|
\index{linear clause@\code{linear} clause}
|
|
|
|
The following example shows the use of the \code{linear} clause in a loop
|
|
construct to allow the proper parallelization of a loop that contains
|
|
an induction variable (\plc{j}). At the end of the execution of
|
|
the loop construct, the original variable \plc{j} is updated with
|
|
the value \plc{N/2} from the last iteration of the loop.
|
|
|
|
\cexample[4.5]{linear_in_loop}{1}
|
|
|
|
\ffreeexample[4.5]{linear_in_loop}{1}
|
|
|