37void parallel_for(
size_t num_iterations,
const std::function<
void(
size_t)>& func);
39 const std::function<
void(
size_t,
size_t)>& func,
40 size_t no_multhreading_if_less_or_equal = 0);
53 const std::function<
void(
size_t,
size_t,
size_t)>& func,
54 size_t heuristic_cost);
56template <
typename Func>
62 [&](
size_t start_idx,
size_t end_idx,
BB_UNUSED size_t chunk_index) {
63 for (
size_t i = start_idx; i < end_idx; i++) {
76template <
typename Func,
typename Accum>
79 const Accum& initial_accum,
81 size_t heuristic_cost)
87 [&](
size_t start_idx,
size_t end_idx,
size_t chunk_index) {
88 for (
size_t i = start_idx; i < end_idx; i++) {
89 func(i, accumulators[chunk_index]);
138namespace thread_heuristics {
164 return std::views::iota(
size_t{ 0 },
size_t{ 0 });
173 size_t end = start + chunk_size + 1;
177 size_t start = remainder * (chunk_size + 1) + (
thread_index - remainder) * chunk_size;
178 size_t end = start + chunk_size;
183template <
typename Func>
constexpr T get_msb(const T in)
constexpr size_t FF_COPY_COST
constexpr size_t GE_ADDITION_COST
constexpr size_t GE_DOUBLING_COST
constexpr size_t ALWAYS_MULTITHREAD
constexpr size_t FF_ADDITION_COST
constexpr size_t FF_MULTIPLICATION_COST
constexpr size_t FF_INVERSION_COST
Entry point for Barretenberg command-line interface.
MultithreadData calculate_thread_data(size_t num_iterations, size_t min_iterations_per_thread)
Calculates number of threads and index bounds for each thread.
const size_t DEFAULT_MIN_ITERS_PER_THREAD
size_t get_num_cpus_pow2()
constexpr size_t PARALLEL_FOR_MAX_NESTING
size_t calculate_num_threads(size_t num_iterations, size_t min_iterations_per_thread)
calculates number of threads to create based on minimum iterations per thread
size_t calculate_num_threads_pow2(size_t num_iterations, size_t min_iterations_per_thread)
calculates number of threads to create based on minimum iterations per thread, guaranteed power of 2
void parallel_for_heuristic(size_t num_points, const std::function< void(size_t, size_t, size_t)> &func, size_t heuristic_cost)
Split a loop into several loops running in parallel based on operations in 1 iteration.
void set_parallel_for_concurrency(size_t num_cores)
void parallel_for(size_t num_iterations, const std::function< void(size_t)> &func)
void parallel_for_range(size_t num_points, const std::function< void(size_t, size_t)> &func, size_t no_multhreading_if_less_or_equal)
Split a loop into several loops running in parallel.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::vector< size_t > end
std::vector< size_t > start
auto range(size_t size, size_t offset=0) const