#include <algorithm>
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
# define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
# include <tbb/task_scheduler_init.h>
# undef TBB_SUPPRESS_DEPRECATED_MESSAGES
DEAL_II_NAMESPACE_OPEN
-#ifdef DEAL_II_WITH_THREADS
-
/* Detecting how many processors a given machine has is something that
varies greatly between operating systems. For a few operating
systems, we have figured out how to do that below, but some others
*/
-# if defined(__linux__) || defined(__sun__) || defined(__osf__) || \
- defined(_AIX)
+#if defined(__linux__) || defined(__sun__) || defined(__osf__) || defined(_AIX)
unsigned int
MultithreadInfo::get_n_cpus()
return sysconf(_SC_NPROCESSORS_ONLN);
}
-# elif (defined(__MACH__) && defined(__APPLE__)) || defined(__FreeBSD__)
+#elif (defined(__MACH__) && defined(__APPLE__)) || defined(__FreeBSD__)
// This is only tested on a dual G5 2.5GHz running MacOSX 10.3.6
// and on an Intel Mac Book Pro.
// If it doesn't work please contact the mailinglist.
return n_cpus;
}
-# else
+#else
// If you get n_cpus=1 although you are on a multi-processor machine,
// then this may have two reasons: either because the system macros,
return 1;
}
-# endif
+#endif
unsigned int
MultithreadInfo::n_cores()
n_max_threads = max_threads_env;
}
}
+
+#ifdef DEAL_II_WITH_TBB
// Without restrictions from the user query TBB for the recommended number
// of threads:
if (n_max_threads == numbers::invalid_unsigned_int)
if (dummy.is_active())
dummy.terminate();
dummy.initialize(n_max_threads);
+#endif
+ if (n_max_threads == numbers::invalid_unsigned_int)
+ n_max_threads = get_n_cpus();
}
+
unsigned int
MultithreadInfo::n_threads()
{
}
-#else // not in MT mode
-
-unsigned int
-MultithreadInfo::get_n_cpus()
-{
- return 1;
-}
-
-unsigned int
-MultithreadInfo::n_cores()
-{
- return 1;
-}
-
-unsigned int
-MultithreadInfo::n_threads()
-{
- return 1;
-}
-
-void
-MultithreadInfo::set_thread_limit(const unsigned int)
-{}
-
-#endif
-
bool
MultithreadInfo::is_running_single_threaded()
}
+
std::size_t
MultithreadInfo::memory_consumption()
{
}
+
void
MultithreadInfo::initialize_multithreading()
{