]> https://gitweb.dealii.org/ - dealii.git/commitdiff
provide hash operator to tbb::concurrent_unordered_map
authorMatthias Maier <tamiko@43-1.org>
Thu, 6 Jan 2022 14:15:23 +0000 (08:15 -0600)
committerMatthias Maier <tamiko@43-1.org>
Wed, 12 Jan 2022 10:19:20 +0000 (04:19 -0600)
include/deal.II/matrix_free/matrix_free.templates.h
source/matrix_free/task_info.cc

index 061ea1c461bfbdb8e2f9c587fc1a6bb71100dbec..953195557bf8bdbabff6b4ae7eda68298635831b 100644 (file)
@@ -916,13 +916,30 @@ namespace internal
 {
 #ifdef DEAL_II_WITH_TBB
 
+#  ifdef DEAL_II_TBB_WITH_ONEAPI
+  struct unsigned_int_pair_hash
+  {
+    std::size_t
+    operator()(const std::pair<unsigned int, unsigned int> &pair) const
+    {
+      return std::hash<unsigned int>()(pair.first) ^
+             std::hash<unsigned int>()(pair.second);
+    }
+  };
+#  endif
+
   inline void
   fill_index_subrange(
     const unsigned int                                        begin,
     const unsigned int                                        end,
     const std::vector<std::pair<unsigned int, unsigned int>> &cell_level_index,
     tbb::concurrent_unordered_map<std::pair<unsigned int, unsigned int>,
-                                  unsigned int> &             map)
+                                  unsigned int
+#  ifdef DEAL_II_TBB_WITH_ONEAPI
+                                  ,
+                                  unsigned_int_pair_hash
+#  endif
+                                  > &map)
   {
     if (cell_level_index.empty())
       return;
@@ -942,8 +959,13 @@ namespace internal
     const dealii::Triangulation<dim> &                        tria,
     const std::vector<std::pair<unsigned int, unsigned int>> &cell_level_index,
     const tbb::concurrent_unordered_map<std::pair<unsigned int, unsigned int>,
-                                        unsigned int> &       map,
-    DynamicSparsityPattern &connectivity_direct)
+                                        unsigned int
+#  ifdef DEAL_II_TBB_WITH_ONEAPI
+                                        ,
+                                        unsigned_int_pair_hash
+#  endif
+                                        > &map,
+    DynamicSparsityPattern &               connectivity_direct)
   {
     std::vector<types::global_dof_index> new_indices;
     for (unsigned int cell = begin; cell < end; ++cell)
@@ -1477,7 +1499,12 @@ namespace internal
             // 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>,
-                                          unsigned int>
+                                          unsigned int
+#  ifdef DEAL_II_TBB_WITH_ONEAPI
+                                          ,
+                                          unsigned_int_pair_hash
+#  endif
+                                          >
               map;
             dealii::parallel::apply_to_subranges(
               0,
index 2a15805aa8890e67085925ff6e225fc51957a8fd..6fd05f036f7ff8a4d8012f0310718e3bc9b402ba 100644 (file)
@@ -28,7 +28,9 @@
 #  include <tbb/blocked_range.h>
 #  include <tbb/parallel_for.h>
 #  include <tbb/task.h>
-#  include <tbb/task_scheduler_init.h>
+#  ifndef DEAL_II_TBB_WITH_ONEAPI
+#    include <tbb/task_scheduler_init.h>
+#  endif
 #endif
 
 #include <iostream>

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.