From: Timo Heister Date: Thu, 28 May 2020 20:54:42 +0000 (-0400) Subject: use DEAL_II_WITH_TBB instead of DEAL_II_WITH_THREADS X-Git-Tag: v9.3.0-rc1~1518^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fbed6b0f9112bb63b109bfc129c62a68c76ef66;p=dealii.git use DEAL_II_WITH_TBB instead of DEAL_II_WITH_THREADS - replace WITH_THREADS with WITH_TBB (curently identical) - step-69: always do background writing - muparser: init always thread-safe - --- diff --git a/bundled/muparser_v2_2_4/CMakeLists.txt b/bundled/muparser_v2_2_4/CMakeLists.txt index 794f350992..80b29f0690 100644 --- a/bundled/muparser_v2_2_4/CMakeLists.txt +++ b/bundled/muparser_v2_2_4/CMakeLists.txt @@ -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") diff --git a/examples/step-69/step-69.cc b/examples/step-69/step-69.cc index b2ebd869d2..645ef19477 100644 --- a/examples/step-69/step-69.cc +++ b/examples/step-69/step-69.cc @@ -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 { diff --git a/include/deal.II/base/parallel.h b/include/deal.II/base/parallel.h index 87fefbeccd..922ece42c6 100644 --- a/include/deal.II/base/parallel.h +++ b/include/deal.II/base/parallel.h @@ -29,7 +29,7 @@ #include #include -#ifdef DEAL_II_WITH_THREADS +#ifdef DEAL_II_WITH_TBB # include # include # include @@ -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::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; diff --git a/include/deal.II/base/work_stream.h b/include/deal.II/base/work_stream.h index 1d03dbf89d..adca7b21d9 100644 --- a/include/deal.II/base/work_stream.h +++ b/include/deal.II/base/work_stream.h @@ -27,7 +27,7 @@ # include # include -# ifdef DEAL_II_WITH_THREADS +# ifdef DEAL_II_WITH_TBB # include # 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 diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index 50c3748f47..7f6850212d 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -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 diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index f0f30a91f8..874eeb2607 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -40,7 +40,7 @@ #include #include -#ifdef DEAL_II_WITH_THREADS +#ifdef DEAL_II_WITH_TBB # include DEAL_II_DISABLE_EXTRA_DIAGNOSTICS @@ -434,7 +434,7 @@ MatrixFree::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::clear() -#ifdef DEAL_II_WITH_THREADS +#ifdef DEAL_II_WITH_TBB namespace internal { @@ -1958,7 +1958,7 @@ MatrixFree::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, diff --git a/source/base/parallel.cc b/source/base/parallel.cc index da998a6fe6..e356b5e188 100644 --- a/source/base/parallel.cc +++ b/source/base/parallel.cc @@ -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()) , in_use(false) diff --git a/source/matrix_free/task_info.cc b/source/matrix_free/task_info.cc index bbea242a28..0f352297e4 100644 --- a/source/matrix_free/task_info.cc +++ b/source/matrix_free/task_info.cc @@ -24,7 +24,7 @@ #include -#ifdef DEAL_II_WITH_THREADS +#ifdef DEAL_II_WITH_TBB # include # include # 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) {