28 struct thread_pool_base<DM, Ps, PTT, Pt>::execution_context_stack final :
public private_::
execution_context_stack_type<work_distribution_mode, pool_traits_type::result_traits_, thread_pool_base, InpWk> {
51 struct thread_pool_base<DM, Ps, PTT, Pt>::create_direct final :
public private_::create_direct<pool_traits_type, InpWk, PtrFnType, &std::remove_reference<InpWk>::type::process> {
54 using closure_t=
typename base_t::closure_t;
62 typedef typename thread_pool_base<DM, Ps, PTT, Pt>::
template execution_context_stack<InpWk> execution_context_stack;
75 class thread_pool_base<DM, Ps, PTT, Pt>::for_each_t {
77 typedef Fn operation_type;
79 typedef create_direct<work_type> creator_t;
80 typedef subdivide_n_gen_wk1<size_mode, thread_pool_base,
typename creator_t::closure_t, one_container<Colln>, alg_wk_wrap::for_each_reduce> gen_wk_t;
93 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type> execution_context;
99 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
100 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
101 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
102 && Colln::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
103 ? ppd::generic_traits::memory_access_modes::crew_memory_access
104 : ppd::generic_traits::memory_access_modes::erew_memory_access
107 __stdcall for_each_t(thread_pool_base &p, Colln
const &c, operation_type
const &f)
noexcept(
true)
FORCE_INLINE
108 : pool(p), colln(c), fn(f) {
116 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
117 return execution_context(
120 typename execution_context::thread_wk_t::closure_t::argument_type(fn),
121 init_num_jobs_par_alg_other,
122 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type(colln),
124 default_num_subranges
129 thread_pool_base &pool;
131 operation_type
const &fn;
144 class thread_pool_base<DM, Ps, PTT, Pt>::count_if_t {
146 typedef Pred operation_type;
149 typedef typename os_traits::lock_traits::
template atomic_counter_type<
typename Colln::size_type> num_elems_ct_t;
151 typedef create_direct<work_type> creator_t;
152 typedef subdivide_n_gen_wk1<size_mode, thread_pool_base,
typename creator_t::closure_t, one_container<Colln>, alg_wk_wrap::count_if_reduce> gen_wk_t;
165 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type, deref::extra_deref, core_work_result::to_zero> execution_context;
171 num_elems_ct_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
172 && work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
173 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
174 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
175 && Colln::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
176 ? ppd::generic_traits::memory_access_modes::crew_memory_access
177 : ppd::generic_traits::memory_access_modes::erew_memory_access
185 BOOST_MPL_ASSERT((std::is_same<
typename execution_context::result_type::value_type,
typename Colln::size_type>));
187 __stdcall count_if_t(thread_pool_base &p, Colln
const &c, operation_type
const &pr)
noexcept(
true)
FORCE_INLINE
188 : pool(p), colln(c), pred(pr) {
196 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
197 return execution_context(
199 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(
"count_if", cfg_parms),
200 typename execution_context::thread_wk_t::closure_t::argument_type(pred),
201 init_num_jobs_par_alg_other,
202 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type(colln),
204 default_num_subranges
209 thread_pool_base &pool;
211 operation_type
const pred;
223 struct thread_pool_base<DM, Ps, PTT, Pt>::count_t
224 :
public thread_pool_base<DM, Ps, PTT, Pt>::
template count_if_t<
227 std::bind(
std::equal_to<
typename Colln::value_type>(),
typename Colln::value_type(),
std::placeholders::_1)
233 std::bind(
std::equal_to<
typename Colln::value_type>(),
typename Colln::value_type(),
std::placeholders::_1)
236 typedef typename base_t::execution_context execution_context;
238 __stdcall count_t(thread_pool_base &p, Colln
const &c,
typename Colln::value_type
const &v)
noexcept(
true)
FORCE_INLINE
239 : base_t(p, c,
typename base_t::operation_type(
std::equal_to<
typename Colln::value_type>(), v,
std::placeholders::_1)) {
253 class thread_pool_base<DM, Ps, PTT, Pt>::find_if_t {
255 typedef Pred operation_type;
260 typedef create_direct<work_type> creator_t;
261 typedef subdivide_n_gen_wk1<size_mode, thread_pool_base,
typename creator_t::closure_t, one_container<Colln>, alg_wk_wrap::find_if_reduce> gen_wk_t;
274 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type, deref::extra, core_work_result::to_false> execution_context;
280 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
281 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
282 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
283 && Colln::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
284 ? ppd::generic_traits::memory_access_modes::crew_memory_access
285 : ppd::generic_traits::memory_access_modes::erew_memory_access
288 __stdcall find_if_t(thread_pool_base &p, Colln
const &c, operation_type
const &pr)
noexcept(
true)
FORCE_INLINE
289 : pool(p), colln(c), pred(pr) {
299 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
300 return execution_context(
302 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(
"find_if", cfg_parms),
303 typename execution_context::thread_wk_t::closure_t::argument_type(pred),
304 init_num_jobs_par_alg_other,
305 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type(colln),
307 default_num_subranges
312 thread_pool_base &pool;
314 operation_type
const pred;
326 struct thread_pool_base<DM, Ps, PTT, Pt>::find_t
327 :
public thread_pool_base<DM, Ps, PTT, Pt>::
template find_if_t<
330 std::bind(
std::equal_to<
typename Colln::value_type>(),
typename Colln::value_type(),
std::placeholders::_1)
336 std::bind(
std::equal_to<
typename Colln::value_type>(),
typename Colln::value_type(),
std::placeholders::_1)
339 typedef typename base_t::execution_context execution_context;
341 __stdcall find_t(thread_pool_base &p, Colln
const &c,
typename Colln::value_type
const &v)
noexcept(
true)
FORCE_INLINE
342 : base_t(p, c,
typename base_t::operation_type(
std::equal_to<
typename Colln::value_type>(), v,
std::placeholders::_1)) {
357 class thread_pool_base<DM, Ps, PTT, Pt>::transform_t {
359 typedef UniOp operation_type;
363 typedef create_direct<work_type> creator_t;
364 typedef subdivide_n_gen_wk2<size_mode, thread_pool_base,
typename creator_t::closure_t, two_containers<CollnIn, CollnOut>, alg_wk_wrap::transform_reduce> gen_wk_t;
377 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type> execution_context;
383 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
384 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
385 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
386 && CollnIn::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
387 && CollnOut::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
388 ? ppd::generic_traits::memory_access_modes::crew_memory_access
389 : ppd::generic_traits::memory_access_modes::erew_memory_access
392 __stdcall transform_t(thread_pool_base &p, CollnIn
const &i, CollnOut &o, operation_type
const &op)
noexcept(
true)
FORCE_INLINE
393 : pool(p), in(i), out(o), uniop(op) {
401 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
402 const typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type containers(in, out);
403 return execution_context(
406 typename execution_context::thread_wk_t::closure_t::argument_type(uniop),
407 init_num_jobs_par_alg_other,
410 default_num_subranges
415 thread_pool_base &pool;
418 operation_type
const &uniop;
433 class thread_pool_base<DM, Ps, PTT, Pt>::transform_iter_t {
435 typedef UniOp operation_type;
439 typedef create_direct<work_type> creator_t;
440 typedef subdivide_n_gen_wk2<size_mode, thread_pool_base,
typename creator_t::closure_t, two_ranges<CollnIn, CollnOut, IterIn,
typename CollnOut::container_type::iterator>, alg_wk_wrap::transform_reduce> gen_wk_t;
453 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type> execution_context;
459 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
460 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
461 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
462 ? ppd::generic_traits::memory_access_modes::crew_memory_access
463 : ppd::generic_traits::memory_access_modes::erew_memory_access
466 __stdcall transform_iter_t(thread_pool_base &p, IterIn b1, IterIn e1,
typename CollnOut::container_type::iterator b2, operation_type
const &op)
noexcept(
true)
FORCE_INLINE
467 : pool(p), beg1(b1), end1(e1), beg2(b2), uniop(op) {
475 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
476 return execution_context(
479 typename execution_context::thread_wk_t::closure_t::argument_type(uniop),
480 init_num_jobs_par_alg_other,
481 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type(beg1, end1, beg2),
483 default_num_subranges
488 thread_pool_base &pool;
491 typename CollnOut::container_type::iterator beg2;
492 operation_type
const &uniop;
506 struct thread_pool_base<DM, Ps, PTT, Pt>::copy_iter_t :
public thread_pool_base<DM, Ps, PTT, Pt>::
template transform_iter_t<CollnIn, CollnOut, IterIn,
noop<
typename CollnOut::value_type> > {
509 __stdcall copy_iter_t(thread_pool_base &p, IterIn b1, IterIn e1,
typename CollnOut::container_type::iterator b2)
noexcept(
true)
FORCE_INLINE
510 :
base_t(p, b1, e1, b2,
typename base_t::operation_type()) {
526 class thread_pool_base<DM, Ps, PTT, Pt>::transform2_t {
528 typedef BinOp operation_type;
532 typedef create_direct<work_type> creator_t;
533 typedef subdivide_n_gen_wk3<size_mode, thread_pool_base,
typename creator_t::closure_t, three_containers<CollnIn1, CollnIn2, CollnOut>, alg_wk_wrap::transform2_reduce> gen_wk_t;
546 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type> execution_context;
552 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
553 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
554 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
555 && CollnIn1::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
556 && CollnIn2::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
557 && CollnOut::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
558 ? ppd::generic_traits::memory_access_modes::crew_memory_access
559 : ppd::generic_traits::memory_access_modes::erew_memory_access
562 __stdcall transform2_t(thread_pool_base &p, CollnIn1
const &i1, CollnIn2
const &i2, CollnOut &o, operation_type
const &op)
noexcept(
true)
FORCE_INLINE
563 : pool(p), in1(i1), in2(i2), out(o), binop(op) {
571 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
572 const typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type containers(in1, in2, out);
573 return execution_context(
576 typename execution_context::thread_wk_t::closure_t::argument_type(binop),
577 init_num_jobs_par_alg_other,
580 default_num_subranges
585 thread_pool_base &pool;
589 operation_type
const binop;
599 struct thread_pool_base<DM, Ps, PTT, Pt>::map_red_initialiser :
std::unary_function<
void, Res> {
600 typedef std::unary_function<
void, Res> base_t;
601 typedef typename base_t::argument_type argument_type;
602 typedef typename base_t::result_type result_type;
604 result_type
const val;
606 explicit map_red_initialiser(result_type
const &va)
FORCE_INLINE
609 result_type
const &
__fastcall operator()()
const noexcept(
true)
FORCE_INLINE {
624 template<
class,
class>
class Reduce,
627 class thread_pool_base<DM, Ps, PTT, Pt>::map_reduce_t {
629 typedef BinOp operation_type;
632 typedef Init initialiser;
635 typedef typename os_traits::lock_traits::
template atomic_counter_type<V> accumulated_res_t;
637 typedef create_direct<work_type> creator_t;
638 typedef subdivide_n_gen_wk1<size_mode, thread_pool_base,
typename creator_t::closure_t, one_container<Colln>, Reduce> gen_wk_t;
651 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type, deref::extra_deref, core_work_result::to_op> execution_context;
657 accumulated_res_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
658 && work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
659 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
660 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
661 && Colln::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
662 ? ppd::generic_traits::memory_access_modes::crew_memory_access
663 : ppd::generic_traits::memory_access_modes::erew_memory_access
666 map_reduce_t(thread_pool_base &p, Colln
const &c, initialiser
const &i, operation_type
const &op,
typename cfg_type::node_property_t::value_type
const *n_d)
noexcept(
true)
FORCE_INLINE
667 : pool(p), colln(c), init_val(i), binop(op), node_details(n_d) {
676 return execution_context(
678 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(node_details, cfg_parms),
679 typename execution_context::thread_wk_t::closure_t::argument_type(binop,
typename execution_context::thread_wk_t::closure_t::result_type(init_val.operator()())),
680 init_num_jobs_par_alg_other,
681 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type(colln),
683 default_num_subranges
688 thread_pool_base &pool;
690 initialiser
const init_val;
691 operation_type
const binop;
692 typename cfg_type::node_property_t::value_type
const *node_details;
701 template<
class Colln>
702 struct thread_pool_base<DM, Ps, PTT, Pt>::max_element_initialiser :
std::unary_function<
void,
typename Colln::value_type> {
703 typedef std::unary_function<
void,
typename Colln::value_type> base_t;
704 typedef typename base_t::result_type result_type;
708 explicit max_element_initialiser(Colln
const &c)
noexcept(
true)
FORCE_INLINE
711 result_type
__fastcall operator()()
const noexcept(
true)
FORCE_INLINE {
712 return !colln.colln().empty() ? *colln.colln().begin() :
std::numeric_limits<result_type>::min();
722 template<
class Colln>
723 struct thread_pool_base<DM, Ps, PTT, Pt>::min_element_initialiser :
std::unary_function<
void,
typename Colln::value_type> {
724 typedef std::unary_function<
void,
typename Colln::value_type> base_t;
725 typedef typename base_t::result_type result_type;
729 explicit min_element_initialiser(Colln
const &c)
noexcept(
true)
FORCE_INLINE
732 result_type
__fastcall operator()()
const noexcept(
true)
FORCE_INLINE {
733 return !colln.colln().empty() ? *colln.colln().begin() :
std::numeric_limits<result_type>::max();
747 struct thread_pool_base<DM, Ps, PTT, Pt>::accumulate_op_processor :
public thread_pool_base<DM, Ps, PTT, Pt>::
template map_reduce_t<Colln, BinOp,
typename BinOp::result_type, alg_wk_wrap::accumulate_reduce, map_red_initialiser<
typename BinOp::result_type>> {
748 typedef map_reduce_t<Colln, BinOp,
typename BinOp::result_type, alg_wk_wrap::accumulate_reduce, map_red_initialiser<
typename BinOp::result_type>> base_t;
750 __stdcall accumulate_op_processor(thread_pool_base &pool, Colln
const &colln,
typename BinOp::result_type
const &v,
typename base_t::operation_type
const &binop,
typename cfg_type::node_property_t::value_type
const *n_d=node_details_acc_op)
noexcept(
true)
FORCE_INLINE
751 : base_t(pool, colln,
typename base_t::initialiser(v), binop, n_d) {
765 struct thread_pool_base<DM, Ps, PTT, Pt>::accumulate_processor :
public thread_pool_base<DM, Ps, PTT, Pt>::
template accumulate_op_processor<Colln,
std::plus<V>> {
766 typedef accumulate_op_processor<Colln,
std::plus<V>> base_t;
768 __stdcall accumulate_processor(thread_pool_base &pool, Colln
const &colln, V
const &v)
noexcept(
true)
FORCE_INLINE
769 : base_t(pool, colln, v,
typename base_t::base_t::operation_type(), node_details_acc) {
783 struct thread_pool_base<DM, Ps, PTT, Pt>::max_element_t :
public thread_pool_base<DM, Ps, PTT, Pt>::
template map_reduce_t<Colln, Comp,
typename Colln::value_type, alg_wk_wrap::max_element_reduce, max_element_initialiser<Colln>> {
784 typedef map_reduce_t<Colln, Comp,
typename Colln::value_type, alg_wk_wrap::max_element_reduce, max_element_initialiser<Colln>> base_t;
785 typedef typename base_t::execution_context execution_context;
787 __stdcall max_element_t(thread_pool_base &pool, Colln
const &colln,
typename base_t::operation_type
const &comp)
noexcept(
true)
FORCE_INLINE
788 : base_t(pool, colln,
typename base_t::initialiser(colln), comp, max_element_str) {
802 struct thread_pool_base<DM, Ps, PTT, Pt>::min_element_t :
public thread_pool_base<DM, Ps, PTT, Pt>::
template map_reduce_t<Colln, Comp,
typename Colln::value_type, alg_wk_wrap::min_element_reduce, min_element_initialiser<Colln>> {
803 typedef map_reduce_t<Colln, Comp,
typename Colln::value_type, alg_wk_wrap::min_element_reduce, min_element_initialiser<Colln>> base_t;
804 typedef typename base_t::execution_context execution_context;
806 __stdcall min_element_t(thread_pool_base &pool, Colln
const &colln,
typename base_t::operation_type
const &comp)
noexcept(
true)
FORCE_INLINE
807 : base_t(pool, colln,
typename base_t::initialiser(colln), comp, min_element_str) {
820 class thread_pool_base<DM, Ps, PTT, Pt>::fill_n_t {
823 typedef create_direct<work_type> creator_t;
824 typedef subdivide_n_gen_wk1<size_mode, thread_pool_base,
typename creator_t::closure_t, one_output_container_rw_lk<Colln>, alg_wk_wrap::fill_n_reduce> gen_wk_t;
837 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type> execution_context;
843 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
844 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
845 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
846 && Colln::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
847 ? ppd::generic_traits::memory_access_modes::crew_memory_access
848 : ppd::generic_traits::memory_access_modes::erew_memory_access
851 __stdcall fill_n_t(thread_pool_base &p, Colln &c,
typename Colln::size_type sz,
typename work_type::element_type &v)
noexcept(
true)
FORCE_INLINE
852 : pool(p), colln(c), size(sz), val(v) {
860 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
861 return execution_context(
863 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(
"fill_n", cfg_parms),
864 typename execution_context::thread_wk_t::closure_t::argument_type(val),
865 init_num_jobs_par_alg_other,
866 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type(colln),
868 default_num_subranges,
874 thread_pool_base &pool;
876 const typename Colln::size_type size;
877 typename work_type::element_type &val;
889 class thread_pool_base<DM, Ps, PTT, Pt>::fill_t {
892 typedef create_direct<work_type> creator_t;
893 typedef subdivide_n_gen_wk1<size_mode, thread_pool_base,
typename creator_t::closure_t, one_output_container_simple_lk<Colln>, alg_wk_wrap::fill_reduce> gen_wk_t;
906 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type> execution_context;
912 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
913 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
914 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
915 && Colln::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
916 ? ppd::generic_traits::memory_access_modes::crew_memory_access
917 : ppd::generic_traits::memory_access_modes::erew_memory_access
920 __stdcall fill_t(thread_pool_base &p, Colln &c,
typename work_type::element_type &v)
noexcept(
true)
FORCE_INLINE
921 : pool(p), colln(c), val(v) {
929 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
930 return execution_context(
932 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(
"fill", cfg_parms),
933 typename execution_context::thread_wk_t::closure_t::argument_type(val),
934 init_num_jobs_par_alg_other,
935 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type(colln),
937 default_num_subranges
942 thread_pool_base &pool;
944 typename work_type::element_type &val;
956 class thread_pool_base<DM, Ps, PTT, Pt>::reverse_t {
958 typedef Colln argument_type;
960 typedef create_direct<work_type> creator_t;
961 typedef subdivide_n_gen_wk1<size_mode, thread_pool_base,
typename creator_t::closure_t, one_output_container_simple_lk<Colln>, alg_wk_wrap::reverse_reduce> gen_wk_t;
974 typedef execution_context_algo_buff_stack_type<work_distribution_mode, pool_traits_type::result_traits_, pool_traits_type::
template algo_thread_wk_buffered, gen_wk_t, work_type> execution_context;
980 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
981 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
982 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
983 && Colln::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
984 ? ppd::generic_traits::memory_access_modes::crew_memory_access
985 : ppd::generic_traits::memory_access_modes::erew_memory_access
988 __stdcall reverse_t(thread_pool_base &p, Colln &c)
noexcept(
true)
FORCE_INLINE
989 : pool(p), colln(c) {
997 process(
cliques::
element_type const cliques,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
998 const unsigned short half_subrange=2;
999 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type containers(colln);
1000 return execution_context(
1002 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(
"reverse", cfg_parms),
1003 typename execution_context::thread_wk_t::closure_t::argument_type(work_type(containers.input1.begin(), containers.input1.end())),
1004 init_num_jobs_par_alg_other,
1012 thread_pool_base &pool;
1028 class thread_pool_base<DM, Ps, PTT, Pt>::merge_t {
1030 typedef Compare operation_type;
1034 typedef create_direct<work_type> creator_t;
1035 typedef alg_wrapper3<pool_traits_type, alg_wk_wrap::batchers_bitonic_merge_reduce<three_containers<CollnIn1, CollnIn2, CollnOut>,
typename creator_t::closure_t>, pool_traits_type::result_traits_> alg_wrap_t;
1048 typedef execution_context_algo_stack_type<work_distribution_mode, pool_traits_type::result_traits_, thread_pool_base, pool_traits_type::
template algo_thread_wk, alg_wrap_t, work_type> execution_context;
1054 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1055 && alg_wrap_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1056 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1057 && CollnIn1::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1058 && CollnIn2::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1059 && CollnOut::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1060 ? ppd::generic_traits::memory_access_modes::crew_memory_access
1061 : ppd::generic_traits::memory_access_modes::erew_memory_access
1064 __stdcall merge_t(thread_pool_base &p, CollnIn1
const &i1, CollnIn2
const &i2, CollnOut &o, operation_type
const &op)
noexcept(
true)
FORCE_INLINE
1065 : pool(p), in1(i1), in2(i2), out(o), comp(op) {
1074 execution_context
__fastcall
1075 process(
const typename thread_pool_base::pool_type::size_type clique,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
1076 const typename alg_wrap_t::work_complete_t::containers_type containers(in1, in2, out);
1077 return execution_context(
1079 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(
"merge", cfg_parms),
1080 typename execution_context::thread_wk_t::closure_t::argument_type(comp, pool),
1081 init_num_jobs_par_alg_other,
1088 thread_pool_base &pool;
1089 CollnIn1
const &in1;
1090 CollnIn2
const &in2;
1092 operation_type
const ∁
1105 class thread_pool_base<DM, Ps, PTT, Pt>::sort_t {
1107 typedef Compare operation_type;
1111 typedef create_direct<work_type> creator_t;
1112 typedef alg_wrapper1<pool_traits_type, alg_wk_wrap::bitonic_sort_reduce<one_output_container_simple_lk<Colln>,
typename creator_t::closure_t>, pool_traits_type::result_traits_> alg_wrap_t;
1125 typedef execution_context_algo_stack_type<work_distribution_mode, pool_traits_type::result_traits_, thread_pool_base, pool_traits_type::
template algo_thread_wk, alg_wrap_t, work_type> execution_context;
1131 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1132 && alg_wrap_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1133 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1134 && Colln::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1135 ? ppd::generic_traits::memory_access_modes::crew_memory_access
1136 : ppd::generic_traits::memory_access_modes::erew_memory_access
1139 __stdcall sort_t(thread_pool_base &p, Colln &c, operation_type
const &op)
noexcept(
true)
FORCE_INLINE
1140 : pool(p), colln(c), comp(op) {
1147 execution_context
__fastcall
1148 process(
const typename thread_pool_base::pool_type::size_type clique,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params
const &cfg_parms)
const FORCE_INLINE {
1149 return execution_context(
1151 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(
"sort", cfg_parms),
1152 typename execution_context::thread_wk_t::closure_t::argument_type(comp, pool),
1153 init_num_jobs_par_alg_other,
1154 typename alg_wrap_t::work_complete_t::containers_type(colln),
1160 thread_pool_base &pool;
1162 operation_type
const ∁
1175 class thread_pool_base<DM, Ps, PTT, Pt>::swap_ranges_t {
1181 typedef create_direct<work_type> creator_t;
1182 typedef subdivide_n_gen_wk2<size_mode, thread_pool_base,
typename creator_t::closure_t, two_out_ranges<Colln, Colln,
typename Colln::container_type::iterator,
typename Colln::container_type::iterator>, alg_wk_wrap::swap_ranges_reduce> gen_wk_t;
1201 work_type::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1202 && gen_wk_t::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1203 && execution_context::memory_access_mode==ppd::generic_traits::memory_access_modes::crew_memory_access
1204 ? ppd::generic_traits::memory_access_modes::crew_memory_access
1205 : ppd::generic_traits::memory_access_modes::erew_memory_access
1208 __stdcall swap_ranges_t(thread_pool_base &p,
typename Colln::container_type::iterator b1,
typename Colln::container_type::iterator e1,
typename Colln::container_type::iterator b2, Pred
const &pr)
noexcept(
true)
FORCE_INLINE
1209 : pool(p), beg1(b1), end1(e1), beg2(b2), pred(pr) {
1218 return execution_context(
1220 typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params(
"swap_ranges", cfg_parms),
1221 typename execution_context::thread_wk_t::closure_t::argument_type(pred),
1222 init_num_jobs_par_alg_other,
1223 typename gen_wk_t::alg_wrap_t::work_complete_t::containers_type(beg1, end1, beg2),
1225 default_num_subranges
1230 thread_pool_base &pool;
1231 typename Colln::container_type::iterator beg1;
1232 typename Colln::container_type::iterator end1;
1233 typename Colln::container_type::iterator beg2;
1247 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template for_each_t<Colln, Fn> >
__fastcall
1248 thread_pool_base<DM, Ps, PTT, Pt>::
for_each(Colln
const &c, Fn
const &fn) {
1249 typedef parallel_algorithm<for_each_t<Colln, Fn> > reduction_t;
1250 this->set_statistics().update_colln_stats(c.size());
1251 return reduction_t(
typename reduction_t::operation_type(*
this, c, fn));
1264 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template count_if_t<Colln, Pred> >
__fastcall
1265 thread_pool_base<DM, Ps, PTT, Pt>::
count_if(Colln
const &c, Pred
const &p) {
1266 typedef parallel_algorithm<count_if_t<Colln, Pred> > reduction_t;
1267 this->set_statistics().update_colln_stats(c.size());
1268 return reduction_t(
typename reduction_t::operation_type(*
this, c, p));
1280 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template count_t<Colln> >
__fastcall
1281 thread_pool_base<DM, Ps, PTT, Pt>::
count(Colln
const &c,
typename Colln::value_type
const &v) {
1282 typedef parallel_algorithm<count_t<Colln> > reduction_t;
1283 this->set_statistics().update_colln_stats(c.size());
1284 return reduction_t(
typename reduction_t::operation_type(*
this, c, v));
1297 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template find_if_t<Colln, Pred> >
__fastcall
1298 thread_pool_base<DM, Ps, PTT, Pt>::
find_if(Colln
const &c, Pred
const &p) {
1299 typedef parallel_algorithm<find_if_t<Colln, Pred> > reduction_t;
1300 this->set_statistics().update_colln_stats(c.size());
1301 return reduction_t(
typename reduction_t::operation_type(*
this, c, p));
1313 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template find_t<Colln> >
__fastcall
1314 thread_pool_base<DM, Ps, PTT, Pt>::
find(Colln
const &c,
typename Colln::value_type
const &v) {
1315 typedef parallel_algorithm<find_t<Colln> > reduction_t;
1316 this->set_statistics().update_colln_stats(c.size());
1317 return reduction_t(
typename reduction_t::operation_type(*
this, c, v));
1331 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template transform_t<CollnIn, CollnOut, UniOp> >
__fastcall
1332 thread_pool_base<DM, Ps, PTT, Pt>::
transform(CollnIn
const &in, CollnOut &out, UniOp
const &uniop) {
1333 typedef parallel_algorithm<transform_t<CollnIn, CollnOut, UniOp> > reduction_t;
1334 this->set_statistics().update_colln_stats(in.size());
1335 return reduction_t(
typename reduction_t::operation_type(*
this, in, out, uniop));
1350 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template transform2_t<CollnIn1, CollnIn2, CollnOut, BinOp> >
__fastcall
1351 thread_pool_base<DM, Ps, PTT, Pt>::
transform(CollnIn1
const &in1, CollnIn2
const &in2, CollnOut &out, BinOp
const &binop) {
1352 typedef parallel_algorithm<transform2_t<CollnIn1, CollnIn2, CollnOut, BinOp> > reduction_t;
1353 this->set_statistics().update_colln_stats(in1.size());
1354 return reduction_t(
typename reduction_t::operation_type(*
this, in1, in2, out, binop));
1367 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template transform_t<CollnIn, CollnOut,
noop<
typename CollnOut::
value_type> > >
__fastcall
1368 thread_pool_base<DM, Ps, PTT, Pt>::
copy(CollnIn
const &in, CollnOut &out) {
1369 return transform(in, out,
noop<
typename CollnOut::value_type>());
1382 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template accumulate_op_processor<Colln, BinOp> >
__fastcall
1383 thread_pool_base<DM, Ps, PTT, Pt>::
accumulate(Colln
const &c,
typename BinOp::result_type
const &v, BinOp
const &binop) {
1384 typedef parallel_algorithm<accumulate_op_processor<Colln, BinOp> > reduction_t;
1385 this->set_statistics().update_colln_stats(c.size());
1386 return reduction_t(
typename reduction_t::operation_type(*
this, c, v, binop));
1399 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template accumulate_processor<Colln, V>>
__fastcall
1400 thread_pool_base<DM, Ps, PTT, Pt>::
accumulate(Colln
const &c, V
const &v) {
1401 typedef parallel_algorithm<accumulate_processor<Colln, V>> reduction_t;
1402 this->set_statistics().update_colln_stats(c.size());
1403 return reduction_t(
typename reduction_t::operation_type(*
this, c, v));
1415 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template fill_n_t<Colln> >
__fastcall
1416 thread_pool_base<DM, Ps, PTT, Pt>::
fill_n(Colln &c,
typename Colln::size_type sz,
typename Colln::value_type
const &v) {
1417 typedef parallel_algorithm<fill_n_t<Colln> > reduction_t;
1418 this->set_statistics().update_colln_stats(sz);
1419 return reduction_t(
typename reduction_t::operation_type(*
this, c, sz, v));
1431 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template fill_t<Colln> >
__fastcall
1432 thread_pool_base<DM, Ps, PTT, Pt>::
fill(Colln &c,
typename Colln::value_type
const &v) {
1433 typedef parallel_algorithm<fill_t<Colln> > reduction_t;
1434 this->set_statistics().update_colln_stats(c.size());
1435 return reduction_t(
typename reduction_t::operation_type(*
this, c, v));
1447 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template reverse_t<Colln> >
__fastcall
1448 thread_pool_base<DM, Ps, PTT, Pt>::
reverse(Colln &c) {
1449 typedef parallel_algorithm<reverse_t<Colln> > reduction_t;
1450 this->set_statistics().update_colln_stats(c.size());
1451 return reduction_t(
typename reduction_t::operation_type(*
this, c));
1464 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template max_element_t<Colln, Comp>>
__fastcall
1465 thread_pool_base<DM, Ps, PTT, Pt>::
max_element(Colln
const &c, Comp
const &comp) {
1466 typedef parallel_algorithm<max_element_t<Colln, Comp>> reduction_t;
1467 this->set_statistics().update_colln_stats(c.size());
1468 return reduction_t(
typename reduction_t::operation_type(*
this, c, comp));
1480 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template max_element_t<Colln,
std::less<
typename Colln::
value_type>>>
__fastcall
1482 return max_element(c,
std::less<
typename Colln::value_type>());
1495 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template min_element_t<Colln, Comp>>
__fastcall
1496 thread_pool_base<DM, Ps, PTT, Pt>::
min_element(Colln
const &c, Comp
const &comp) {
1497 typedef parallel_algorithm<min_element_t<Colln, Comp>> reduction_t;
1498 this->set_statistics().update_colln_stats(c.size());
1499 return reduction_t(
typename reduction_t::operation_type(*
this, c, comp));
1511 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template min_element_t<Colln,
std::less<
typename Colln::
value_type>>>
__fastcall
1513 return min_element(c,
std::less<
typename Colln::value_type>());
1528 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template merge_t<CollnIn1, CollnIn2, CollnOut, Compare> >
__fastcall
1529 thread_pool_base<DM, Ps, PTT, Pt>::
merge(CollnIn1
const &in1, CollnIn2
const &in2, CollnOut &out, Compare
const &comp) {
1530 typedef parallel_algorithm<merge_t<CollnIn1, CollnIn2, CollnOut, Compare> > reduction_t;
1531 this->set_statistics().update_colln_stats(in1.size()+in2.size());
1532 return reduction_t(
typename reduction_t::operation_type(*
this, in1, in2, out, comp));
1546 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template merge_t<CollnIn1, CollnIn2, CollnOut,
std::less<
typename CollnOut::
value_type> > >
__fastcall
1547 thread_pool_base<DM, Ps, PTT, Pt>::
merge(CollnIn1
const &in1, CollnIn2
const &in2, CollnOut &out) {
1548 return merge(in1, in2, out,
std::less<
typename CollnIn1::value_type>());
1561 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template sort_t<Colln, Compare> >
__fastcall
1562 thread_pool_base<DM, Ps, PTT, Pt>::
sort(Colln &c, Compare
const &comp) {
1563 typedef parallel_algorithm<sort_t<Colln, Compare> > reduction_t;
1564 this->set_statistics().update_colln_stats(c.size());
1565 return reduction_t(
typename reduction_t::operation_type(*
this, c, comp));
1577 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template sort_t<Colln,
std::less<
typename Colln::
value_type> > >
__fastcall
1578 thread_pool_base<DM, Ps, PTT, Pt>::
sort(Colln &in) {
1579 return sort(in,
std::less<
typename Colln::value_type>());
1592 inline typename thread_pool_base<DM, Ps, PTT, Pt>::
template execution_context_stack<
unary_fun_work_type<ArgT, UniFn, thread_pool_base<DM, Ps, PTT, Pt>>>
__fastcall
1593 thread_pool_base<DM, Ps, PTT, Pt>::
unary_fun(ArgT &&a, UniFn
const &op) {
1596 return *
this<<joinable(
this,
unary_fun_str)<<work_type(
std::forward<ArgT>(a), op, *
this);
1610 inline typename thread_pool_base<DM, Ps, PTT, Pt>::
template execution_context_stack<
binary_fun_work_type<LHSArg, RHSArg, BinFn, thread_pool_base<DM, Ps, PTT, Pt>>>
__fastcall
1611 thread_pool_base<DM, Ps, PTT, Pt>::
binary_fun(LHSArg &&lhs, RHSArg &&rhs, BinFn
const &op) {
1614 return *
this<<joinable(
this,
binary_fun_str)<<work_type(
std::forward<LHSArg>(lhs),
std::forward<RHSArg>(rhs), op, *
this);
1626 inline typename thread_pool_base<DM, Ps, PTT, Pt>::
template execution_context_stack<
binary_fun_work_type<T
const, T
const,
std::logical_and<
bool>, thread_pool_base<DM, Ps, PTT, Pt>>>
__fastcall
1628 return binary_fun<T
const, T
const,
std::logical_and<
bool>>(
std::forward<T>(lhs),
std::forward<T>(rhs));
1640 inline typename thread_pool_base<DM, Ps, PTT, Pt>::
template execution_context_stack<
binary_fun_work_type<T
const, T
const,
std::logical_or<
bool>, thread_pool_base<DM, Ps, PTT, Pt>>>
__fastcall
1641 thread_pool_base<DM, Ps, PTT, Pt>::
logical_or(T &&lhs, T &&rhs) {
1642 return binary_fun<T
const, T
const,
std::logical_or<
bool>>(
std::forward<T>(lhs),
std::forward<T>(rhs));
1655 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template swap_ranges_t<Colln, Pred> >
__fastcall
1656 thread_pool_base<DM, Ps, PTT, Pt>::
swap_ranges(
typename Colln::container_type::iterator b1,
typename Colln::container_type::iterator e1,
typename Colln::container_type::iterator b2, Pred
const &p) {
1657 typedef parallel_algorithm<swap_ranges_t<Colln, Pred> > reduction_t;
1658 this->set_statistics().update_colln_stats(
std::distance(b1, e1));
1659 return reduction_t(
typename reduction_t::operation_type(*
this, b1, e1, b2, p));
1674 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template transform_iter_t<CollnIn, CollnOut, IterIn, UniOp> >
__fastcall
1675 thread_pool_base<DM, Ps, PTT, Pt>::
transform(IterIn b1, IterIn e1,
typename CollnOut::container_type::iterator b2, UniOp
const &uniop) {
1676 typedef parallel_algorithm<transform_iter_t<CollnIn, CollnOut, IterIn, UniOp> > reduction_t;
1677 this->set_statistics().update_colln_stats(
std::distance(b1, e1));
1678 return reduction_t(
typename reduction_t::operation_type(*
this, b1, e1, b2, uniop));
1692 inline parallel_algorithm<
typename thread_pool_base<DM, Ps, PTT, Pt>::
template copy_iter_t<CollnIn, CollnOut, IterIn> >
__fastcall
1693 thread_pool_base<DM, Ps, PTT, Pt>::
copy(IterIn b1, IterIn e1,
typename CollnOut::container_type::iterator b2) {
1694 typedef parallel_algorithm<copy_iter_t<CollnIn, CollnOut, IterIn> > reduction_t;
1695 this->set_statistics().update_colln_stats(
std::distance(b1, e1));
1696 return reduction_t(
typename reduction_t::operation_type(*
this, b1, e1, b2));
1706 operator<<(
tostream &os, thread_pool_base<DM1, Ps1, PTT1, Pt1>
const &t) {
1709 <<
_T(
", type: ")<<thread_pool_base<DM1, Ps1, PTT1, Pt1>::thread_traits::demangle_name(
typeid(t))
1710 <<
_T(
", size_mode=")<<t.size_mode
1711 <<
_T(
", memory_access_mode=")<<t.memory_access_mode
1712 <<
_T(
", max_num_threads_in_pool=")<<t.max_num_threads_in_pool;