From 510ad7ed11d6f1e3016d2f8234ad53532179b2a6 Mon Sep 17 00:00:00 2001 From: Yuuichi Asahi Date: Thu, 24 Oct 2024 16:47:07 +0900 Subject: [PATCH] fix Kokkos::numbers::pi usage --- fft/unit_test/Test_Utils.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fft/unit_test/Test_Utils.hpp b/fft/unit_test/Test_Utils.hpp index 31ec53d3..d328f8fe 100644 --- a/fft/unit_test/Test_Utils.hpp +++ b/fft/unit_test/Test_Utils.hpp @@ -81,10 +81,12 @@ template void fft1(ViewType& in, ViewType& out) { using value_type = typename ViewType::non_const_value_type; using real_value_type = KokkosFFT::Impl::base_floating_point_type; + using Kokkos::numbers::pi_v; static_assert(KokkosFFT::Impl::is_complex_v, "fft1: ViewType must be complex"); + constexpr auto pi = pi_v; const value_type I(0.0, 1.0); std::size_t L = in.size(); @@ -99,8 +101,7 @@ void fft1(ViewType& in, ViewType& out) { Kokkos::parallel_reduce( Kokkos::TeamThreadRange(team_member, L), [&](const int i, value_type& lsum) { - auto phase = -2 * I * Kokkos::numbers::pi * - static_cast(i) / + auto phase = -2 * I * pi * static_cast(i) / static_cast(L); auto tmp_in = in(i); @@ -128,10 +129,12 @@ template void ifft1(ViewType& in, ViewType& out) { using value_type = typename ViewType::non_const_value_type; using real_value_type = KokkosFFT::Impl::base_floating_point_type; + using Kokkos::numbers::pi_v; static_assert(KokkosFFT::Impl::is_complex_v, "ifft1: ViewType must be complex"); + constexpr auto pi = pi_v; const value_type I(0.0, 1.0); std::size_t L = in.size(); @@ -146,8 +149,7 @@ void ifft1(ViewType& in, ViewType& out) { Kokkos::parallel_reduce( Kokkos::TeamThreadRange(team_member, L), [&](const int i, value_type& lsum) { - auto phase = 2 * I * Kokkos::numbers::pi * - static_cast(i) / + auto phase = 2 * I * pi * static_cast(i) / static_cast(L); auto tmp_in = in(i);