30void parallel_for(
size_t num_iterations,
const std::function<
void(
size_t)>& func);
32 const std::function<
void(
size_t,
size_t)>& func,
33 size_t no_multhreading_if_less_or_equal = 0);
46 const std::function<
void(
size_t,
size_t,
size_t)>& func,
47 size_t heuristic_cost);
49template <
typename Func>
55 [&](
size_t start_idx,
size_t end_idx,
BB_UNUSED size_t chunk_index) {
56 for (
size_t i = start_idx; i < end_idx; i++) {
69template <
typename Func,
typename Accum>
72 const Accum& initial_accum,
74 size_t heuristic_cost)
80 [&](
size_t start_idx,
size_t end_idx,
size_t chunk_index) {
81 for (
size_t i = start_idx; i < end_idx; i++) {
82 func(i, accumulators[chunk_index]);
95 std::vector<size_t>
end;
131namespace thread_heuristics {
uint32_t env_hardware_concurrency()
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()
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 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