23#ifdef DEAL_II_WITH_TBB
24# ifdef DEAL_II_TBB_WITH_ONEAPI
25# include <tbb/global_control.h>
27# include <tbb/task_scheduler_init.h>
32#ifdef DEAL_II_WITH_TASKFLOW
33# include <taskflow/taskflow.hpp>
46 const unsigned int n_cores = std::thread::hardware_concurrency();
59 if (
const char *penv = std::getenv(
"DEAL_II_NUM_THREADS"))
72 "When specifying the <DEAL_II_NUM_THREADS> environment "
73 "variable, it needs to be something that can be interpreted "
74 "as an integer. The text you have in the environment "
81 "When specifying the <DEAL_II_NUM_THREADS> environment "
82 "variable, it needs to be a positive number."));
96#ifdef DEAL_II_WITH_TBB
97# ifdef DEAL_II_TBB_WITH_ONEAPI
106 static std::unique_ptr<tbb::global_control> tbb_global_control;
107 tbb_global_control = std::make_unique<tbb::global_control>(
108 tbb::global_control::max_allowed_parallelism,
n_max_threads);
112 static tbb::task_scheduler_init dummy(tbb::task_scheduler_init::deferred);
113 if (dummy.is_active())
119#ifdef DEAL_II_WITH_TASKFLOW
155 static std::once_flag is_initialized;
156 std::call_once(is_initialized, []() {
163#ifdef DEAL_II_WITH_TASKFLOW
173 "Please initialize multithreading using MultithreadInfo::set_thread_limit() first."));
static unsigned int n_max_threads
static bool is_running_single_threaded()
static std::unique_ptr< tf::Executor > executor
static void initialize_multithreading()
static unsigned int n_cores()
static unsigned int n_threads()
static void set_thread_limit(const unsigned int max_threads=numbers::invalid_unsigned_int)
static std::size_t memory_consumption()
static tf::Executor & get_taskflow_executor()
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
int string_to_int(const std::string &s)
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)