Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "barretenberg/common/compiler_hints.hpp"
#include <atomic>
#include <barretenberg/env/hardware_concurrency.hpp>
#include <barretenberg/numeric/bitop/get_msb.hpp>
#include <functional>
#include <iostream>
#include <vector>
Go to the source code of this file.
Classes | |
struct | bb::MultithreadData |
Namespaces | |
namespace | bb |
Entry point for Barretenberg command-line interface. | |
namespace | bb::thread_heuristics |
Functions | |
size_t | bb::get_num_cpus () |
size_t | bb::get_num_cpus_pow2 () |
void | bb::parallel_for (size_t num_iterations, const std::function< void(size_t)> &func) |
void | bb::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. | |
void | bb::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. | |
template<typename Func > requires std::invocable<Func, std::size_t> | |
void | bb::parallel_for_heuristic (size_t num_points, const Func &func, size_t heuristic_cost) |
template<typename Func , typename Accum > requires std::invocable<Func, std::size_t, Accum&> | |
std::vector< Accum > | bb::parallel_for_heuristic (size_t num_points, const Accum &initial_accum, const Func &func, size_t heuristic_cost) |
parallel_for_heuristic variant that takes an accumulator initializer that is allocated in a vector, one accumulator per thread/chunk. This allows for thread-safe accumulation, see sum() or sum_pairs() in container.hpp for an easy way to combine the thread/chunk contributions into a final result. | |
MultithreadData | bb::calculate_thread_data (size_t num_iterations, size_t min_iterations_per_thread=DEFAULT_MIN_ITERS_PER_THREAD) |
Calculates number of threads and index bounds for each thread. | |
size_t | bb::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 | bb::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 | |
Variables | |
const size_t | bb::DEFAULT_MIN_ITERS_PER_THREAD = 1 << 4 |
constexpr size_t | bb::thread_heuristics::FF_ADDITION_COST = 4 |
constexpr size_t | bb::thread_heuristics::FF_MULTIPLICATION_COST = 21 |
constexpr size_t | bb::thread_heuristics::FF_INVERSION_COST = 7000 |
constexpr size_t | bb::thread_heuristics::GE_ADDITION_COST = 350 |
constexpr size_t | bb::thread_heuristics::GE_DOUBLING_COST = 194 |
constexpr size_t | bb::thread_heuristics::SM_COST = 50000 |
constexpr size_t | bb::thread_heuristics::FF_COPY_COST = 3 |
constexpr size_t | bb::thread_heuristics::ALWAYS_MULTITHREAD = 100000 |