From: Matthias Maier Date: Thu, 6 Jan 2022 14:15:23 +0000 (-0600) Subject: provide hash operator to tbb::concurrent_unordered_map X-Git-Tag: v9.3.3~5^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc8479ac62b9888eb09d5936eb48eab0a268fcc8;p=dealii.git provide hash operator to tbb::concurrent_unordered_map --- diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index 061ea1c461..953195557b 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -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 &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; @@ -942,8 +959,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) @@ -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, - 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 2a15805aa8..6fd05f036f 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