21 template<
class P,
class Collns>
inline
24 if (num_tasks_spawned.get()) {
27 if (num_tasks_spawned>0) {
30 assert(num_tasks_spawned==0);
36 template<pool_traits::size_mode_t Ps,
class TPB,
class Alg>
56 const typename thread_pool_type::pool_type::size_type threads=
std::floor(
static_cast<
double>(num_threads)/cliques+0.5);
58 assert(threads<=num_threads);
66 for (
std::size_t i=0; i<num_threads_per_clique; ++i) {
75 (
static_cast<
double>(num_threads_per_clique*(evens*2+odds*3))/2)
78 )+num_threads_per_clique;
86 if (number_subranges==1) {
87 return all_done.containers().input1.end();
89 double const end_subrange_dist=
double(
all_done.containers().input1.size())/number_subranges;
90 return std::next(
all_done.containers().input1.begin(),
static_cast<
typename std::iterator_traits<
in_iterator>::difference_type>(end_subrange_dist));
106 assert(range<work_heap.size);
115 assert(range<work_heap.size);
122 typename algo_work_heap_type::buffer_type
const ret=
work_heap.buffer+
work_heap.stride;
123 assert(ret<=(work_heap.buffer+work_heap.stride*work_heap.size));
131 assert(ret<=(work_heap.buffer+work_heap.stride*work_heap.size));
139 assert(ret<=(work_heap.buffer+work_heap.stride*work_heap.size));
147 assert(ret<=(work_heap.buffer+work_heap.stride*work_heap.size));
156 algo_work_heap_type
const &wh)
noexcept(
true)
175 algo_work_heap_type
const &wh,
176 typename std::iterator_traits<
in_iterator>::difference_type
const number_subranges,
177 typename thread_pool_type::pool_type::size_type
const cliques)
noexcept(
true)
187 assert(threads_per_clique>=1);
188 assert(threads_per_clique<=pool.pool_size());
198 algo_work_heap_type
const &wh,
217 algo_work_heap_type
const &wh,
220 typename thread_pool_type::pool_type::size_type
const t_per_c)
noexcept(
true)
228 assert(threads_per_clique>=1);
229 assert(threads_per_clique<=pool.pool_size());
234 template<
class TPB,
class Alg>
243 template<
class TPB,
class Alg>
inline
249 template<
class TPB,
class Alg>
inline
255 template<
class TPB,
class Alg>
inline
259 typename alg_wrap_t::work_complete_t &w)
noexcept(
true)
272 template<
class TPB,
class Alg>
inline
299 assert(
sizeof(alg_wrap_t)<=
this->work_heap.stride);
300 assert(
sizeof(subdivide_n_gen_wk1)<=
this->work_heap.stride);
306 assert(
sizeof(alg_wrap_t)<=
this->work_heap.stride);
307 assert(
sizeof(subdivide_n_gen_wk1)<=
this->work_heap.stride);
318 assert(std::accumulate(
this->work_heap.buffer,
this->work_heap.buffer+
this->work_heap.size, 0UL)==0UL);
330 assert(
this->first_buff_part()<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
338 assert((
this->odd_second_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
345 assert((
this->odd_third_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
352 assert(
this->first_buff_part()<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
367 assert((
this->even_second_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
383 template<
class TPB,
class Fn,
class Conts,
template<
class,
class>
class Alg>
inline
393 template<
class TPB,
class Fn,
class Conts,
template<
class,
class>
class Alg>
inline
398 template<
class TPB,
class Fn,
class Conts,
template<
class,
class>
class Alg>
inline void __fastcall
448 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().output.size());
449 assert(
sizeof(alg_wrap_t)<=
this->work_heap.stride);
450 assert(
sizeof(subdivide_n_gen_wk2)<=
this->work_heap.stride);
458 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().output.size());
459 assert(
sizeof(alg_wrap_t)<=
this->work_heap.stride);
460 assert(
sizeof(subdivide_n_gen_wk2)<=
this->work_heap.stride);
471 assert(std::accumulate(
this->work_heap.buffer,
this->work_heap.buffer+
this->work_heap.size, 0UL)==0UL);
485 assert(
this->first_buff_part()<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
489 <<
subdivide_n_gen_wk2(
this->
pool,
this->
fn,
this->
all_done,
algo_work_heap_type(
this->
first_buff_part(),
this->
odd_third_buff_range(),
this->
work_heap.
stride),
this->
begin,
in_middle,
out_begin,
out_middle,
this->
threads_per_clique>>1);
494 assert((
this->odd_second_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
498 <<
subdivide_n_gen_wk2(
this->
pool,
this->
fn,
this->
all_done,
algo_work_heap_type(
this->
odd_second_buff_part()+
this->
work_heap.
stride,
this->
odd_third_buff_range(),
this->
work_heap.
stride),
in_middle,
in_middle_next,
out_middle,
out_middle_next,
this->
threads_per_clique>>1);
501 assert((
this->odd_third_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
502 subdivide_n_gen_wk2(
this->
pool,
this->
fn,
this->
all_done,
algo_work_heap_type(
this->
odd_third_buff_part()+
this->
work_heap.
stride,
this->
odd_third_buff_range(),
this->
work_heap.
stride),
in_middle_next,
this->
end,
out_middle_next,
out_end,
this->
threads_per_clique>>1).
process();
509 assert(
this->first_buff_part()<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
526 assert((
this->even_second_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
544 template<
class TPB,
class UniOp,
class Conts,
template<
class,
class>
class Alg>
inline
554 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().output.size());
557 template<
class TPB,
class UniOp,
class Conts,
template<
class,
class>
class Alg>
inline
562 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().output.size());
565 template<
class TPB,
class UniOp,
class Conts,
template<
class,
class>
class Alg>
inline void __fastcall
627 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().input2.size());
628 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().output.size());
629 assert(
sizeof(alg_wrap_t)<=
this->work_heap.stride);
630 assert(
sizeof(subdivide_n_gen_wk3)<=
this->work_heap.stride);
640 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().input2.size());
641 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().output.size());
642 assert(
sizeof(alg_wrap_t)<=
this->work_heap.stride);
643 assert(
sizeof(subdivide_n_gen_wk3)<=
this->work_heap.stride);
654 assert(std::accumulate(
this->work_heap.buffer,
this->work_heap.buffer+
this->work_heap.size, 0UL)==0UL);
670 assert(
this->first_buff_part()<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
674 <<
subdivide_n_gen_wk3(
this->
pool,
this->
fn,
this->
all_done,
algo_work_heap_type(
this->
first_buff_part(),
this->
odd_third_buff_range(),
this->
work_heap.
stride),
this->
begin,
in_middle1,
in_begin2,
in_middle2,
out_begin,
out_middle,
this->
threads_per_clique>>1);
680 assert((
this->odd_second_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
684 <<
subdivide_n_gen_wk3(
this->
pool,
this->
fn,
this->
all_done,
algo_work_heap_type(
this->
odd_second_buff_part()+
this->
work_heap.
stride,
this->
odd_third_buff_range(),
this->
work_heap.
stride),
in_middle1,
in_middle1_next,
in_middle2,
in_middle2_next,
out_middle,
out_middle_next,
this->
threads_per_clique>>1);
687 assert((
this->odd_third_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
688 subdivide_n_gen_wk3(
this->
pool,
this->
fn,
this->
all_done,
algo_work_heap_type(
this->
odd_third_buff_part()+
this->
work_heap.
stride,
this->
odd_third_buff_range(),
this->
work_heap.
stride),
in_middle1_next,
this->
end,
in_middle2_next,
in_end2,
out_middle_next,
out_end,
this->
threads_per_clique>>1).
process();
696 assert(
this->first_buff_part()<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
715 assert((
this->even_second_buff_part()+
this->work_heap.stride)<=(
this->work_heap.buffer+
this->work_heap.stride*
this->work_heap.size));
735 template<
class TPB,
class BinOp,
class Conts,
template<
class,
class>
class Alg>
inline
751 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().input2.size());
752 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().output.size());
755 template<
class TPB,
class BinOp,
class Conts,
template<
class,
class>
class Alg>
inline
762 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().input2.size());
763 assert(
this->all_done.containers().input1.size()<=
this->all_done.containers().output.size());
766 template<
class TPB,
class BinOp,
class Conts,
template<
class,
class>
class Alg>
inline void