OpenMP-Examples/parallel_execution/linear_in_loop.tex
2022-04-18 15:02:25 -07:00

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}