58 template <
bool IsExclusive,
typename DataType,
typename Operator,
93 for (
Int32 i = 0; i < n; ++i) {
114 for (
Int32 i = 0; i < n; ++i) {
133 template <
bool InPlace,
typename InputIterator,
typename OutputIterator,
typename SelectLambda>
139 using IndexType =
Int32;
167 const Int32 nb_block = 10;
171 SmallArray<Int32> partial_values(nb_block, 0);
172 Span<Int32> out_partial_values = partial_values;
174 auto partial_value_func = [=](
Int32 a,
Int32 n) {
175 for (
Int32 i = 0; i < n; ++i) {
176 Int32 interval_index = i + a;
178 Int32 input_index = 0;
179 Int32 nb_value_in_interval = 0;
180 _subInterval<Int32>(nb_value, interval_index, nb_block, &input_index, &nb_value_in_interval);
182 out_partial_values[interval_index] = multiple_getter_func(input_index, nb_value_in_interval);
186 ParallelLoopOptions loop_options(run_info.options().value_or(ParallelLoopOptions{}));
187 loop_options.setGrainSize(1);
188 run_info.addOptions(loop_options);
196 for (
Int32 i = 0; i < nb_block; ++i) {
197 Int32 x = partial_values[i];
199 partial_values[i] = nb_filter;
203 for (
Int32 i = 0; i < n; ++i) {
204 Int32 interval_index = i + a;
206 IndexType partial_value = 0;
207 if (interval_index > 0)
208 partial_value = out_partial_values[interval_index - 1];
210 Int32 input_index = 0;
211 Int32 nb_value_in_interval = 0;
212 _subInterval<Int32>(nb_value, interval_index, nb_block, &input_index, &nb_value_in_interval);
214 multiple_setter_func(partial_value, input_index, nb_value_in_interval);
221 filter_func(0, nb_block);
230 template <
typename SizeType>
231 static void _subInterval(SizeType size, SizeType interval_index, SizeType nb_interval,
232 SizeType* out_begin_index, SizeType* out_interval_size)
234 *out_begin_index = 0;
235 *out_interval_size = 0;
236 if (nb_interval <= 0)
238 if (interval_index < 0 || interval_index >= nb_interval)
240 SizeType isize = size / nb_interval;
241 SizeType ibegin = interval_index * isize;
243 if ((interval_index + 1) == nb_interval)
244 isize = size - ibegin;
245 *out_begin_index = ibegin;
246 *out_interval_size = isize;
void doScan(ForLoopRunInfo run_info, Int32 nb_value, InputIterator input, OutputIterator output, DataType init_value, Operator op)
Algorithme de scan multi-thread.
void arcaneParallelFor(Integer i0, Integer size, InstanceType *itype, void(InstanceType::*lambda_function)(Integer i0, Integer size))
Applique en concurrence la fonction lambda lambda_function sur l'intervalle d'itération [i0,...