Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
hardware_concurrency.cpp
Go to the documentation of this file.
1
#include "
hardware_concurrency.hpp
"
2
#include <
barretenberg/common/throw_or_abort.hpp
>
3
#include <cstdlib>
4
#include <iostream>
5
#include <stdexcept>
6
#include <string>
7
8
#ifndef NO_MULTITHREADING
9
#include <thread>
10
#endif
11
12
extern
"C"
{
13
14
#ifdef NO_MULTITHREADING
15
uint32_t
env_hardware_concurrency
()
16
{
17
return
1;
18
}
19
#else
20
uint32_t
env_hardware_concurrency
()
21
{
22
#ifndef __wasm__
23
try
{
24
#endif
25
static
auto
val =
std::getenv
(
"HARDWARE_CONCURRENCY"
);
26
static
const
uint32_t cores = val ? (uint32_t)
std::stoul
(val) : std::thread::hardware_concurrency();
27
return
cores;
28
#ifndef __wasm__
29
}
catch
(std::exception
const
&) {
30
throw
std::runtime_error(
"HARDWARE_CONCURRENCY invalid."
);
31
}
32
#endif
33
}
34
#endif
35
}
env_hardware_concurrency
uint32_t env_hardware_concurrency()
Definition
hardware_concurrency.cpp:20
hardware_concurrency.hpp
std::get
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition
tuple.hpp:13
throw_or_abort.hpp
src
barretenberg
env
hardware_concurrency.cpp
Generated by
1.9.8