]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Parallelize some operations.
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 30 Jun 2017 15:42:45 +0000 (09:42 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 30 Jun 2017 18:12:44 +0000 (12:12 -0600)
The previous refactoring allows parallelizing renumbering for vertices,
cells, and faces, since these all work on mutually independent data
structures.

source/dofs/dof_handler_policy.cc

index e4fbc271b12fb2c9f95954a49143dce4b576b91e..49618a60516c03239985547f18cdfc1815c4aab8 100644 (file)
@@ -20,6 +20,7 @@
 #include <deal.II/base/work_stream.h>
 #include <deal.II/base/utilities.h>
 #include <deal.II/base/memory_consumption.h>
+#include <deal.II/base/thread_management.h>
 #include <deal.II/grid/tria.h>
 #include <deal.II/grid/tria_iterator.h>
 #include <deal.II/dofs/dof_handler.h>
@@ -782,9 +783,23 @@ namespace internal
           if (dim == 1)
             Assert (indices == IndexSet(0), ExcNotImplemented());
 
-          renumber_vertex_dofs (new_numbers, indices, dof_handler, check_validity);
-          renumber_face_dofs (new_numbers, indices, dof_handler);
-          renumber_cell_dofs (new_numbers, indices, dof_handler);
+          // renumber DoF indices on vertices, cells, and faces. this
+          // can be done in parallel because the respective functions
+          // work on separate data structures
+          Threads::TaskGroup<> tasks;
+          tasks += Threads::new_task ([&]()
+          {
+            renumber_vertex_dofs (new_numbers, indices, dof_handler, check_validity);
+          });
+          tasks += Threads::new_task ([&]()
+          {
+            renumber_face_dofs (new_numbers, indices, dof_handler);
+          });
+          tasks += Threads::new_task ([&]()
+          {
+            renumber_cell_dofs (new_numbers, indices, dof_handler);
+          });
+          tasks.join_all ();
 
           // update the cache used for cell dof indices
           update_all_level_cell_dof_indices_caches(dof_handler);

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.