From ca8585a798cba472f993165025811a50901f0bff Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Fri, 20 Feb 2015 11:14:29 -0600 Subject: [PATCH] Add set_thread_limit in step-9. --- examples/step-9/step-9.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/examples/step-9/step-9.cc b/examples/step-9/step-9.cc index 6b8ca0bff9..092e9f9c43 100644 --- a/examples/step-9/step-9.cc +++ b/examples/step-9/step-9.cc @@ -48,7 +48,7 @@ // programs. In the first one, the classes and functions are declared which we // need to do assembly in parallel (i.e. the // WorkStream namespace). The -// second file has a class MultithreadInfo which can be used to query the +// second file has a class MultithreadInfo which can be used to query the // number of processors in your system, which is often useful when deciding // how many threads to start in parallel. #include @@ -1318,15 +1318,25 @@ namespace Step9 // @sect3{Main function} -// The main function is exactly like in previous examples, with -// the only difference in the name of the main class that actually does the -// computation. +// The main function is similar to the previous examples. The main +// difference is that we use MultithreadInfo to set the maximum +// number of threads (see @ref threads "Parallel computing with multiple +// processors accessing shared memory" documentation module for more +// explanation). The number of threads used is the minimum of the environment +// variable DEAL_II_NUM_THREADS and the parameter of +// set_thread_limit. If no value is given to +// set_thread_limit, the default value from the Intel Threading +// Building Blocks (TBB) library is used. If the call to +// set_thread_limit is omitted, the number of threads will be +// chosen by TBB indepently of DEAL_II_NUM_THREADS. int main () { try { dealii::deallog.depth_console (0); + dealii::MultithreadInfo::set_thread_limit(); + Step9::AdvectionProblem<2> advection_problem_2d; advection_problem_2d.run (); } -- 2.39.5