]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Update to auto-detection of the number of CPUs in a system.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 24 Feb 2000 13:01:56 +0000 (13:01 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 24 Feb 2000 13:01:56 +0000 (13:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@2490 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.templates.h
deal.II/lac/include/lac/sparse_vanka.h

index c9e7d1a7ef68b578600f9dbcc2c00fd61b0682be..170e4bad33387caf9eba8b985dfcc5f91e160624 100644 (file)
@@ -27,8 +27,7 @@
 #  include <numeric>
 
 #  include <base/thread_manager.h>
-
-#  define NTHREADS 4
+#  include <base/multithread_info.h>
 #endif
 
 
@@ -214,9 +213,9 @@ SparseMatrix<number>::vmult (Vector<somenumber>& dst, const Vector<somenumber>&
                                   // in MT mode: start new threads only
                                   // if the matrix is sufficiently large.
                                   // the limit is mostly artificial
-  if (n_rows/NTHREADS > 2000)
+  if (n_rows/multithread_info.n_default_threads > 2000)
     {
-      const unsigned int n_threads = NTHREADS;
+      const unsigned int n_threads = multithread_info.n_default_threads;
 
       ThreadManager thread_manager;
       
@@ -380,9 +379,9 @@ SparseMatrix<number>::matrix_norm (const Vector<somenumber>& v) const
                                   // if in MT mode and size sufficiently
                                   // large: do it in parallel; the limit
                                   // is mostly artificial
-  if (n_rows/NTHREADS > 2000)
+  if (n_rows/multithread_info.n_default_threads > 2000)
     {
-      const unsigned int n_threads = NTHREADS;
+      const unsigned int n_threads = multithread_info.n_default_threads;
 
       ThreadManager thread_manager;
       
@@ -530,9 +529,9 @@ SparseMatrix<number>::residual (Vector<somenumber>       &dst,
                                   // if in MT mode and size sufficiently
                                   // large: do it in parallel; the limit
                                   // is mostly artificial
-  if (n_rows/NTHREADS > 2000)
+  if (n_rows/multithread_info.n_default_threads > 2000)
     {
-      const unsigned int n_threads = NTHREADS;
+      const unsigned int n_threads = multithread_info.n_default_threads;
 
       ThreadManager thread_manager;
       
index 328d2b43e0e7e76d96e84d2805c6803ebc1954b8..bef2d29292a65b7e599c2a0663d09f0ae0cc2663 100644 (file)
@@ -18,6 +18,7 @@
 
 
 #include <base/smartpointer.h>
+#include <base/multithread_info.h>
 #include <lac/forward_declarations.h>
 
 #include <vector>
@@ -165,12 +166,15 @@ class SparseVanka
                                      * building the inverses of the
                                      * diagonal blocks. This
                                      * parameter is ignored if not in
-                                     * multithreaded mode.
+                                     * multithreaded mode. By
+                                     * default, this variable is set
+                                     * to the value of
+                                     * #multithread_info.n_default_threads#.
                                      */
     SparseVanka(const SparseMatrix<number> &M,
                const vector<bool>         &selected,
                const bool                  conserve_memory = false,
-               const unsigned int          n_threads       = 1);
+               const unsigned int          n_threads       = multithread_info.n_default_threads);
     
                                     /**
                                      * Destructor.
@@ -268,7 +272,7 @@ class SparseVanka
                                      * Number of threads to be used
                                      * when building the
                                      * inverses. Only relevant in
-                                     * multithread mode.
+                                     * multithreaded mode.
                                      */
     const unsigned int n_threads;
     
@@ -491,7 +495,7 @@ class SparseBlockVanka : public SparseVanka<number>
                      const unsigned int          n_blocks,
                      const BlockingStrategy      blocking_strategy,
                      const bool                  conserve_memory = false,
-                     const unsigned int          n_threads       = 1);
+                     const unsigned int          n_threads       = multithread_info.n_default_threads);
 
                                     /**
                                      * Apply the preconditioner.

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.