From: Bruno Turcksin Date: Thu, 16 Mar 2023 17:41:24 +0000 (-0400) Subject: Make more functions __host__ __device__ X-Git-Tag: v9.5.0-rc1~349^2~14 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2667eb651244e921bee79be1d3ab702b5a28507e;p=dealii.git Make more functions __host__ __device__ --- diff --git a/include/deal.II/base/geometry_info.h b/include/deal.II/base/geometry_info.h index 76de3d69ac..4ae92aa8c3 100644 --- a/include/deal.II/base/geometry_info.h +++ b/include/deal.II/base/geometry_info.h @@ -819,7 +819,7 @@ public: * mapping from the symbolic flags defined in the RefinementPossibilities * base class to actual numerical values (the array indices). */ - operator std::uint8_t() const; + DEAL_II_HOST_DEVICE operator std::uint8_t() const; /** * Return the union of the refinement flags represented by the current @@ -2814,7 +2814,7 @@ inline RefinementCase::RefinementCase(const std::uint8_t refinement_case) template -inline RefinementCase::operator std::uint8_t() const +inline DEAL_II_HOST_DEVICE RefinementCase::operator std::uint8_t() const { return value; } diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index df2eb7c0e8..e14a858879 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -443,22 +443,22 @@ namespace Utilities * be an integer type and the exponent @p iexp must not be negative. */ template - constexpr T + constexpr DEAL_II_HOST_DEVICE T pow(const T base, const int iexp) { #if defined(DEBUG) && !defined(DEAL_II_CXX14_CONSTEXPR_BUG) // Up to __builtin_expect this is the same code as in the 'Assert' macro. // The call to __builtin_expect turns out to be problematic. - if (!(iexp >= 0)) - ::dealii::deal_II_exceptions::internals::issue_error_noreturn( - ::dealii::deal_II_exceptions::internals::ExceptionHandling:: - abort_or_throw_on_exception, - __FILE__, - __LINE__, - __PRETTY_FUNCTION__, - "iexp>=0", - "ExcMessage(\"The exponent must not be negative!\")", - ExcMessage("The exponent must not be negative!")); + KOKKOS_IF_ON_HOST(if (!(iexp >= 0))::dealii::deal_II_exceptions::internals:: + issue_error_noreturn( + ::dealii::deal_II_exceptions::internals:: + ExceptionHandling::abort_or_throw_on_exception, + __FILE__, + __LINE__, + __PRETTY_FUNCTION__, + "iexp>=0", + "ExcMessage(\"The exponent must not be negative!\")", + ExcMessage("The exponent must not be negative!"));) #endif // The "exponentiation by squaring" algorithm used below has to be // compressed to one statement due to C++11's restrictions on constexpr