ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::StdParExecutor< Policy > Class Template Reference

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

Detailed description

template<class Policy = std::execution::parallel_policy>
requires ( std::is_execution_policy_v< Policy > && ! std::is_same_v< Policy , std::execution::parallel_unsequenced_policy > )
class ADS::StdParExecutor< Policy >

the executor on a policy of the parallel algorithms of the standard library

Constructor and destructor documentation

◆ StdParExecutor()

template<class Policy = std::execution::parallel_policy>
ADS::StdParExecutor< Policy >::StdParExecutor ( std::size_t p = 0)
inlineexplicit

the executor of the policy, which tells the algorithms of ADS that it has \( p \) threads (the hardware threads if \( p = 0 \))

Member function documentation

◆ bulk()

template<class Policy = std::execution::parallel_policy>
template<class F>
void ADS::StdParExecutor< Policy >::bulk ( std::size_t n,
F && f )
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}} \]

◆ concurrency()

template<class Policy = std::execution::parallel_policy>
std::size_t ADS::StdParExecutor< Policy >::concurrency ( void ) const
inlinenodiscard

the number of threads given to the constructor


The documentation for this class was generated from the following file: