]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix building TBB with nvcc_wrapper
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 3 Feb 2019 11:06:36 +0000 (12:06 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 3 Feb 2019 11:08:51 +0000 (12:08 +0100)
include/deal.II/base/function_parser.h
include/deal.II/base/thread_management.h
source/matrix_free/task_info.cc

index fc03c246d24986be9716de0da944c0985109d37d..d8f07a35481b172a6f74ccfd0a1528cd0ea7840b 100644 (file)
@@ -379,16 +379,8 @@ private:
    * storing a unique_ptr so that we don't need to include the definition of
    * mu::Parser in this header.
    */
-#  if TBB_VERSION_MAJOR >= 4
   mutable Threads::ThreadLocalStorage<std::vector<std::unique_ptr<mu::Parser>>>
     fp;
-#  else
-  // older TBBs have a bug in which they want to return thread-local
-  // objects by value. this doesn't work for std::unique_ptr, so use a
-  // std::shared_ptr
-  mutable Threads::ThreadLocalStorage<std::vector<std::shared_ptr<mu::Parser>>>
-    fp;
-#  endif
 
   /**
    * An array to keep track of all the constants, required to initialize fp in
index b3993b51b7903f29994beb7bff8cf4cbc5b0dde6..931e7f30d70501812d7e299d394fd67336830de0 100644 (file)
@@ -1353,16 +1353,7 @@ namespace Threads
       tbb::task *worker =
         new (task->allocate_child()) TaskEntryPoint<RT>(*this);
 
-      // in earlier versions of the TBB, task::spawn was a regular
-      // member function; however, in later versions, it was converted
-      // into a static function. we could always call it as a regular member
-      // function of *task, but that appears to confuse the NVidia nvcc
-      // compiler. consequently, the following work-around:
-#    if TBB_VERSION_MAJOR >= 4
       tbb::task::spawn(*worker);
-#    else
-      task->spawn(*worker);
-#    endif
     }
 
 
index a1617d4c3dc09ad67e94455725c034897036aad6..33bee62a3cc656f5019b702b613a61621b08b6ec 100644 (file)
@@ -118,7 +118,7 @@ namespace internal
           work();
 
           if (is_blocked == true)
-            dummy->spawn(*dummy);
+            tbb::empty_task::spawn(*dummy);
           return nullptr;
         }
 
@@ -172,7 +172,7 @@ namespace internal
                   worker[j]->set_ref_count(2);
                   blocked_worker[j - 1]->dummy =
                     new (worker[j]->allocate_child()) tbb::empty_task;
-                  worker[j - 1]->spawn(*blocked_worker[j - 1]);
+                  tbb::task::spawn(*blocked_worker[j - 1]);
                 }
               else
                 worker[j]->set_ref_count(1);
@@ -195,13 +195,13 @@ namespace internal
                                    2 * j + 1,
                                  task_info,
                                  false);
-                      worker[j]->spawn(*worker[evens]);
+                      tbb::task::spawn(*worker[evens]);
                     }
                   else
                     {
                       tbb::empty_task *child =
                         new (worker[j]->allocate_child()) tbb::empty_task();
-                      worker[j]->spawn(*child);
+                      tbb::task::spawn(*child);
                     }
                 }
             }
@@ -209,7 +209,7 @@ namespace internal
           root->wait_for_all();
           root->destroy(*root);
           if (is_blocked == true)
-            dummy->spawn(*dummy);
+            tbb::empty_task::spawn(*dummy);
           return nullptr;
         }
 
@@ -289,7 +289,7 @@ namespace internal
           parallel_for(tbb::blocked_range<unsigned int>(0, n_chunks, 1),
                        CellWork(worker, task_info, partition));
           if (is_blocked == true)
-            dummy->spawn(*dummy);
+            tbb::empty_task::spawn(*dummy);
           return nullptr;
         }
 
@@ -364,9 +364,9 @@ namespace internal
                       blocked_worker[j - 1]->dummy =
                         new (worker[j]->allocate_child()) tbb::empty_task;
                       if (j > 1)
-                        worker[j - 1]->spawn(*blocked_worker[j - 1]);
+                        tbb::task::spawn(*blocked_worker[j - 1]);
                       else
-                        worker_compr->spawn(*blocked_worker[j - 1]);
+                        tbb::task::spawn(*blocked_worker[j - 1]);
                     }
                   else
                     {
@@ -376,7 +376,7 @@ namespace internal
                       MPICommunication *worker_dist =
                         new (worker[j]->allocate_child())
                           MPICommunication(funct, false);
-                      worker_dist->spawn(*worker_dist);
+                      tbb::task::spawn(*worker_dist);
                     }
                   if (j < evens - 1)
                     {
@@ -392,13 +392,13 @@ namespace internal
                                                      2 * j + 1,
                                                      *this,
                                                      false);
-                          worker[j]->spawn(*worker[evens]);
+                          tbb::task::spawn(*worker[evens]);
                         }
                       else
                         {
                           tbb::empty_task *child =
                             new (worker[j]->allocate_child()) tbb::empty_task();
-                          worker[j]->spawn(*child);
+                          tbb::task::spawn(*child);
                         }
                     }
                 }
@@ -467,14 +467,12 @@ namespace internal
                               tbb::empty_task;
                           worker_index++;
                           if (spawn_index_child == -1)
-                            worker[spawn_index]->spawn(
-                              *blocked_worker[(part - 1) / 2]);
+                            tbb::task::spawn(*blocked_worker[(part - 1) / 2]);
                           else
                             {
                               Assert(spawn_index_child >= 0,
                                      ExcInternalError());
-                              worker[spawn_index]->spawn(
-                                *worker[spawn_index_child]);
+                              tbb::task::spawn(*worker[spawn_index_child]);
                             }
                           spawn_index       = spawn_index_new;
                           spawn_index_child = -2;
@@ -484,7 +482,7 @@ namespace internal
                           MPICommunication *worker_dist =
                             new (worker[worker_index]->allocate_child())
                               MPICommunication(funct, false);
-                          worker_dist->spawn(*worker_dist);
+                          tbb::task::spawn(*worker_dist);
                           worker_index++;
                         }
                       part += 1;
@@ -539,14 +537,14 @@ namespace internal
                           tbb::empty_task *final =
                             new (worker[worker_index - 1]->allocate_child())
                               tbb::empty_task;
-                          worker[spawn_index]->spawn(*final);
+                          tbb::task::spawn(*final);
                           spawn_index_child = worker_index - 1;
                         }
                     }
                   if (evens == odds)
                     {
                       Assert(spawn_index_child >= 0, ExcInternalError());
-                      worker[spawn_index]->spawn(*worker[spawn_index_child]);
+                      tbb::task::spawn(*worker[spawn_index_child]);
                     }
                   root->wait_for_all();
                   root->destroy(*root);
@@ -568,7 +566,7 @@ namespace internal
                       color::PartitionWork *worker =
                         new (root->allocate_child())
                           color::PartitionWork(funct, color, *this, false);
-                      root->spawn(*worker);
+                      tbb::empty_task::spawn(*worker);
                       root->wait_for_all();
                       root->destroy(*root);
                     }

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.