batmat main
Batched linear algebra routines
Loading...
Searching...
No Matches
thread-pool.cpp
Go to the documentation of this file.
1#include <batmat/openmp.h>
3
4namespace batmat {
5
6std::mutex detail::pool_mtx;
7std::optional<thread_pool> detail::pool{
8 BATMAT_OMP_IF_ELSE(std::nullopt, std::in_place),
9};
10
11void 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
void pool_set_num_threads(size_t num_threads)
Set the number of threads in the global thread pool.
std::optional< thread_pool > pool
std::mutex pool_mtx
#define BATMAT_OMP_IF_ELSE(X, Y)
Definition openmp.h:9