16 #include <deal.II/base/multithread_info.h> 17 #include <deal.II/base/utilities.h> 19 #ifdef DEAL_II_HAVE_UNISTD_H 23 #if (defined(__MACH__) && defined(__APPLE__)) || defined(__FreeBSD__) 24 # include <sys/sysctl.h> 25 # include <sys/types.h> 30 #ifdef DEAL_II_WITH_THREADS 31 # include <deal.II/base/thread_management.h> 33 # include <tbb/task_scheduler_init.h> 36 DEAL_II_NAMESPACE_OPEN
38 #ifdef DEAL_II_WITH_THREADS 48 # if defined(__linux__) || defined(__sun__) || defined(__osf__) || \ 54 return sysconf(_SC_NPROCESSORS_ONLN);
57 # elif (defined(__MACH__) && defined(__APPLE__)) || defined(__FreeBSD__) 71 sysctl(mib, 2, &
n_cpus, &len,
nullptr, 0);
123 const char *penv = getenv(
"DEAL_II_NUM_THREADS");
137 "When specifying the <DEAL_II_NUM_THREADS> environment " 138 "variable, it needs to be something that can be interpreted " 139 "as an integer. The text you have in the environment " 146 "When specifying the <DEAL_II_NUM_THREADS> environment " 147 "variable, it needs to be a positive number."));
158 n_max_threads = tbb::task_scheduler_init::default_num_threads();
161 static tbb::task_scheduler_init dummy(tbb::task_scheduler_init::deferred);
162 if (dummy.is_active())
176 #else // not in MT mode 222 static bool done =
false;
249 DEAL_II_NAMESPACE_CLOSE
static const unsigned int invalid_unsigned_int
static const unsigned int n_cpus
static unsigned int n_cores()
#define AssertThrow(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
static void initialize_multithreading()
static bool is_running_single_threaded()
static unsigned int n_max_threads
static std::size_t memory_consumption()
static void set_thread_limit(const unsigned int max_threads=numbers::invalid_unsigned_int)
int string_to_int(const std::string &s)
static unsigned int n_threads()
static ::ExceptionBase & ExcInternalError()
static unsigned int get_n_cpus()