batmat
0.0.17
Batched linear algebra routines
Loading...
Searching...
No Matches
thread-pool.cpp
Go to the documentation of this file.
1
#include <
batmat/openmp.h
>
2
#include <
batmat/thread-pool.hpp
>
3
4
namespace
batmat
{
5
6
std::mutex
detail::pool_mtx
;
7
std::optional<thread_pool>
detail::pool
{
8
BATMAT_OMP_IF_ELSE
(std::nullopt, std::in_place),
9
};
10
11
void
pool_set_num_threads
(
size_t
num_threads) {
12
std::lock_guard<std::mutex> lck(
detail::pool_mtx
);
13
if
(!
detail::pool
||
detail::pool
->size() != num_threads)
14
detail::pool
.emplace(num_threads);
15
}
16
17
}
// namespace batmat
batmat::pool_set_num_threads
void pool_set_num_threads(size_t num_threads)
Set the number of threads in the global thread pool.
Definition
thread-pool.cpp:11
batmat::detail::pool
std::optional< thread_pool > pool
Definition
thread-pool.cpp:7
batmat::detail::pool_mtx
std::mutex pool_mtx
Definition
thread-pool.cpp:6
batmat
Definition
dtypes.hpp:9
openmp.h
BATMAT_OMP_IF_ELSE
#define BATMAT_OMP_IF_ELSE(X, Y)
Definition
openmp.h:9
thread-pool.hpp
batmat
src
thread-pool.cpp
Generated on
for batmat by
1.16.1