<ol>
+ <li>
+ Changed: if configured with TBB but the number of threads is set to 1,
+ do not bother to use TBB in workstream.
+ <br>
+ (Timo Heister, 2013/10/02)
+ </li>
+
<li>
New: step-51 demonstrates the use of hybridized discontinuous Galerkin
methods in deal.II, using the face elements FE_FaceQ. The programs solves a
* At start time this is <tt>n_cpus</tt> or
* one, if detection of the number
* of CPUs is not possible.
+ *
+ * @deprecated: use set_thread_limit() instead.
+ */
+ unsigned int n_default_threads DEAL_II_DEPRECATED;
+
+ /*
+ * Returns the number of threads to use. This is governed by the number
+ * of cores the system has and can be further restricted by
+ * set_thread_limit().
*/
- unsigned int n_default_threads;
+ unsigned int n_threads() const;
/**
* Determine an estimate for
void MultithreadInfo::set_thread_limit(const unsigned int max_threads)
{
+ Assert(n_max_threads==numbers::invalid_unsigned_int,
+ ExcMessage("Calling set_thread_limit() more than once is not supported!"));
+
unsigned int max_threads_env = numbers::invalid_unsigned_int;
char *penv;
penv = getenv ("DEAL_II_NUM_THREADS");
}
}
-bool MultithreadInfo::is_running_single_threaded()
+
+unsigned int MultithreadInfo::n_threads() const
{
if (n_max_threads == numbers::invalid_unsigned_int)
- n_max_threads = tbb::task_scheduler_init::default_num_threads();
- return n_max_threads == 1;
+ return tbb::task_scheduler_init::default_num_threads();
+ else
+ return n_max_threads;
}
return 1;
}
-bool MultithreadInfo::is_running_single_threaded()
+unsigned int MultithreadInfo::n_threads() const
{
- return true;
+ return 1;
}
void MultithreadInfo::set_thread_limit(const unsigned int)
#endif
+bool MultithreadInfo::is_running_single_threaded()
+{
+ return n_threads() == 1;
+}
+
+
MultithreadInfo::MultithreadInfo ()
:
n_cpus (get_n_cpus()),
- n_default_threads (n_cpus)
+ n_default_threads (n_cpus),
+ n_max_threads (numbers::invalid_unsigned_int)
{}