]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix issues with multithreading off 559/head
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 17 Feb 2015 02:05:04 +0000 (03:05 +0100)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 17 Feb 2015 02:05:41 +0000 (03:05 +0100)
include/deal.II/base/work_stream.h
source/base/mpi.cc
source/base/multithread_info.cc

index 0d831eadca6e52c3f38449d210a7236972f4d4d5..6d2b5bdc382119e461cfb8c9afc1ac8f4e2b6bee 100644 (file)
@@ -960,7 +960,7 @@ namespace WorkStream
        Copier                                     copier,
        const ScratchData                         &sample_scratch_data,
        const CopyData                            &sample_copy_data,
-       const unsigned int queue_length = 2*multithread_info.n_threads(),
+       const unsigned int queue_length = 2*MultithreadInfo::n_threads(),
        const unsigned int                         chunk_size = 8);
 
 
@@ -1010,7 +1010,7 @@ namespace WorkStream
        Copier                                   copier,
        const ScratchData                       &sample_scratch_data,
        const CopyData                          &sample_copy_data,
-       const unsigned int queue_length = 2*multithread_info.n_threads(),
+       const unsigned int queue_length = 2*MultithreadInfo::n_threads(),
        const unsigned int                       chunk_size = 8)
   {
     Assert (queue_length > 0,
@@ -1029,7 +1029,7 @@ namespace WorkStream
     // we want to use TBB if we have support and if it is not disabled at
     // runtime:
 #ifdef DEAL_II_WITH_THREADS
-    if (multithread_info.n_threads()==1)
+    if (MultithreadInfo::n_threads()==1)
 #endif
       {
         // need to copy the sample since it is marked const
@@ -1135,7 +1135,7 @@ namespace WorkStream
     // we want to use TBB if we have support and if it is not disabled at
     // runtime:
 #ifdef DEAL_II_WITH_THREADS
-    if (multithread_info.n_threads()==1)
+    if (MultithreadInfo::n_threads()==1)
 #endif
       {
         // need to copy the sample since it is marked const
@@ -1236,7 +1236,7 @@ namespace WorkStream
        void (MainClass::*copier) (const CopyData &),
        const ScratchData                       &sample_scratch_data,
        const CopyData                          &sample_copy_data,
-       const unsigned int queue_length =        2*multithread_info.n_threads(),
+       const unsigned int queue_length =        2*MultithreadInfo::n_threads(),
        const unsigned int chunk_size =          8)
   {
     // forward to the other function
index 473b590168365cb2a55d57bea3282d557ed960ca..5641b4dc875871e54b381f51713c4243959b702d 100644 (file)
@@ -437,16 +437,16 @@ namespace Utilities
           // if the number would be zero, round up to one since every
           // process needs to have at least one thread
           const unsigned int n_threads
-            = std::max(MultithreadInfo::n_cpus / n_local_processes
+            = std::max(MultithreadInfo::n_cores() / n_local_processes
                        +
-                       (nth_process_on_host <= MultithreadInfo::n_cpus % n_local_processes
+                       (nth_process_on_host <= MultithreadInfo::n_cores() % n_local_processes
                         ?
                         1
                         :
                         0),
                        1U);
 #else
-          const unsigned int n_threads = MultithreadInfo::n_cpus;
+          const unsigned int n_threads = MultithreadInfo::n_cores();
 #endif
 
           // finally set this number of threads
index 333aecb683e28e5d4d556b20114ccf10b4485fcc..453dee100ed26aa485ecf630d38269b7c7c6ad0f 100644 (file)
@@ -173,6 +173,11 @@ unsigned int MultithreadInfo::get_n_cpus()
   return 1;
 }
 
+unsigned int MultithreadInfo::n_cores()
+{
+  return 1;
+}
+
 unsigned int MultithreadInfo::n_threads()
 {
   return 1;

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.