OpenMP-Examples/tasking/parallel_masked_taskloop.tex
2024-04-16 08:59:23 -07:00

43 lines
1.9 KiB
TeX

%\pagebreak
\section{Combined \kcode{parallel masked} and \kcode{taskloop} Constructs}
\label{sec:parallel_masked_taskloop}
\index{combined constructs!parallel masked taskloop@\kcode{parallel masked taskloop}}
\index{combined constructs!parallel masked taskloop simd@\kcode{parallel masked taskloop simd}}
\index{constructs!parallel@\kcode{parallel}}
\index{constructs!masked@\kcode{masked}}
\index{constructs!taskloop@\kcode{taskloop}}
\index{constructs!simd@\kcode{simd}}
\index{parallel construct@\kcode{parallel} construct}
\index{masked construct@\kcode{masked} construct}
\index{taskloop construct@\kcode{taskloop} construct}
\index{simd construct@\kcode{simd} construct}
Just as the \kcode{for} and \kcode{do} constructs were combined
with the \kcode{parallel} construct for convenience, so too, the combined
\kcode{parallel masked taskloop} and
\kcode{parallel masked taskloop simd}
constructs have been created for convenience when using the
\kcode{taskloop} construct.
In the following example the first \kcode{taskloop} construct is enclosed
by the usual \kcode{parallel} and \kcode{masked} constructs to form
a team of threads, and a single task generator (primary thread) for
the \kcode{taskloop} construct.
The same OpenMP operations for the first taskloop are accomplished by the second
taskloop with the \kcode{parallel masked taskloop}
combined construct.
The third taskloop uses the combined \kcode{parallel masked taskloop simd}
construct to accomplish the same behavior as closely nested \kcode{parallel masked},
and \kcode{taskloop simd} constructs.
As with any combined construct the clauses of the components may be used
with appropriate restrictions. The combination of the \kcode{parallel masked} construct
with the \kcode{taskloop} or \kcode{taskloop simd} construct produces no additional
restrictions.
\cexample[5.1]{parallel_masked_taskloop}{1}
\clearpage
\ffreeexample[5.1]{parallel_masked_taskloop}{1}