21 #ifndef GRPPI_OMP_STENCIL_H 22 #define GRPPI_OMP_STENCIL_H 30 template <
typename InputIt,
typename OutputIt,
typename StencilTransformer,
typename Neighbourhood,
31 typename ... OtherInputIts>
33 InputIt first, InputIt last, OutputIt first_out,
34 StencilTransformer transform_op,
35 Neighbourhood neighbour_op,
36 int i,
int elements_per_thread,
37 OtherInputIts ... other_firsts )
39 auto begin = next(first, elements_per_thread * i);
42 next(first, elements_per_thread * (i+1));
44 auto out = next(first_out, elements_per_thread * i);
48 *out = transform_op(begin, neighbour_op(begin,other_firsts ... ));
77 template <
typename InputIt,
typename OutputIt,
typename StencilTransformer,
78 typename Neighbourhood>
80 InputIt first, InputIt last, OutputIt first_out,
81 StencilTransformer transform_op, Neighbourhood neighbour_op)
83 int size = last - first;
87 #pragma omp single nowait 90 #pragma omp task firstprivate(i) 92 auto begin = next(first, elements_per_thread * i);
95 next(first, elements_per_thread * (i+1));
96 auto out = next(first_out, elements_per_thread * i);
99 *out = transform_op(begin, neighbour_op(begin));
107 auto end = next(first, elements_per_thread);
108 auto out = first_out;
110 *out = transform_op(begin, neighbour_op(begin));
135 template <
typename InputIt,
typename OutputIt,
typename StencilTransformer,
136 typename Neighbourhood,
typename ... OtherInputIts>
138 InputIt first, InputIt last, OutputIt first_out,
139 StencilTransformer && transform_op, Neighbourhood && neighbour_op,
140 OtherInputIts ... other_firsts )
142 int size = distance(first,last);
146 #pragma omp single nowait 149 #pragma omp task firstprivate(i) 152 std::forward<StencilTransformer>(transform_op),
153 std::forward<Neighbourhood>(neighbour_op),
154 i,elements_per_thread,
160 auto out = first_out;
161 auto end = next(first, elements_per_thread);
163 *out = transform_op(*begin, neighbour_op(begin,other_firsts...));
Definition: callable_traits.h:24
void internal_stencil(parallel_execution_omp &ex, InputIt first, InputIt last, OutputIt first_out, StencilTransformer transform_op, Neighbourhood neighbour_op, int i, int elements_per_thread, OtherInputIts...other_firsts)
Definition: omp/stencil.h:32
void stencil(parallel_execution_native &ex, InputIt first, InputIt last, OutputIt first_out, StencilTransformer transform_op, Neighbourhood neighbour_op)
Invoke Stencil pattern on a data sequence with native parallel execution.
Definition: native/stencil.h:53
OpenMP parallel execution policy.
Definition: parallel_execution_omp.h:40
void advance_iterators(size_t delta, InputIt &...in)
Definition: iterator.h:29
int concurrency_degree() const noexcept
Get number of grppi trheads.
Definition: parallel_execution_omp.h:85