Skip to content

Commit

Permalink
Fix SIMD abs unit test accidentally using complex overload
Browse files Browse the repository at this point in the history
  • Loading branch information
dalg24 committed Jul 6, 2023
1 parent dada6e4 commit 778225f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions simd/unit_tests/TestSIMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,25 +316,30 @@ class divides {
};

class absolutes {
template <typename T>
static KOKKOS_FUNCTION auto abs_impl(T const& x) {
if constexpr (std::is_signed_v<T>) {
return Kokkos::abs(x);
}
return x;
}

public:
template <typename T>
auto on_host(T const& a) const {
return Kokkos::Experimental::abs(a);
}
template <typename T>
auto on_host_serial(T const& a) const {
if constexpr (std::is_signed_v<T>) {
return Kokkos::abs<T>(a);
}
return a;
return abs_impl(a);
}
template <typename T>
KOKKOS_INLINE_FUNCTION auto on_device(T const& a) const {
return Kokkos::Experimental::abs(a);
}
template <typename T>
KOKKOS_INLINE_FUNCTION auto on_device_serial(T const& a) const {
return Kokkos::abs<T>(a);
return abs_impl(a);
}
};

Expand Down

0 comments on commit 778225f

Please sign in to comment.