OpenMP-Examples/Examples_parallel_master_taskloop.tex
2020-06-26 07:54:45 -07:00

34 lines
1.5 KiB
TeX

\pagebreak
\section{The \code{parallel master taskloop} Construct}
\label{sec:parallel_master_taskloop}
In the OpenMP 5.0 Specification several combined constructs containing
the \code{taskloop} construct were added.
Just as the \code{for} and \code{do} constructs have been combined
with the \code{parallel} construct for convenience, so too, the combined
\code{parallel}~\code{master}~\code{taskloop} and
\code{parallel}~\code{master}~\code{taskloop}~\code{simd}
constructs have been created for convenience.
In the following example the first \code{taskloop} construct is enclosed
by the usual \code{parallel} and \code{master} constructs to form
a team of threads, and a single task generator (master 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{master}~\code{taskloop}
combined construct.
The third taskloop uses the combined \code{parallel}~\code{master}~\code{taskloop}~\code{simd}
construct to accomplish the same behavior as closely nested \code{parallel master},
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{master} construct
with the \code{taskloop} or \code{taskloop}~\code{simd} construct produces no additional
restrictions.
\cexample[5.0]{parallel_master_taskloop}{1}
\ffreeexample[5.0]{parallel_master_taskloop}{1}