]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move worker and copier 8825/head
authorDaniel Arndt <arndtd@ornl.gov>
Sun, 22 Sep 2019 05:00:21 +0000 (01:00 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Sun, 22 Sep 2019 05:04:27 +0000 (01:04 -0400)
source/dofs/dof_tools_constraints.cc
source/numerics/data_out.cc

index b9ab377ea2e47f77765ca774084005f594f4f027..55de132df61c8450e8df6a4c870521b3730799b0 100644 (file)
@@ -2819,9 +2819,7 @@ namespace DoFTools
 #endif
           }
 
-        WorkStream::run(
-          coarse_grid.begin_active(),
-          coarse_grid.end(),
+        auto worker =
           [coarse_component,
            &coarse_grid,
            &coarse_to_fine_grid_map,
@@ -2836,7 +2834,9 @@ namespace DoFTools
                                                        coarse_grid.get_fe(),
                                                        coarse_to_fine_grid_map,
                                                        parameter_dofs);
-          },
+          };
+
+        auto copier =
           [coarse_component,
            &coarse_grid,
            &weight_mapping,
@@ -2848,9 +2848,14 @@ namespace DoFTools
                                                     weight_mapping,
                                                     is_called_in_parallel,
                                                     weights);
-          },
-          scratch,
-          copy_data);
+          };
+
+        WorkStream::run(coarse_grid.begin_active(),
+                        coarse_grid.end(),
+                        worker,
+                        copier,
+                        scratch,
+                        copy_data);
 
 #ifdef DEAL_II_WITH_MPI
         for (std::size_t i = 0;
index 2feb97861fe424dd8bf4c60349b697e9dd67888a..57f168ff53abcdf2cc5a8942a843f125201feda6 100644 (file)
@@ -807,36 +807,37 @@ DataOut<dim, DoFHandlerType>::build_patches(
                 update_flags,
                 cell_to_patch_index_map);
 
+  auto worker = [this, n_subdivisions, curved_cell_region](
+                  const std::pair<cell_iterator, unsigned int> *cell_and_index,
+                  internal::DataOutImplementation::ParallelData<
+                    DoFHandlerType::dimension,
+                    DoFHandlerType::space_dimension> &scratch_data,
+                  // this function doesn't actually need a copy data object --
+                  // it just writes everything right into the output array
+                  int) {
+    this->build_one_patch(cell_and_index,
+                          scratch_data,
+                          n_subdivisions,
+                          curved_cell_region);
+  };
+
   // now build the patches in parallel
   if (all_cells.size() > 0)
-    WorkStream::run(
-      all_cells.data(),
-      all_cells.data() + all_cells.size(),
-      [this, n_subdivisions, curved_cell_region](
-        const std::pair<cell_iterator, unsigned int> *cell_and_index,
-        internal::DataOutImplementation::ParallelData<
-          DoFHandlerType::dimension,
-          DoFHandlerType::space_dimension> &scratch_data,
-        // this function doesn't actually need a copy data object -- it just
-        // writes everything right into the output array
-        int) {
-        this->build_one_patch(cell_and_index,
-                              scratch_data,
-                              n_subdivisions,
-                              curved_cell_region);
-      },
-      // no copy-local-to-global function needed here
-      std::function<void(const int)>(),
-      thread_data,
-      /* dummy CopyData object = */ 0,
-      // experimenting shows that we can make things run a bit
-      // faster if we increase the number of cells we work on
-      // per item (i.e., WorkStream's chunk_size argument,
-      // about 10% improvement) and the items in flight at any
-      // given time (another 5% on the testcase discussed in
-      // @ref workstream_paper, on 32 cores) and if
-      8 * MultithreadInfo::n_threads(),
-      64);
+    WorkStream::run(all_cells.data(),
+                    all_cells.data() + all_cells.size(),
+                    worker,
+                    // no copy-local-to-global function needed here
+                    std::function<void(const int)>(),
+                    thread_data,
+                    /* dummy CopyData object = */ 0,
+                    // experimenting shows that we can make things run a bit
+                    // faster if we increase the number of cells we work on
+                    // per item (i.e., WorkStream's chunk_size argument,
+                    // about 10% improvement) and the items in flight at any
+                    // given time (another 5% on the testcase discussed in
+                    // @ref workstream_paper, on 32 cores) and if
+                    8 * MultithreadInfo::n_threads(),
+                    64);
 }
 
 

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.