mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-23 22:31:22 +01:00
32 lines
1.4 KiB
TeX
32 lines
1.4 KiB
TeX
\pagebreak
|
|
\section{Combined \code{parallel} \code{masked} and \code{taskloop} Constructs}
|
|
\label{sec:parallel_masked_taskloop}
|
|
|
|
Just as the \code{for} and \code{do} constructs were combined
|
|
with the \code{parallel} construct for convenience, so too, the combined
|
|
\code{parallel}~\code{masked}~\code{taskloop} and
|
|
\code{parallel}~\code{masked}~\code{taskloop}~\code{simd}
|
|
constructs have been created for convenience when using the
|
|
\code{taskloop} construct.
|
|
|
|
In the following example the first \code{taskloop} construct is enclosed
|
|
by the usual \code{parallel} and \code{masked} constructs to form
|
|
a team of threads, and a single task generator (primary thread) for
|
|
the \code{taskloop} construct.
|
|
|
|
The same OpenMP operations for the first taskloop are accomplished by the second
|
|
taskloop with the \code{parallel}~\code{masked}~\code{taskloop}
|
|
combined construct.
|
|
The third taskloop uses the combined \code{parallel}~\code{masked}~\code{taskloop}~\code{simd}
|
|
construct to accomplish the same behavior as closely nested \code{parallel masked},
|
|
and \code{taskloop simd} constructs.
|
|
|
|
As with any combined construct the clauses of the components may be used
|
|
with appropriate restrictions. The combination of the \code{parallel}~\code{masked} construct
|
|
with the \code{taskloop} or \code{taskloop}~\code{simd} construct produces no additional
|
|
restrictions.
|
|
|
|
\cexample[5.1]{parallel_masked_taskloop}{1}
|
|
|
|
\ffreeexample[5.1]{parallel_masked_taskloop}{1}[1]
|