21 #ifndef GRPPI_TBB_PARALLEL_EXECUTION_TBB_H 22 #define GRPPI_TBB_PARALLEL_EXECUTION_TBB_H 26 #include "../common/mpmc_queue.h" 28 #include <type_traits> 61 concurrency_degree_{concurrency_degree},
104 template <
typename T>
106 return {queue_size_, queue_mode_};
112 int tokens() const noexcept {
return num_tokens_; }
116 constexpr
static int default_concurrency_degree = 4;
117 int concurrency_degree_ = default_concurrency_degree;
119 bool ordering_ =
true;
121 constexpr
static int default_queue_size = 100;
122 int queue_size_ = default_queue_size;
124 constexpr
static int default_num_tokens_ = 100;
125 int num_tokens_ = default_num_tokens_;
134 template <
typename E>
136 return std::is_same<E, parallel_execution_tbb>::value;
143 template <
typename E>
158 #else // GRPPI_TBB not defined 172 template <
typename E>
181 template <
typename E>
Definition: callable_traits.h:24
constexpr bool is_supported< parallel_execution_tbb >()
Specialization stating that parallel_execution_tbb is supported. This metafunction evaluates to false...
Definition: parallel_execution_tbb.h:151
constexpr bool is_supported()
Metafunction that determines if type E is supported in the current build.
int tokens() const noexcept
Definition: parallel_execution_tbb.h:112
void disable_ordering() noexcept
Disable ordering.
Definition: parallel_execution_tbb.h:83
constexpr bool is_parallel_execution_tbb()
Metafunction that determines if type E is parallel_execution_tbb.
Definition: parallel_execution_tbb.h:135
queue_mode
Definition: mpmc_queue.h:35
void set_concurrency_degree(int degree) noexcept
Set number of grppi threads.
Definition: parallel_execution_tbb.h:68
void set_queue_attributes(int size, queue_mode mode, int tokens) noexcept
Sets the attributes for the queues built through make_queue<T>()
Definition: parallel_execution_tbb.h:93
Definition: mpmc_queue.h:38
mpmc_queue< T > make_queue() const
Makes a communication queue for elements of type T. Constructs a queue using the attributes that can ...
Definition: parallel_execution_tbb.h:105
parallel_execution_tbb() noexcept
Default construct a TBB parallel execution policy.
Definition: parallel_execution_tbb.h:48
parallel_execution_tbb(int concurrency_degree, bool order=true) noexcept
Constructs a TBB parallel execution policy.
Definition: parallel_execution_tbb.h:60
TBB parallel execution policy.
Definition: parallel_execution_tbb.h:37
int concurrency_degree() const noexcept
Get number of grppi trheads.
Definition: parallel_execution_tbb.h:73
bool is_ordered() const noexcept
Is execution ordered.
Definition: parallel_execution_tbb.h:88
void enable_ordering() noexcept
Enable ordering.
Definition: parallel_execution_tbb.h:78