Skip to content

Commit

Permalink
More remarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Dec 21, 2024
1 parent c1a2404 commit e65fb4e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions openmp.tex
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,10 @@ \subsection{Summation with Parallel Regions}
parallel region where each thread processes a chunk of the input and
writes a result to its corresponding element to the results array,
then after the final region we have a sequential loop that aggregates
the results array to a single final result.
the results array to a single final result. Since this final loop only
has one iteration per thread, which is usually a very low number (and
s constant irrespective of the input size), sequential execution poses
no performance problem in this case.

\Cref{lst:openmp-partition-sum} shows an implementation of vector
summation using this technique. The integer array \texttt{sums}
Expand Down Expand Up @@ -800,7 +803,7 @@ \subsection{Filtering with parallel regions}
return p;
\end{lstlisting}

Although it only runs for \texttt{P} iterations, the \texttt{memcpy}
Although it only runs for \texttt{P} iterations, the \texttt{memcpy()}
operation is likely to be expensive. Because this loop both reads and
writes the output index \texttt{p}, it \emph{must} be sequential. For
some filtering problems this may be acceptable: if we expect that the
Expand Down

0 comments on commit e65fb4e

Please sign in to comment.