From 5d136ccda22dd102769f0fe14cb0a12703142f44 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 16 Dec 2022 09:54:01 -0500 Subject: [PATCH] Static asserts for reducers --- core/src/Kokkos_Parallel_Reduce.hpp | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/core/src/Kokkos_Parallel_Reduce.hpp b/core/src/Kokkos_Parallel_Reduce.hpp index d44bd89a9b..68a2155bbd 100644 --- a/core/src/Kokkos_Parallel_Reduce.hpp +++ b/core/src/Kokkos_Parallel_Reduce.hpp @@ -37,6 +37,7 @@ struct Sum { // Required using reducer = Sum; using value_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && !std::is_array_v); using result_view_type = Kokkos::View; @@ -81,6 +82,7 @@ struct Prod { // Required using reducer = Prod; using value_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && !std::is_array_v); using result_view_type = Kokkos::View; @@ -125,6 +127,7 @@ struct Min { // Required using reducer = Min; using value_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && !std::is_array_v); using result_view_type = Kokkos::View; @@ -171,6 +174,7 @@ struct Max { // Required using reducer = Max; using value_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && !std::is_array_v); using result_view_type = Kokkos::View; @@ -218,6 +222,7 @@ struct LAnd { // Required using reducer = LAnd; using value_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && !std::is_array_v); using result_view_type = Kokkos::View; @@ -263,6 +268,7 @@ struct LOr { // Required using reducer = LOr; using value_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && !std::is_array_v); using result_view_type = Kokkos::View; @@ -309,6 +315,7 @@ struct BAnd { // Required using reducer = BAnd; using value_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && !std::is_array_v); using result_view_type = Kokkos::View; @@ -355,6 +362,7 @@ struct BOr { // Required using reducer = BOr; using value_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && !std::is_array_v); using result_view_type = Kokkos::View; @@ -412,6 +420,9 @@ struct MinLoc { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -465,6 +476,9 @@ struct MaxLoc { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -528,6 +542,8 @@ template struct MinMax { private: using scalar_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); public: // Required @@ -599,6 +615,9 @@ struct MinMaxLoc { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -668,6 +687,9 @@ struct MaxFirstLoc { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -729,6 +751,9 @@ struct MaxFirstLocCustomComparator { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -795,6 +820,9 @@ struct MinFirstLoc { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -856,6 +884,9 @@ struct MinFirstLocCustomComparator { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -922,6 +953,9 @@ struct MinMaxFirstLastLoc { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -994,6 +1028,9 @@ struct MinMaxFirstLastLocCustomComparator { private: using scalar_type = std::remove_cv_t; using index_type = std::remove_cv_t; + static_assert(!std::is_pointer_v && + !std::is_array_v); + static_assert(std::is_integral_v); public: // Required @@ -1078,6 +1115,7 @@ template struct FirstLoc { private: using index_type = std::remove_cv_t; + static_assert(std::is_integral_v); public: // Required @@ -1141,6 +1179,7 @@ template struct LastLoc { private: using index_type = std::remove_cv_t; + static_assert(std::is_integral_v); public: // Required @@ -1207,6 +1246,7 @@ template struct StdIsPartitioned { private: using index_type = std::remove_cv_t; + static_assert(std::is_integral_v); public: // Required @@ -1278,6 +1318,7 @@ template struct StdPartitionPoint { private: using index_type = std::remove_cv_t; + static_assert(std::is_integral_v); public: // Required