|
ADS
Algorithms and Data Structures
|
the executor on a policy of the parallel algorithms of the standard library More...
#include <ADS/interop/parallel/StdParExecutor.h>
Public member functions | |
| StdParExecutor (std::size_t p=0) | |
| the executor of the policy, which tells the algorithms of ADS that it has \( p \) threads (the hardware threads if \( p = 0 \)) | |
| std::size_t | concurrency (void) const |
| the number of threads given to the constructor | |
| template<class F> | |
| void | bulk (std::size_t n, F &&f) |
| the calls \( f( 0 ) , \ldots , f( n - 1 ) \) by the std::for_each of the policy | |
the executor on a policy of the parallel algorithms of the standard library
|
inlineexplicit |
the executor of the policy, which tells the algorithms of ADS that it has \( p \) threads (the hardware threads if \( p = 0 \))
|
inline |
the calls \( f( 0 ) , \ldots , f( n - 1 ) \) by the std::for_each of the policy
In pseudocode (beyond the book):
\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{bulk}( n , f ) \cr 2 & \quad \textbf{if}\ n \le 1\ \textbf{or}\ p = 1\ \textbf{then} \ \textbf{for}\ i \gets 0\ \textbf{to}\ n - 1\ \textbf{do}\ f( i ) \cr 3 & \quad \textbf{else}\ \mathrm{std{::}for\_each}( \mathit{policy} , 0 , n , i \mapsto \textbf{if}\ \text{no call has thrown} \ \textbf{then}\ f( i ) ) \cr 4 & \quad \text{throw again the first exception of the calls, if any} \end{array}} \]
|
inlinenodiscard |
the number of threads given to the constructor