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/types.h> 25 # include <sys/sysctl.h> 29 #ifdef DEAL_II_WITH_THREADS 30 # include <deal.II/base/thread_management.h> 31 # include <tbb/task_scheduler_init.h> 34 DEAL_II_NAMESPACE_OPEN
36 #ifdef DEAL_II_WITH_THREADS 46 # if defined(__linux__) || defined(__sun__) || defined(__osf__) || defined(_AIX) 50 return sysconf(_SC_NPROCESSORS_ONLN);
53 # elif (defined(__MACH__) && defined(__APPLE__)) || defined(__FreeBSD__) 66 sysctl(mib, 2, &
n_cpus, &len, NULL, 0);
114 const char *penv = getenv (
"DEAL_II_NUM_THREADS");
125 ExcMessage (std::string(
"When specifying the <DEAL_II_NUM_THREADS> environment " 126 "variable, it needs to be something that can be interpreted " 127 "as an integer. The text you have in the environment " 128 "variable is <") + penv +
">"));
132 ExcMessage (
"When specifying the <DEAL_II_NUM_THREADS> environment " 133 "variable, it needs to be a positive number."));
144 n_max_threads = tbb::task_scheduler_init::default_num_threads();
147 static tbb::task_scheduler_init dummy (tbb::task_scheduler_init::deferred);
148 if (dummy.is_active())
161 #else // not in MT mode 222 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 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()