]> https://gitweb.dealii.org/ - dealii.git/commitdiff
use DEAL_II_WITH_TBB instead of DEAL_II_WITH_THREADS 10413/head
authorTimo Heister <timo.heister@gmail.com>
Thu, 28 May 2020 20:54:42 +0000 (16:54 -0400)
committerTimo Heister <timo.heister@gmail.com>
Thu, 28 May 2020 20:55:02 +0000 (16:55 -0400)
- replace WITH_THREADS with WITH_TBB (curently identical)
- step-69: always do background writing
- muparser: init always thread-safe
-

bundled/muparser_v2_2_4/CMakeLists.txt
examples/step-69/step-69.cc
include/deal.II/base/parallel.h
include/deal.II/base/work_stream.h
include/deal.II/lac/vector_operations_internal.h
include/deal.II/matrix_free/matrix_free.templates.h
source/base/parallel.cc
source/matrix_free/task_info.cc

index 794f350992cf429e6b96e5ce644a6ec1ad038f92..80b29f069012c3b84cd7624b72b4c1841dfed0d5 100644 (file)
@@ -38,6 +38,4 @@ src/muParserTest.cpp
 src/muParserTokenReader.cpp
   )
 
-#IF(DEAL_II_WITH_THREADS)
-#  DEAL_II_ADD_DEFINITIONS(obj_muparser "FP_USE_THREAD_SAFE_EVAL")
-#ENDIF()
+#DEAL_II_ADD_DEFINITIONS(obj_muparser "FP_USE_THREAD_SAFE_EVAL")
index b2ebd869d2d4bedd81051f735556338a8dbea3cc..645ef19477b5d462186839d9a2b3a297adcb249b 100644 (file)
@@ -2525,11 +2525,7 @@ namespace Step69
                   output_granularity,
                   "time interval for output");
 
-#ifdef DEAL_II_WITH_THREADS
     asynchronous_writeback = true;
-#else
-    asynchronous_writeback = false;
-#endif
     add_parameter("asynchronous writeback",
                   asynchronous_writeback,
                   "Write out solution in a background thread performing IO");
@@ -2885,15 +2881,7 @@ namespace Step69
     // run in the background.
     if (asynchronous_writeback)
       {
-#ifdef DEAL_II_WITH_THREADS
         background_thread_state = std::async(std::launch::async, output_worker);
-#else
-        AssertThrow(
-          false,
-          ExcMessage(
-            "\"asynchronous_writeback\" was set to true but deal.II was built "
-            "without thread support (\"DEAL_II_WITH_THREADS=false\")."));
-#endif
       }
     else
       {
index 87fefbeccd702822bf2d6069d62d864b7a6ca7e0..922ece42c6933320220ffc39356f7ee136702801 100644 (file)
@@ -29,7 +29,7 @@
 #include <memory>
 #include <tuple>
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
 #  include <tbb/blocked_range.h>
 #  include <tbb/parallel_for.h>
 #  include <tbb/parallel_reduce.h>
@@ -147,7 +147,7 @@ namespace parallel
 
 
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
     /**
      * Encapsulate tbb::parallel_for.
      */
@@ -214,7 +214,7 @@ namespace parallel
             const Predicate &    predicate,
             const unsigned int   grainsize)
   {
-#ifndef DEAL_II_WITH_THREADS
+#ifndef DEAL_II_WITH_TBB
     // make sure we don't get compiler
     // warnings about unused arguments
     (void)grainsize;
@@ -270,7 +270,7 @@ namespace parallel
             const Predicate &     predicate,
             const unsigned int    grainsize)
   {
-#ifndef DEAL_II_WITH_THREADS
+#ifndef DEAL_II_WITH_TBB
     // make sure we don't get compiler
     // warnings about unused arguments
     (void)grainsize;
@@ -329,7 +329,7 @@ namespace parallel
             const Predicate &     predicate,
             const unsigned int    grainsize)
   {
-#ifndef DEAL_II_WITH_THREADS
+#ifndef DEAL_II_WITH_TBB
     // make sure we don't get compiler
     // warnings about unused arguments
     (void)grainsize;
@@ -355,7 +355,7 @@ namespace parallel
 
   namespace internal
   {
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
     /**
      * Take a range argument and call the given function with its begin and
      * end.
@@ -447,7 +447,7 @@ namespace parallel
                      const Function &                          f,
                      const unsigned int                        grainsize)
   {
-#ifndef DEAL_II_WITH_THREADS
+#ifndef DEAL_II_WITH_TBB
     // make sure we don't get compiler
     // warnings about unused arguments
     (void)grainsize;
@@ -528,7 +528,7 @@ namespace parallel
 
   namespace internal
   {
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
     /**
      * A class that conforms to the Body requirements of the TBB
      * parallel_reduce function. The first template argument denotes the type
@@ -682,7 +682,7 @@ namespace parallel
                             const typename identity<RangeType>::type &end,
                             const unsigned int                        grainsize)
   {
-#ifndef DEAL_II_WITH_THREADS
+#ifndef DEAL_II_WITH_TBB
     // make sure we don't get compiler
     // warnings about unused arguments
     (void)grainsize;
@@ -720,7 +720,7 @@ namespace parallel
        */
       TBBPartitioner();
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
       /**
        * Destructor. Check that the object is not in use any more, i.e., all
        * loops have been completed.
@@ -806,7 +806,7 @@ namespace internal
 
 namespace parallel
 {
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
 
   namespace internal
   {
@@ -839,7 +839,7 @@ namespace parallel
     const std::size_t end,
     const std::size_t minimum_parallel_grain_size) const
   {
-#ifndef DEAL_II_WITH_THREADS
+#ifndef DEAL_II_WITH_TBB
     // make sure we don't get compiler
     // warnings about unused arguments
     (void)minimum_parallel_grain_size;
index 1d03dbf89dd1048af8650165fec81fd88283d1d4..adca7b21d96dc2a2268dffea1a5cf6343272687c 100644 (file)
@@ -27,7 +27,7 @@
 #  include <deal.II/base/thread_local_storage.h>
 #  include <deal.II/base/thread_management.h>
 
-#  ifdef DEAL_II_WITH_THREADS
+#  ifdef DEAL_II_WITH_TBB
 #    include <tbb/pipeline.h>
 #  endif
 
@@ -156,7 +156,7 @@ DEAL_II_NAMESPACE_OPEN
  */
 namespace WorkStream
 {
-#  ifdef DEAL_II_WITH_THREADS
+#  ifdef DEAL_II_WITH_TBB
 
   namespace internal
   {
@@ -880,7 +880,7 @@ namespace WorkStream
   } // namespace internal
 
 
-#  endif // DEAL_II_WITH_THREADS
+#  endif // DEAL_II_WITH_TBB
 
 
   /**
@@ -1023,7 +1023,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
+#  ifdef DEAL_II_WITH_TBB
     if (MultithreadInfo::n_threads() == 1)
 #  endif
       {
@@ -1043,7 +1043,7 @@ namespace WorkStream
               copier(copy_data);
           }
       }
-#  ifdef DEAL_II_WITH_THREADS
+#  ifdef DEAL_II_WITH_TBB
     else // have TBB and use more than one thread
       {
         // Check that the copier exist
@@ -1198,7 +1198,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
+#  ifdef DEAL_II_WITH_TBB
     if (MultithreadInfo::n_threads() == 1)
 #  endif
       {
@@ -1222,7 +1222,7 @@ namespace WorkStream
                 copier(copy_data);
             }
       }
-#  ifdef DEAL_II_WITH_THREADS
+#  ifdef DEAL_II_WITH_TBB
     else // have TBB and use more than one thread
       {
         // loop over the various colors of what we're given
index 50c3748f47c62245f07565faeb959f7411f62095..7f6850212de74b320e12111feba8e483f71d55d1 100644 (file)
@@ -89,7 +89,7 @@ namespace internal
 
 
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
     /**
      * This struct takes the loop range from the tbb parallel for loop and
      * translates it to the actual ranges of the for loop within the vector. It
@@ -153,7 +153,7 @@ namespace internal
       const std::shared_ptr<::dealii::parallel::internal::TBBPartitioner>
         &partitioner)
     {
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
       const size_type vec_size = end - start;
       // only go to the parallel function in case there are at least 4 parallel
       // items, otherwise the overhead is too large
@@ -1229,7 +1229,7 @@ namespace internal
 
 
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
     /**
      * This struct takes the loop range from the tbb parallel for loop and
      * translates it to the actual ranges of the reduction loop inside the
@@ -1358,7 +1358,7 @@ namespace internal
       const std::shared_ptr<::dealii::parallel::internal::TBBPartitioner>
         &partitioner)
     {
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
       const size_type vec_size = end - start;
       // only go to the parallel function in case there are at least 4 parallel
       // items, otherwise the overhead is too large
index f0f30a91f86077b4af05e43e6e24866ee1be841c..874eeb2607b83bfea44f055808617499b16c892c 100644 (file)
@@ -40,7 +40,7 @@
 #include <deal.II/matrix_free/face_setup_internal.h>
 #include <deal.II/matrix_free/matrix_free.h>
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
 #  include <deal.II/base/parallel.h>
 
 DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
@@ -434,7 +434,7 @@ MatrixFree<dim, Number, VectorizedArrayType>::internal_reinit(
 
         // initialize the basic multithreading information that needs to be
         // passed to the DoFInfo structure
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
       if (additional_data.tasks_parallel_scheme != AdditionalData::none &&
           MultithreadInfo::n_threads() > 1)
         {
@@ -1849,7 +1849,7 @@ MatrixFree<dim, Number, VectorizedArrayType>::clear()
 
 
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
 
 namespace internal
 {
@@ -1958,7 +1958,7 @@ MatrixFree<dim, Number, VectorizedArrayType>::make_connectivity_graph_faces(
   DynamicSparsityPattern &connectivity)
 {
   (void)connectivity;
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
   // step 1: build map between the index in the matrix-free context and the
   // one in the triangulation
   tbb::concurrent_unordered_map<std::pair<unsigned int, unsigned int>,
index da998a6fe68c152a9a7c850936068a9cd25bd27c..e356b5e188cc5b3ea2ce61836a68702cd966dda5 100644 (file)
@@ -53,7 +53,7 @@ namespace parallel
 {
   namespace internal
   {
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
     TBBPartitioner::TBBPartitioner()
       : my_partitioner(std::make_shared<tbb::affinity_partitioner>())
       , in_use(false)
index bbea242a287ac69568bb49a1f8cc283b1a42249e..0f352297e46837b2298d6c3631872e090fc87d6d 100644 (file)
@@ -24,7 +24,7 @@
 #include <deal.II/matrix_free/task_info.h>
 
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
 #  include <tbb/blocked_range.h>
 #  include <tbb/parallel_for.h>
 #  define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
@@ -45,7 +45,7 @@ namespace internal
 {
   namespace MatrixFreeFunctions
   {
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
 
     // This defines the TBB data structures that are needed to schedule the
     // partition-partition variant
@@ -331,7 +331,7 @@ namespace internal
       const bool         do_compress;
     };
 
-#endif // DEAL_II_WITH_THREADS
+#endif // DEAL_II_WITH_TBB
 
 
 
@@ -350,7 +350,7 @@ namespace internal
 
       funct.vector_update_ghosts_start();
 
-#ifdef DEAL_II_WITH_THREADS
+#ifdef DEAL_II_WITH_TBB
 
       if (scheme != none)
         {

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.