OpenMP-Examples/Examples_ordered.tex

29 lines
854 B
TeX

\pagebreak
\section{The \code{ordered} Clause and the \code{ordered} Construct}
\label{sec:ordered}
Ordered constructs are useful for sequentially ordering the output from work that
is done in parallel. The following program prints out the indices in sequential
order:
\cexample{ordered}{1}
\fexample{ordered}{1}
It is possible to have multiple \code{ordered} constructs within a loop region
with the \code{ordered} clause specified. The first example is non-conforming
because all iterations execute two \code{ordered} regions. An iteration of a
loop must not execute more than one \code{ordered} region:
\cexample{ordered}{2}
\fexample{ordered}{2}
The following is a conforming example with more than one \code{ordered} construct.
Each iteration will execute only one \code{ordered} region:
\cexample{ordered}{3}
\fexample{ordered}{3}