From e0b3a26ea04accac62884ae9088bd41344c2622c Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 6 Jan 2022 08:15:23 -0600 Subject: [PATCH] provide hash operator to tbb::concurrent_unordered_map --- .../matrix_free/matrix_free.templates.h | 35 ++++++++++++++++--- source/matrix_free/task_info.cc | 4 ++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index 7b5c1911eb..0a10940d1e 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -906,13 +906,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 &pair) const + { + return std::hash()(pair.first) ^ + std::hash()(pair.second); + } + }; +# endif + inline void fill_index_subrange( const unsigned int begin, const unsigned int end, const std::vector> &cell_level_index, tbb::concurrent_unordered_map, - unsigned int> & map) + unsigned int +# ifdef DEAL_II_TBB_WITH_ONEAPI + , + unsigned_int_pair_hash +# endif + > &map) { if (cell_level_index.empty()) return; @@ -932,8 +949,13 @@ namespace internal const dealii::Triangulation & tria, const std::vector> &cell_level_index, const tbb::concurrent_unordered_map, - 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 new_indices; for (unsigned int cell = begin; cell < end; ++cell) @@ -1559,7 +1581,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, - unsigned int> + unsigned int +# ifdef DEAL_II_TBB_WITH_ONEAPI + , + unsigned_int_pair_hash +# endif + > map; dealii::parallel::apply_to_subranges( 0, diff --git a/source/matrix_free/task_info.cc b/source/matrix_free/task_info.cc index 16e72164d1..0c987505d9 100644 --- a/source/matrix_free/task_info.cc +++ b/source/matrix_free/task_info.cc @@ -28,7 +28,9 @@ # include # include # include -# include +# ifndef DEAL_II_TBB_WITH_ONEAPI +# include +# endif #endif #include -- 2.39.5