21 #ifndef GRPPI_OMP_PARALLEL_EXECUTION_OMP_H 22 #define GRPPI_OMP_PARALLEL_EXECUTION_OMP_H 26 #include "../common/mpmc_queue.h" 28 #include <type_traits> 68 concurrency_degree_{concurrency_degree},
71 omp_set_num_threads(concurrency_degree_);
78 concurrency_degree_ = degree;
79 omp_set_num_threads(concurrency_degree_);
86 return concurrency_degree_;
118 template <
typename T>
120 return {queue_size_, queue_mode_};
130 result = omp_get_thread_num();
144 static int impl_concurrency_degree() {
148 result = omp_get_num_threads();
155 int concurrency_degree_;
159 constexpr
static int default_queue_size = 100;
160 int queue_size_ = default_queue_size;
169 template <
typename E>
171 return std::is_same<E, parallel_execution_omp>::value;
178 template <
typename E>
192 #else // GRPPI_OMP undefined 206 template <
typename E>
215 template <
typename E>
Definition: callable_traits.h:24
parallel_execution_omp(int concurrency_degree, bool order=true) noexcept
Set num_threads to _threads in order to run in parallel.
Definition: parallel_execution_omp.h:67
bool is_ordered() const noexcept
Is execution ordered.
Definition: parallel_execution_omp.h:102
constexpr bool is_supported()
Metafunction that determines if type E is supported in the current build.
void disable_ordering() noexcept
Disable ordering.
Definition: parallel_execution_omp.h:97
parallel_execution_omp() noexcept
Default construct an OpenMP parallel execution policy.
Definition: parallel_execution_omp.h:51
int get_thread_id() const noexcept
Get index of current thread in the thread table.
Definition: parallel_execution_omp.h:126
constexpr bool is_supported< parallel_execution_omp >()
Specialization stating that parallel_execution_omp is supported. This metafunction evaluates to false...
Definition: parallel_execution_omp.h:186
constexpr bool is_parallel_execution_omp()
Metafunction that determines if type E is parallel_execution_omp.
Definition: parallel_execution_omp.h:170
queue_mode
Definition: mpmc_queue.h:35
Definition: mpmc_queue.h:38
mpmc_queue< T > make_queue() const
Makes a communication queue for elements of type T.
Definition: parallel_execution_omp.h:119
void set_concurrency_degree(int degree) noexcept
Set number of grppi threads.
Definition: parallel_execution_omp.h:77
void enable_ordering() noexcept
Enable ordering.
Definition: parallel_execution_omp.h:92
OpenMP parallel execution policy.
Definition: parallel_execution_omp.h:40
int concurrency_degree() const noexcept
Get number of grppi trheads.
Definition: parallel_execution_omp.h:85
void set_queue_attributes(int size, queue_mode mode) noexcept
Sets the attributes for the queues built through make_queue<T>(()
Definition: parallel_execution_omp.h:107