From: wolf Date: Thu, 24 Feb 2000 13:01:56 +0000 (+0000) Subject: Update to auto-detection of the number of CPUs in a system. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20897dd3e1a68ccf0f4a015040f47f83d5f5d905;p=dealii-svn.git Update to auto-detection of the number of CPUs in a system. git-svn-id: https://svn.dealii.org/trunk@2490 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/sparse_matrix.templates.h b/deal.II/lac/include/lac/sparse_matrix.templates.h index c9e7d1a7ef..170e4bad33 100644 --- a/deal.II/lac/include/lac/sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/sparse_matrix.templates.h @@ -27,8 +27,7 @@ # include # include - -# define NTHREADS 4 +# include #endif @@ -214,9 +213,9 @@ SparseMatrix::vmult (Vector& dst, const Vector& // 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::matrix_norm (const Vector& 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::residual (Vector &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; diff --git a/deal.II/lac/include/lac/sparse_vanka.h b/deal.II/lac/include/lac/sparse_vanka.h index 328d2b43e0..bef2d29292 100644 --- a/deal.II/lac/include/lac/sparse_vanka.h +++ b/deal.II/lac/include/lac/sparse_vanka.h @@ -18,6 +18,7 @@ #include +#include #include #include @@ -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 &M, const vector &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 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.