24#ifdef DEAL_II_WITH_TBB
25# ifdef DEAL_II_TBB_WITH_ONEAPI
26# include <tbb/global_control.h>
28# include <tbb/task_scheduler_init.h>
33#ifdef DEAL_II_WITH_TASKFLOW
35# include <taskflow/taskflow.hpp>
49 const unsigned int n_cores = std::thread::hardware_concurrency();
62 if (
const char *penv = std::getenv(
"DEAL_II_NUM_THREADS"))
75 "When specifying the <DEAL_II_NUM_THREADS> environment "
76 "variable, it needs to be something that can be interpreted "
77 "as an integer. The text you have in the environment "
84 "When specifying the <DEAL_II_NUM_THREADS> environment "
85 "variable, it needs to be a positive number."));
99#ifdef DEAL_II_WITH_TBB
100# ifdef DEAL_II_TBB_WITH_ONEAPI
109 static std::unique_ptr<tbb::global_control> tbb_global_control;
110 tbb_global_control = std::make_unique<tbb::global_control>(
111 tbb::global_control::max_allowed_parallelism,
n_max_threads);
115 static tbb::task_scheduler_init dummy(tbb::task_scheduler_init::deferred);
116 if (dummy.is_active())
122#ifdef DEAL_II_WITH_TASKFLOW
158 static std::once_flag is_initialized;
159 std::call_once(is_initialized, []() {
166#ifdef DEAL_II_WITH_TASKFLOW
176 "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_DISABLE_EXTRA_DIAGNOSTICS
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
#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 > &)