Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
iterate_over_domain.hpp
Go to the documentation of this file.
1
// === AUDIT STATUS ===
2
// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3
// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4
// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5
// =====================
6
7
#pragma once
8
9
#if 0
10
#include <thread>
11
#define ITERATE_OVER_DOMAIN_START(domain) \
12
{ \
13
const size_t __num_threads = domain.num_threads; \
14
const size_t __thread_size = domain.thread_size; \
15
std::vector<std::thread> threads(__num_threads); \
16
auto parallel_loop = [&](size_t __start, size_t __end) { \
17
for (size_t i = __start; i < __end; ++i) \
18
{
19
20
#define ITERATE_OVER_DOMAIN_END \
21
} \
22
} \
23
; \
24
for (size_t j = 0; j < __num_threads; ++j) { \
25
const size_t _start = j * __thread_size; \
26
const size_t _end = (j + 1) * __thread_size; \
27
threads[j] = std::thread(parallel_loop, _start, _end); \
28
} \
29
for (size_t j = 0; j < __num_threads; ++j) { \
30
threads[j].join(); \
31
} \
32
}
33
#endif
34
35
// TODO: Evil preprocessor! Can we not just leverage lambdas?
36
#if 1
37
#include <
barretenberg/common/thread.hpp
>
38
#define ITERATE_OVER_DOMAIN_START(domain) \
39
parallel_for(domain.num_threads, [&](size_t j) { \
40
const size_t internal_bound_start = j * domain.thread_size; \
41
const size_t internal_bound_end = (j + 1) * domain.thread_size; \
42
for (size_t i = internal_bound_start; i < internal_bound_end; ++i) {
43
44
#define ITERATE_OVER_DOMAIN_END \
45
} \
46
});
47
#endif
thread.hpp
src
barretenberg
polynomials
iterate_over_domain.hpp
Generated by
1.9.8