diff --git a/.clang-tidy b/.clang-tidy index d245e8ab..3efb5121 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception -Checks: '-*,modernize-type-traits,modernize-use-using,modernize-use-nullptr,cppcoreguidelines-pro-type-cstyle-cast' +Checks: '-*,modernize-type-traits,modernize-use-using,modernize-use-nullptr,cppcoreguidelines-pro-type-cstyle-cast,bugprone-reserved-identifier' FormatStyle: file HeaderFileExtensions: ['h','hh','hpp','hxx'] ImplementationFileExtensions: ['c','cc','cpp','cxx'] diff --git a/common/src/KokkosFFT_transpose.hpp b/common/src/KokkosFFT_transpose.hpp index 43061d66..0d459635 100644 --- a/common/src/KokkosFFT_transpose.hpp +++ b/common/src/KokkosFFT_transpose.hpp @@ -92,7 +92,7 @@ axis_type compute_transpose_extents( template void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, - const OutViewType& out, axis_type<2> /*_map*/) { + const OutViewType& out, axis_type<2> /*map*/) { constexpr std::size_t DIM = 2; using range_type = Kokkos::MDRangePolicy< @@ -115,7 +115,7 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, template void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, - const OutViewType& out, axis_type<3> _map) { + const OutViewType& out, axis_type<3> map) { constexpr std::size_t DIM = 3; constexpr std::size_t rank = InViewType::rank(); @@ -132,13 +132,13 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, tile_type{{4, 4, 4}} // [TO DO] Choose optimal tile sizes for each device ); - Kokkos::Array map = to_array(_map); + Kokkos::Array map_array = to_array(map); Kokkos::parallel_for( "KokkosFFT::transpose", range, KOKKOS_LAMBDA(int i0, int i1, int i2) { int dst_indices[rank] = {i0, i1, i2}; - int dst_i0 = dst_indices[map[0]]; - int dst_i1 = dst_indices[map[1]]; - int dst_i2 = dst_indices[map[2]]; + int dst_i0 = dst_indices[map_array[0]]; + int dst_i1 = dst_indices[map_array[1]]; + int dst_i2 = dst_indices[map_array[2]]; out(dst_i0, dst_i1, dst_i2) = in(i0, i1, i2); }); @@ -146,7 +146,7 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, template void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, - const OutViewType& out, axis_type<4> _map) { + const OutViewType& out, axis_type<4> map) { constexpr std::size_t DIM = 4; constexpr std::size_t rank = InViewType::rank(); @@ -164,15 +164,15 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, // [TO DO] Choose optimal tile sizes for each device ); - Kokkos::Array map = to_array(_map); + Kokkos::Array map_array = to_array(map); Kokkos::parallel_for( "KokkosFFT::transpose", range, KOKKOS_LAMBDA(int i0, int i1, int i2, int i3) { int dst_indices[rank] = {i0, i1, i2, i3}; - int dst_i0 = dst_indices[map[0]]; - int dst_i1 = dst_indices[map[1]]; - int dst_i2 = dst_indices[map[2]]; - int dst_i3 = dst_indices[map[3]]; + int dst_i0 = dst_indices[map_array[0]]; + int dst_i1 = dst_indices[map_array[1]]; + int dst_i2 = dst_indices[map_array[2]]; + int dst_i3 = dst_indices[map_array[3]]; out(dst_i0, dst_i1, dst_i2, dst_i3) = in(i0, i1, i2, i3); }); @@ -180,7 +180,7 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, template void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, - const OutViewType& out, axis_type<5> _map) { + const OutViewType& out, axis_type<5> map) { constexpr std::size_t DIM = 5; constexpr std::size_t rank = InViewType::rank(); @@ -199,16 +199,16 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, // [TO DO] Choose optimal tile sizes for each device ); - Kokkos::Array map = to_array(_map); + Kokkos::Array map_array = to_array(map); Kokkos::parallel_for( "KokkosFFT::transpose", range, KOKKOS_LAMBDA(int i0, int i1, int i2, int i3, int i4) { int dst_indices[rank] = {i0, i1, i2, i3, i4}; - int dst_i0 = dst_indices[map[0]]; - int dst_i1 = dst_indices[map[1]]; - int dst_i2 = dst_indices[map[2]]; - int dst_i3 = dst_indices[map[3]]; - int dst_i4 = dst_indices[map[4]]; + int dst_i0 = dst_indices[map_array[0]]; + int dst_i1 = dst_indices[map_array[1]]; + int dst_i2 = dst_indices[map_array[2]]; + int dst_i3 = dst_indices[map_array[3]]; + int dst_i4 = dst_indices[map_array[4]]; out(dst_i0, dst_i1, dst_i2, dst_i3, dst_i4) = in(i0, i1, i2, i3, i4); }); @@ -216,7 +216,7 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, template void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, - const OutViewType& out, axis_type<6> _map) { + const OutViewType& out, axis_type<6> map) { constexpr std::size_t DIM = 6; constexpr std::size_t rank = InViewType::rank(); @@ -236,17 +236,17 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, // [TO DO] Choose optimal tile sizes for each device ); - Kokkos::Array map = to_array(_map); + Kokkos::Array map_array = to_array(map); Kokkos::parallel_for( "KokkosFFT::transpose", range, KOKKOS_LAMBDA(int i0, int i1, int i2, int i3, int i4, int i5) { int dst_indices[rank] = {i0, i1, i2, i3, i4, i5}; - int dst_i0 = dst_indices[map[0]]; - int dst_i1 = dst_indices[map[1]]; - int dst_i2 = dst_indices[map[2]]; - int dst_i3 = dst_indices[map[3]]; - int dst_i4 = dst_indices[map[4]]; - int dst_i5 = dst_indices[map[5]]; + int dst_i0 = dst_indices[map_array[0]]; + int dst_i1 = dst_indices[map_array[1]]; + int dst_i2 = dst_indices[map_array[2]]; + int dst_i3 = dst_indices[map_array[3]]; + int dst_i4 = dst_indices[map_array[4]]; + int dst_i5 = dst_indices[map_array[5]]; out(dst_i0, dst_i1, dst_i2, dst_i3, dst_i4, dst_i5) = in(i0, i1, i2, i3, i4, i5); @@ -255,7 +255,7 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, template void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, - const OutViewType& out, axis_type<7> _map) { + const OutViewType& out, axis_type<7> map) { constexpr std::size_t DIM = 6; constexpr std::size_t rank = InViewType::rank(); @@ -275,19 +275,19 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, // [TO DO] Choose optimal tile sizes for each device ); - Kokkos::Array map = to_array(_map); + Kokkos::Array map_array = to_array(map); Kokkos::parallel_for( "KokkosFFT::transpose", range, KOKKOS_LAMBDA(int i0, int i1, int i2, int i3, int i4, int i5) { for (int i6 = 0; i6 < n6; i6++) { int dst_indices[rank] = {i0, i1, i2, i3, i4, i5, i6}; - int dst_i0 = dst_indices[map[0]]; - int dst_i1 = dst_indices[map[1]]; - int dst_i2 = dst_indices[map[2]]; - int dst_i3 = dst_indices[map[3]]; - int dst_i4 = dst_indices[map[4]]; - int dst_i5 = dst_indices[map[5]]; - int dst_i6 = dst_indices[map[6]]; + int dst_i0 = dst_indices[map_array[0]]; + int dst_i1 = dst_indices[map_array[1]]; + int dst_i2 = dst_indices[map_array[2]]; + int dst_i3 = dst_indices[map_array[3]]; + int dst_i4 = dst_indices[map_array[4]]; + int dst_i5 = dst_indices[map_array[5]]; + int dst_i6 = dst_indices[map_array[6]]; out(dst_i0, dst_i1, dst_i2, dst_i3, dst_i4, dst_i5, dst_i6) = in(i0, i1, i2, i3, i4, i5, i6); @@ -297,7 +297,7 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, template void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, - const OutViewType& out, axis_type<8> _map) { + const OutViewType& out, axis_type<8> map) { constexpr std::size_t DIM = 6; constexpr std::size_t rank = InViewType::rank(); @@ -319,21 +319,21 @@ void transpose_impl(const ExecutionSpace& exec_space, const InViewType& in, // [TO DO] Choose optimal tile sizes for each device ); - Kokkos::Array map = to_array(_map); + Kokkos::Array map_array = to_array(map); Kokkos::parallel_for( "KokkosFFT::transpose", range, KOKKOS_LAMBDA(int i0, int i1, int i2, int i3, int i4, int i5) { for (int i6 = 0; i6 < n6; i6++) { for (int i7 = 0; i7 < n7; i7++) { int dst_indices[rank] = {i0, i1, i2, i3, i4, i5, i6, i7}; - int dst_i0 = dst_indices[map[0]]; - int dst_i1 = dst_indices[map[1]]; - int dst_i2 = dst_indices[map[2]]; - int dst_i3 = dst_indices[map[3]]; - int dst_i4 = dst_indices[map[4]]; - int dst_i5 = dst_indices[map[5]]; - int dst_i6 = dst_indices[map[6]]; - int dst_i7 = dst_indices[map[7]]; + int dst_i0 = dst_indices[map_array[0]]; + int dst_i1 = dst_indices[map_array[1]]; + int dst_i2 = dst_indices[map_array[2]]; + int dst_i3 = dst_indices[map_array[3]]; + int dst_i4 = dst_indices[map_array[4]]; + int dst_i5 = dst_indices[map_array[5]]; + int dst_i6 = dst_indices[map_array[6]]; + int dst_i7 = dst_indices[map_array[7]]; out(dst_i0, dst_i1, dst_i2, dst_i3, dst_i4, dst_i5, dst_i6, dst_i7) = in(i0, i1, i2, i3, i4, i5, i6, i7); diff --git a/common/unit_test/Test_Helpers.cpp b/common/unit_test/Test_Helpers.cpp index 197d59c7..297d4997 100644 --- a/common/unit_test/Test_Helpers.cpp +++ b/common/unit_test/Test_Helpers.cpp @@ -37,15 +37,15 @@ void test_fft_freq(T atol = 1.0e-12) { auto h_x_odd_ref = Kokkos::create_mirror_view(x_odd_ref); auto h_x_even_ref = Kokkos::create_mirror_view(x_even_ref); - std::vector _x_odd_ref = {0, 1, 2, 3, 4, -4, -3, -2, -1}; - std::vector _x_even_ref = {0, 1, 2, 3, 4, -5, -4, -3, -2, -1}; + std::vector tmp_x_odd_ref = {0, 1, 2, 3, 4, -4, -3, -2, -1}; + std::vector tmp_x_even_ref = {0, 1, 2, 3, 4, -5, -4, -3, -2, -1}; - for (std::size_t i = 0; i < _x_odd_ref.size(); i++) { - h_x_odd_ref(i) = static_cast(_x_odd_ref.at(i)); + for (std::size_t i = 0; i < tmp_x_odd_ref.size(); i++) { + h_x_odd_ref(i) = static_cast(tmp_x_odd_ref.at(i)); } - for (std::size_t i = 0; i < _x_even_ref.size(); i++) { - h_x_even_ref(i) = static_cast(_x_even_ref.at(i)); + for (std::size_t i = 0; i < tmp_x_even_ref.size(); i++) { + h_x_even_ref(i) = static_cast(tmp_x_even_ref.at(i)); } Kokkos::deep_copy(x_odd_ref, h_x_odd_ref); @@ -82,15 +82,15 @@ void test_rfft_freq(T atol = 1.0e-12) { auto h_x_odd_ref = Kokkos::create_mirror_view(x_odd_ref); auto h_x_even_ref = Kokkos::create_mirror_view(x_even_ref); - std::vector _x_odd_ref = {0, 1, 2, 3, 4}; - std::vector _x_even_ref = {0, 1, 2, 3, 4, 5}; + std::vector tmp_x_odd_ref = {0, 1, 2, 3, 4}; + std::vector tmp_x_even_ref = {0, 1, 2, 3, 4, 5}; - for (std::size_t i = 0; i < _x_odd_ref.size(); i++) { - h_x_odd_ref(i) = static_cast(_x_odd_ref.at(i)); + for (std::size_t i = 0; i < tmp_x_odd_ref.size(); i++) { + h_x_odd_ref(i) = static_cast(tmp_x_odd_ref.at(i)); } - for (std::size_t i = 0; i < _x_even_ref.size(); i++) { - h_x_even_ref(i) = static_cast(_x_even_ref.at(i)); + for (std::size_t i = 0; i < tmp_x_even_ref.size(); i++) { + h_x_even_ref(i) = static_cast(tmp_x_even_ref.at(i)); } Kokkos::deep_copy(x_odd_ref, h_x_odd_ref); @@ -218,20 +218,20 @@ void test_fftshift1D_1DView(int n0) { auto h_x_ref = Kokkos::create_mirror_view(x_ref); auto h_y_ref = Kokkos::create_mirror_view(y_ref); - std::vector _x_ref; - std::vector _y_ref; + std::vector tmp_x_ref; + std::vector tmp_y_ref; if (n0 % 2 == 0) { - _x_ref = {0, 1, 2, 3, 4, -5, -4, -3, -2, -1}; - _y_ref = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4}; + tmp_x_ref = {0, 1, 2, 3, 4, -5, -4, -3, -2, -1}; + tmp_y_ref = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4}; } else { - _x_ref = {0, 1, 2, 3, 4, -4, -3, -2, -1}; - _y_ref = {-4, -3, -2, -1, 0, 1, 2, 3, 4}; + tmp_x_ref = {0, 1, 2, 3, 4, -4, -3, -2, -1}; + tmp_y_ref = {-4, -3, -2, -1, 0, 1, 2, 3, 4}; } for (int i = 0; i < n0; i++) { - h_x_ref(i) = static_cast(_x_ref.at(i)); - h_y_ref(i) = static_cast(_y_ref.at(i)); + h_x_ref(i) = static_cast(tmp_x_ref.at(i)); + h_y_ref(i) = static_cast(tmp_y_ref.at(i)); } Kokkos::deep_copy(x_ref, h_x_ref); @@ -261,34 +261,35 @@ void test_fftshift1D_2DView(int n0) { auto h_y_axis0_ref = Kokkos::create_mirror_view(y_axis0_ref); auto h_y_axis1_ref = Kokkos::create_mirror_view(y_axis1_ref); - std::vector _x_ref; - std::vector _y0_ref, _y1_ref; + std::vector tmp_x_ref; + std::vector tmp_y0_ref, tmp_y1_ref; if (n0 % 2 == 0) { - _x_ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}; - _y0_ref = { + tmp_x_ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -15, -14, -13, -12, -11, + -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}; + tmp_y0_ref = { 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, -15, -14, -13, -12, -11, 10, 11, 12, 13, 14, -5, -4, -3, -2, -1, -10, -9, -8, -7, -6, }; - _y1_ref = {-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, -15, -14, -13, -12, -11}; + tmp_y1_ref = {-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -15, -14, -13, -12, -11}; } else { - _x_ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}; - _y0_ref = {5, 6, 7, 8, 0, 1, 2, 3, 4, -13, -12, -11, -10, 9, - 10, 11, 12, 13, -4, -3, -2, -1, -9, -8, -7, -6, -5}; - _y1_ref = {-9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, -13, -12, -11, -10}; + tmp_x_ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}; + tmp_y0_ref = {5, 6, 7, 8, 0, 1, 2, 3, 4, -13, -12, -11, -10, 9, + 10, 11, 12, 13, -4, -3, -2, -1, -9, -8, -7, -6, -5}; + tmp_y1_ref = {-9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, -13, -12, -11, -10}; } for (int i1 = 0; i1 < n1; i1++) { for (int i0 = 0; i0 < n0; i0++) { std::size_t i = i0 + i1 * n0; - h_x_ref(i0, i1) = static_cast(_x_ref.at(i)); - h_y_axis0_ref(i0, i1) = static_cast(_y0_ref.at(i)); - h_y_axis1_ref(i0, i1) = static_cast(_y1_ref.at(i)); + h_x_ref(i0, i1) = static_cast(tmp_x_ref.at(i)); + h_y_axis0_ref(i0, i1) = static_cast(tmp_y0_ref.at(i)); + h_y_axis1_ref(i0, i1) = static_cast(tmp_y1_ref.at(i)); } } @@ -325,26 +326,28 @@ void test_fftshift2D_2DView(int n0) { auto h_x_ref = Kokkos::create_mirror_view(x_ref); auto h_y_ref = Kokkos::create_mirror_view(y_ref); - std::vector _x_ref; - std::vector _y_ref; + std::vector tmp_x_ref; + std::vector tmp_y_ref; if (n0 % 2 == 0) { - _x_ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}; - _y_ref = {-5, -4, -3, -2, -1, -10, -9, -8, -7, -6, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, -15, -14, -13, -12, -11, 10, 11, 12, 13, 14}; + tmp_x_ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -15, -14, -13, -12, -11, + -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}; + tmp_y_ref = {-5, -4, -3, -2, -1, -10, -9, -8, -7, -6, + 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, + -15, -14, -13, -12, -11, 10, 11, 12, 13, 14}; } else { - _x_ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}; - _y_ref = {-4, -3, -2, -1, -9, -8, -7, -6, -5, 5, 6, 7, 8, 0, - 1, 2, 3, 4, -13, -12, -11, -10, 9, 10, 11, 12, 13}; + tmp_x_ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}; + tmp_y_ref = {-4, -3, -2, -1, -9, -8, -7, -6, -5, 5, 6, 7, 8, 0, + 1, 2, 3, 4, -13, -12, -11, -10, 9, 10, 11, 12, 13}; } for (int i1 = 0; i1 < n1; i1++) { for (int i0 = 0; i0 < n0; i0++) { std::size_t i = i0 + i1 * n0; - h_x_ref(i0, i1) = static_cast(_x_ref.at(i)); - h_y_ref(i0, i1) = static_cast(_y_ref.at(i)); + h_x_ref(i0, i1) = static_cast(tmp_x_ref.at(i)); + h_y_ref(i0, i1) = static_cast(tmp_y_ref.at(i)); } } diff --git a/fft/src/KokkosFFT_Cuda_types.hpp b/fft/src/KokkosFFT_Cuda_types.hpp index 620cb914..fb2aef92 100644 --- a/fft/src/KokkosFFT_Cuda_types.hpp +++ b/fft/src/KokkosFFT_Cuda_types.hpp @@ -76,15 +76,15 @@ template struct transform_type> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; + using TransformTypeOnExecSpace = TransformType; - static constexpr _TransformType m_cuda_type = + static constexpr TransformTypeOnExecSpace m_cuda_type = std::is_same_v ? CUFFT_R2C : CUFFT_D2Z; - static constexpr _TransformType m_cpu_type = std::is_same_v - ? FFTWTransformType::R2C - : FFTWTransformType::D2Z; + static constexpr TransformTypeOnExecSpace m_cpu_type = + std::is_same_v ? FFTWTransformType::R2C + : FFTWTransformType::D2Z; - static constexpr _TransformType type() { + static constexpr TransformTypeOnExecSpace type() { if constexpr (std::is_same_v) { return m_cuda_type; } else { @@ -97,15 +97,15 @@ template struct transform_type, T2> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; + using TransformTypeOnExecSpace = TransformType; - static constexpr _TransformType m_cuda_type = + static constexpr TransformTypeOnExecSpace m_cuda_type = std::is_same_v ? CUFFT_C2R : CUFFT_Z2D; - static constexpr _TransformType m_cpu_type = std::is_same_v - ? FFTWTransformType::C2R - : FFTWTransformType::Z2D; + static constexpr TransformTypeOnExecSpace m_cpu_type = + std::is_same_v ? FFTWTransformType::C2R + : FFTWTransformType::Z2D; - static constexpr _TransformType type() { + static constexpr TransformTypeOnExecSpace type() { if constexpr (std::is_same_v) { return m_cuda_type; } else { @@ -119,15 +119,15 @@ struct transform_type, Kokkos::complex> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; + using TransformTypeOnExecSpace = TransformType; - static constexpr _TransformType m_cuda_type = + static constexpr TransformTypeOnExecSpace m_cuda_type = std::is_same_v ? CUFFT_C2C : CUFFT_Z2Z; - static constexpr _TransformType m_cpu_type = std::is_same_v - ? FFTWTransformType::C2C - : FFTWTransformType::Z2Z; + static constexpr TransformTypeOnExecSpace m_cpu_type = + std::is_same_v ? FFTWTransformType::C2C + : FFTWTransformType::Z2Z; - static constexpr _TransformType type() { + static constexpr TransformTypeOnExecSpace type() { if constexpr (std::is_same_v) { return m_cuda_type; } else { @@ -138,13 +138,13 @@ struct transform_type, template auto direction_type(Direction direction) { - static constexpr FFTDirectionType _FORWARD = + static constexpr FFTDirectionType FORWARD = std::is_same_v ? CUFFT_FORWARD : FFTW_FORWARD; - static constexpr FFTDirectionType _BACKWARD = + static constexpr FFTDirectionType BACKWARD = std::is_same_v ? CUFFT_INVERSE : FFTW_BACKWARD; - return direction == Direction::forward ? _FORWARD : _BACKWARD; + return direction == Direction::forward ? FORWARD : BACKWARD; } #else template @@ -173,20 +173,18 @@ template struct transform_type> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - static constexpr _TransformType m_type = + static constexpr cufftType m_type = std::is_same_v ? CUFFT_R2C : CUFFT_D2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr cufftType type() { return m_type; }; }; template struct transform_type, T2> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - static constexpr _TransformType m_type = + static constexpr cufftType m_type = std::is_same_v ? CUFFT_C2R : CUFFT_Z2D; - static constexpr _TransformType type() { return m_type; }; + static constexpr cufftType type() { return m_type; }; }; template @@ -194,10 +192,9 @@ struct transform_type, Kokkos::complex> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - static constexpr _TransformType m_type = + static constexpr cufftType m_type = std::is_same_v ? CUFFT_C2C : CUFFT_Z2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr cufftType type() { return m_type; }; }; template diff --git a/fft/src/KokkosFFT_HIP_types.hpp b/fft/src/KokkosFFT_HIP_types.hpp index 6af8159c..0dd82c50 100644 --- a/fft/src/KokkosFFT_HIP_types.hpp +++ b/fft/src/KokkosFFT_HIP_types.hpp @@ -76,15 +76,15 @@ template struct transform_type> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; + using TransformTypeOnExecSpace = TransformType; - static constexpr _TransformType m_hip_type = + static constexpr TransformTypeOnExecSpace m_hip_type = std::is_same_v ? HIPFFT_R2C : HIPFFT_D2Z; - static constexpr _TransformType m_cpu_type = std::is_same_v - ? FFTWTransformType::R2C - : FFTWTransformType::D2Z; + static constexpr TransformTypeOnExecSpace m_cpu_type = + std::is_same_v ? FFTWTransformType::R2C + : FFTWTransformType::D2Z; - static constexpr _TransformType type() { + static constexpr TransformTypeOnExecSpace type() { if constexpr (std::is_same_v) { return m_hip_type; } else { @@ -97,15 +97,15 @@ template struct transform_type, T2> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; + using TransformTypeOnExecSpace = TransformType; - static constexpr _TransformType m_hip_type = + static constexpr TransformTypeOnExecSpace m_hip_type = std::is_same_v ? HIPFFT_C2R : HIPFFT_Z2D; - static constexpr _TransformType m_cpu_type = std::is_same_v - ? FFTWTransformType::C2R - : FFTWTransformType::Z2D; + static constexpr TransformTypeOnExecSpace m_cpu_type = + std::is_same_v ? FFTWTransformType::C2R + : FFTWTransformType::Z2D; - static constexpr _TransformType type() { + static constexpr TransformTypeOnExecSpace type() { if constexpr (std::is_same_v) { return m_hip_type; } else { @@ -119,15 +119,15 @@ struct transform_type, Kokkos::complex> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; + using TransformTypeOnExecSpace = TransformType; - static constexpr _TransformType m_hip_type = + static constexpr TransformTypeOnExecSpace m_hip_type = std::is_same_v ? HIPFFT_C2C : HIPFFT_Z2Z; - static constexpr _TransformType m_cpu_type = std::is_same_v - ? FFTWTransformType::C2C - : FFTWTransformType::Z2Z; + static constexpr TransformTypeOnExecSpace m_cpu_type = + std::is_same_v ? FFTWTransformType::C2C + : FFTWTransformType::Z2Z; - static constexpr _TransformType type() { + static constexpr TransformTypeOnExecSpace type() { if constexpr (std::is_same_v) { return m_hip_type; } else { @@ -138,13 +138,13 @@ struct transform_type, template auto direction_type(Direction direction) { - static constexpr FFTDirectionType _FORWARD = + static constexpr FFTDirectionType FORWARD = std::is_same_v ? HIPFFT_FORWARD : FFTW_FORWARD; - static constexpr FFTDirectionType _BACKWARD = + static constexpr FFTDirectionType BACKWARD = std::is_same_v ? HIPFFT_BACKWARD : FFTW_BACKWARD; - return direction == Direction::forward ? _FORWARD : _BACKWARD; + return direction == Direction::forward ? FORWARD : BACKWARD; } #else template @@ -173,20 +173,18 @@ template struct transform_type> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - static constexpr _TransformType m_type = + static constexpr hipfftType m_type = std::is_same_v ? HIPFFT_R2C : HIPFFT_D2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr hipfftType type() { return m_type; }; }; template struct transform_type, T2> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - static constexpr _TransformType m_type = + static constexpr hipfftType m_type = std::is_same_v ? HIPFFT_C2R : HIPFFT_Z2D; - static constexpr _TransformType type() { return m_type; }; + static constexpr hipfftType type() { return m_type; }; }; template @@ -194,10 +192,9 @@ struct transform_type, Kokkos::complex> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - static constexpr _TransformType m_type = + static constexpr hipfftType m_type = std::is_same_v ? HIPFFT_C2C : HIPFFT_Z2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr hipfftType type() { return m_type; }; }; template diff --git a/fft/src/KokkosFFT_Host_types.hpp b/fft/src/KokkosFFT_Host_types.hpp index 8c094980..d406d2cf 100644 --- a/fft/src/KokkosFFT_Host_types.hpp +++ b/fft/src/KokkosFFT_Host_types.hpp @@ -55,24 +55,20 @@ template struct transform_type> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::R2C - : FFTWTransformType::D2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::R2C + : FFTWTransformType::D2Z; + static constexpr FFTWTransformType type() { return m_type; }; }; template struct transform_type, T2> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::C2R - : FFTWTransformType::Z2D; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::C2R + : FFTWTransformType::Z2D; + static constexpr FFTWTransformType type() { return m_type; }; }; template @@ -80,12 +76,10 @@ struct transform_type, Kokkos::complex> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::C2C - : FFTWTransformType::Z2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::C2C + : FFTWTransformType::Z2Z; + static constexpr FFTWTransformType type() { return m_type; }; }; template diff --git a/fft/src/KokkosFFT_Plans.hpp b/fft/src/KokkosFFT_Plans.hpp index f4b1e114..178a9ea7 100644 --- a/fft/src/KokkosFFT_Plans.hpp +++ b/fft/src/KokkosFFT_Plans.hpp @@ -191,8 +191,8 @@ class Plan { shape_type<1> s = {0}; if (n) { - std::size_t _n = n.value(); - s = shape_type<1>({_n}); + std::size_t n_tmp = n.value(); + s = shape_type<1>({n_tmp}); } m_in_extents = KokkosFFT::Impl::extract_extents(in); diff --git a/fft/src/KokkosFFT_ROCM_plans.hpp b/fft/src/KokkosFFT_ROCM_plans.hpp index 88ed85ae..2c8772a1 100644 --- a/fft/src/KokkosFFT_ROCM_plans.hpp +++ b/fft/src/KokkosFFT_ROCM_plans.hpp @@ -125,7 +125,7 @@ auto create_plan(const ExecutionSpace& exec_space, // Create plan auto in_strides = compute_strides(in_extents); auto out_strides = compute_strides(out_extents); - auto _fft_extents = + auto reversed_fft_extents = convert_int_type_and_reverse(fft_extents); // Create the description @@ -160,10 +160,10 @@ auto create_plan(const ExecutionSpace& exec_space, // Create a plan plan = std::make_unique(); status = rocfft_plan_create(&(*plan), place, fft_direction, precision, - _fft_extents.size(), // Dimension - _fft_extents.data(), // Lengths - howmany, // Number of transforms - description // Description + reversed_fft_extents.size(), // Dimension + reversed_fft_extents.data(), // Lengths + howmany, // Number of transforms + description // Description ); KOKKOSFFT_THROW_IF(status != rocfft_status_success, "rocfft_plan_create failed"); diff --git a/fft/src/KokkosFFT_ROCM_types.hpp b/fft/src/KokkosFFT_ROCM_types.hpp index 7870dbb9..90f2c528 100644 --- a/fft/src/KokkosFFT_ROCM_types.hpp +++ b/fft/src/KokkosFFT_ROCM_types.hpp @@ -49,24 +49,20 @@ template struct transform_type> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::R2C - : FFTWTransformType::D2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::R2C + : FFTWTransformType::D2Z; + static constexpr FFTWTransformType type() { return m_type; }; }; template struct transform_type, T2> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::C2R - : FFTWTransformType::Z2D; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::C2R + : FFTWTransformType::Z2D; + static constexpr FFTWTransformType type() { return m_type; }; }; template @@ -74,12 +70,10 @@ struct transform_type, Kokkos::complex> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::C2C - : FFTWTransformType::Z2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::C2C + : FFTWTransformType::Z2Z; + static constexpr FFTWTransformType type() { return m_type; }; }; #ifdef ENABLE_HOST_AND_DEVICE @@ -112,14 +106,14 @@ using FFTInfoType = template auto direction_type(Direction direction) { - static constexpr FFTDirectionType _FORWARD = + static constexpr FFTDirectionType FORWARD = std::is_same_v ? ROCFFT_FORWARD : FFTW_FORWARD; - static constexpr FFTDirectionType _BACKWARD = + static constexpr FFTDirectionType BACKWARD = std::is_same_v ? ROCFFT_BACKWARD : FFTW_BACKWARD; - return direction == Direction::forward ? _FORWARD : _BACKWARD; + return direction == Direction::forward ? FORWARD : BACKWARD; } #else template diff --git a/fft/src/KokkosFFT_SYCL_plans.hpp b/fft/src/KokkosFFT_SYCL_plans.hpp index 0e1bca83..fce857fd 100644 --- a/fft/src/KokkosFFT_SYCL_plans.hpp +++ b/fft/src/KokkosFFT_SYCL_plans.hpp @@ -78,23 +78,23 @@ auto create_plan(const ExecutionSpace& exec_space, std::multiplies<>()); // Create plan - auto in_strides = compute_strides(in_extents); - auto out_strides = compute_strides(out_extents); - auto _fft_extents = convert_int_type(fft_extents); + auto in_strides = compute_strides(in_extents); + auto out_strides = compute_strides(out_extents); + auto int64_fft_extents = convert_int_type(fft_extents); // In oneMKL, the distance is always defined based on R2C transform - std::int64_t _idist = static_cast(std::max(idist, odist)); - std::int64_t _odist = static_cast(std::min(idist, odist)); + std::int64_t max_idist = static_cast(std::max(idist, odist)); + std::int64_t max_odist = static_cast(std::min(idist, odist)); - plan = std::make_unique(_fft_extents); + plan = std::make_unique(int64_fft_extents); plan->set_value(oneapi::mkl::dft::config_param::INPUT_STRIDES, in_strides.data()); plan->set_value(oneapi::mkl::dft::config_param::OUTPUT_STRIDES, out_strides.data()); // Configuration for batched plan - plan->set_value(oneapi::mkl::dft::config_param::FWD_DISTANCE, _idist); - plan->set_value(oneapi::mkl::dft::config_param::BWD_DISTANCE, _odist); + plan->set_value(oneapi::mkl::dft::config_param::FWD_DISTANCE, max_idist); + plan->set_value(oneapi::mkl::dft::config_param::BWD_DISTANCE, max_odist); plan->set_value(oneapi::mkl::dft::config_param::NUMBER_OF_TRANSFORMS, static_cast(howmany)); diff --git a/fft/src/KokkosFFT_SYCL_types.hpp b/fft/src/KokkosFFT_SYCL_types.hpp index 9cb5ecdd..9e644c5c 100644 --- a/fft/src/KokkosFFT_SYCL_types.hpp +++ b/fft/src/KokkosFFT_SYCL_types.hpp @@ -56,24 +56,20 @@ template struct transform_type> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::R2C - : FFTWTransformType::D2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::R2C + : FFTWTransformType::D2Z; + static constexpr FFTWTransformType type() { return m_type; }; }; template struct transform_type, T2> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::C2R - : FFTWTransformType::Z2D; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::C2R + : FFTWTransformType::Z2D; + static constexpr FFTWTransformType type() { return m_type; }; }; template @@ -81,12 +77,10 @@ struct transform_type, Kokkos::complex> { static_assert(std::is_same_v, "T1 and T2 should have the same precision"); - using _TransformType = TransformType; - - static constexpr _TransformType m_type = std::is_same_v - ? FFTWTransformType::C2C - : FFTWTransformType::Z2Z; - static constexpr _TransformType type() { return m_type; }; + static constexpr FFTWTransformType m_type = std::is_same_v + ? FFTWTransformType::C2C + : FFTWTransformType::Z2Z; + static constexpr FFTWTransformType type() { return m_type; }; }; #ifdef ENABLE_HOST_AND_DEVICE @@ -178,15 +172,15 @@ struct FFTPlanType, Kokkos::complex> { template auto direction_type(Direction direction) { - static constexpr FFTDirectionType _FORWARD = + static constexpr FFTDirectionType FORWARD = std::is_same_v ? MKL_FFT_FORWARD : FFTW_FORWARD; - static constexpr FFTDirectionType _BACKWARD = + static constexpr FFTDirectionType BACKWARD = std::is_same_v ? MKL_FFT_BACKWARD : FFTW_BACKWARD; - return direction == Direction::forward ? _FORWARD : _BACKWARD; + return direction == Direction::forward ? FORWARD : BACKWARD; } #else template diff --git a/fft/unit_test/Test_Transform.cpp b/fft/unit_test/Test_Transform.cpp index a00bcd31..cad710c4 100644 --- a/fft/unit_test/Test_Transform.cpp +++ b/fft/unit_test/Test_Transform.cpp @@ -50,9 +50,13 @@ void test_fft1_identity(T atol = 1.0e-12) { Kokkos::View*, LayoutType, execution_space>; for (int i = 1; i < maxlen; i++) { - ComplexView1DType a("a", i), _a("_a", i), a_ref("a_ref", i); - ComplexView1DType out("out", i), outr("outr", i / 2 + 1); - RealView1DType ar("ar", i), _ar("_ar", i), ar_ref("ar_ref", i); + ComplexView1DType a("a", i), a_ref("a_ref", i); + ComplexView1DType a_hat("a_hat", i), inv_a_hat("inv_a_hat", i); + + // Used for Real transforms + RealView1DType ar("ar", i), inv_ar_hat("inv_ar_hat", i), + ar_ref("ar_ref", i); + ComplexView1DType ar_hat("ar_hat", i / 2 + 1); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(/*seed=*/12345); @@ -63,14 +67,14 @@ void test_fft1_identity(T atol = 1.0e-12) { Kokkos::fence(); - KokkosFFT::fft(execution_space(), a, out); - KokkosFFT::ifft(execution_space(), out, _a); + KokkosFFT::fft(execution_space(), a, a_hat); + KokkosFFT::ifft(execution_space(), a_hat, inv_a_hat); - KokkosFFT::rfft(execution_space(), ar, outr); - KokkosFFT::irfft(execution_space(), outr, _ar); + KokkosFFT::rfft(execution_space(), ar, ar_hat); + KokkosFFT::irfft(execution_space(), ar_hat, inv_ar_hat); - EXPECT_TRUE(allclose(_a, a_ref, 1.e-5, atol)); - EXPECT_TRUE(allclose(_ar, ar_ref, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_a_hat, a_ref, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_ar_hat, ar_ref, 1.e-5, atol)); } } @@ -122,9 +126,13 @@ void test_fft1_identity_reuse_plan(T atol = 1.0e-12) { Kokkos::View*, LayoutType, execution_space>; for (int i = 1; i < maxlen; i++) { - ComplexView1DType a("a", i), _a("_a", i), a_ref("a_ref", i); - ComplexView1DType out("out", i), outr("outr", i / 2 + 1); - RealView1DType ar("ar", i), _ar("_ar", i), ar_ref("ar_ref", i); + ComplexView1DType a("a", i), a_ref("a_ref", i); + ComplexView1DType a_hat("a_hat", i), inv_a_hat("inv_a_hat", i); + + // Used for Real transforms + RealView1DType ar("ar", i), inv_ar_hat("inv_ar_hat", i), + ar_ref("ar_ref", i); + ComplexView1DType ar_hat("ar_hat", i / 2 + 1); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(/*seed=*/12345); @@ -136,29 +144,33 @@ void test_fft1_identity_reuse_plan(T atol = 1.0e-12) { Kokkos::fence(); int axis = -1; - KokkosFFT::Plan fft_plan(execution_space(), a, out, + KokkosFFT::Plan fft_plan(execution_space(), a, a_hat, KokkosFFT::Direction::forward, axis); - fft_plan.execute(a, out); + fft_plan.execute(a, a_hat); - KokkosFFT::Plan ifft_plan(execution_space(), out, _a, + KokkosFFT::Plan ifft_plan(execution_space(), a_hat, inv_a_hat, KokkosFFT::Direction::backward, axis); - ifft_plan.execute(out, _a); + ifft_plan.execute(a_hat, inv_a_hat); - KokkosFFT::Plan rfft_plan(execution_space(), ar, outr, + KokkosFFT::Plan rfft_plan(execution_space(), ar, ar_hat, KokkosFFT::Direction::forward, axis); - rfft_plan.execute(ar, outr); + rfft_plan.execute(ar, ar_hat); - KokkosFFT::Plan irfft_plan(execution_space(), outr, _ar, + KokkosFFT::Plan irfft_plan(execution_space(), ar_hat, inv_ar_hat, KokkosFFT::Direction::backward, axis); - irfft_plan.execute(outr, _ar); + irfft_plan.execute(ar_hat, inv_ar_hat); - EXPECT_TRUE(allclose(_a, a_ref, 1.e-5, atol)); - EXPECT_TRUE(allclose(_ar, ar_ref, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_a_hat, a_ref, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_ar_hat, ar_ref, 1.e-5, atol)); } - ComplexView1DType a("a", maxlen), _a("_a", maxlen), a_ref("a_ref", maxlen); - ComplexView1DType out("out", maxlen), outr("outr", maxlen / 2 + 1); - RealView1DType ar("ar", maxlen), _ar("_ar", maxlen), ar_ref("ar_ref", maxlen); + ComplexView1DType a("a", maxlen), a_ref("a_ref", maxlen); + ComplexView1DType a_hat("a_hat", maxlen), inv_a_hat("inv_a_hat", maxlen); + + // Used for Real transforms + RealView1DType ar("ar", maxlen), inv_ar_hat("inv_ar_hat", maxlen), + ar_ref("ar_ref", maxlen); + ComplexView1DType ar_hat("ar_hat", maxlen / 2 + 1); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(/*seed=*/12345); @@ -171,68 +183,70 @@ void test_fft1_identity_reuse_plan(T atol = 1.0e-12) { // Create correct plans int axis = -1; - KokkosFFT::Plan fft_plan(execution_space(), a, out, + KokkosFFT::Plan fft_plan(execution_space(), a, a_hat, KokkosFFT::Direction::forward, axis); - KokkosFFT::Plan ifft_plan(execution_space(), out, _a, + KokkosFFT::Plan ifft_plan(execution_space(), a_hat, inv_a_hat, KokkosFFT::Direction::backward, axis); - KokkosFFT::Plan rfft_plan(execution_space(), ar, outr, + KokkosFFT::Plan rfft_plan(execution_space(), ar, ar_hat, KokkosFFT::Direction::forward, axis); - KokkosFFT::Plan irfft_plan(execution_space(), outr, _ar, + KokkosFFT::Plan irfft_plan(execution_space(), ar_hat, inv_ar_hat, KokkosFFT::Direction::backward, axis); // Check if errors are correctly raised aginst wrong extents const int maxlen_wrong = 32 * 2; - ComplexView1DType a_wrong("a", maxlen_wrong), _a_wrong("_a", maxlen_wrong); - ComplexView1DType out_wrong("out", maxlen_wrong), - outr_wrong("outr", maxlen_wrong / 2 + 1); - RealView1DType ar_wrong("ar", maxlen_wrong), _ar_wrong("_ar", maxlen_wrong); + ComplexView1DType a_wrong("a_wrong", maxlen_wrong), + inv_a_hat_wrong("inv_a_hat_wrong", maxlen_wrong); + ComplexView1DType a_hat_wrong("a_hat_wrong", maxlen_wrong), + ar_hat_wrong("ar_hat_wrong", maxlen_wrong / 2 + 1); + RealView1DType ar_wrong("ar_wrong", maxlen_wrong), + inv_ar_hat_wrong("inv_ar_hat_wrong", maxlen_wrong); // fft // With incorrect input shape EXPECT_THROW( - fft_plan.execute(a_wrong, out, KokkosFFT::Normalization::backward), + fft_plan.execute(a_wrong, a_hat, KokkosFFT::Normalization::backward), std::runtime_error); // With incorrect output shape EXPECT_THROW( - fft_plan.execute(a, out_wrong, KokkosFFT::Normalization::backward), + fft_plan.execute(a, a_hat_wrong, KokkosFFT::Normalization::backward), std::runtime_error); // ifft // With incorrect input shape - EXPECT_THROW( - ifft_plan.execute(out_wrong, _a, KokkosFFT::Normalization::backward), - std::runtime_error); + EXPECT_THROW(ifft_plan.execute(a_hat_wrong, inv_a_hat, + KokkosFFT::Normalization::backward), + std::runtime_error); // With incorrect output shape - EXPECT_THROW( - ifft_plan.execute(out, _a_wrong, KokkosFFT::Normalization::backward), - std::runtime_error); + EXPECT_THROW(ifft_plan.execute(a_hat, inv_a_hat_wrong, + KokkosFFT::Normalization::backward), + std::runtime_error); // rfft // With incorrect input shape EXPECT_THROW( - rfft_plan.execute(ar_wrong, outr, KokkosFFT::Normalization::backward), + rfft_plan.execute(ar_wrong, ar_hat, KokkosFFT::Normalization::backward), std::runtime_error); // With incorrect output shape EXPECT_THROW( - rfft_plan.execute(ar, out_wrong, KokkosFFT::Normalization::backward), + rfft_plan.execute(ar, ar_hat_wrong, KokkosFFT::Normalization::backward), std::runtime_error); // irfft // With incorrect input shape - EXPECT_THROW( - irfft_plan.execute(outr_wrong, _ar, KokkosFFT::Normalization::backward), - std::runtime_error); + EXPECT_THROW(irfft_plan.execute(ar_hat_wrong, inv_ar_hat, + KokkosFFT::Normalization::backward), + std::runtime_error); // With incorrect output shape - EXPECT_THROW( - irfft_plan.execute(outr, _ar_wrong, KokkosFFT::Normalization::backward), - std::runtime_error); + EXPECT_THROW(irfft_plan.execute(ar_hat, inv_ar_hat_wrong, + KokkosFFT::Normalization::backward), + std::runtime_error); } template @@ -903,13 +917,13 @@ void test_fft1_1dfft_5dview(T atol = 1.e-12) { const std::size_t n_new = shape.at(axis) + i0; shape.at(axis) = n_new; shape_c2r.at(axis) = n_new / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4] = shape; - auto [_m0, _m1, _m2, _m3, _m4] = shape_c2r; - ComplexView5DType _x("_x", _n0, _n1, _n2, _n3, _n4), - out("out", _n0, _n1, _n2, _n3, _n4), ref_x; - RealView5DType xr("xr", _n0, _n1, _n2, _n3, _n4), - _xr("_xr", _n0, _n1, _n2, _n3, _n4), ref_xr; - ComplexView5DType outr("outr", _m0, _m1, _m2, _m3, _m4); + auto [s0, s1, s2, s3, s4] = shape; + auto [sr0, sr1, sr2, sr3, sr4] = shape_c2r; + ComplexView5DType inv_x_hat("inv_x_hat", s0, s1, s2, s3, s4), + x_hat("x_hat", s0, s1, s2, s3, s4), ref_x; + RealView5DType xr("xr", s0, s1, s2, s3, s4), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3, s4), ref_xr; + ComplexView5DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -923,19 +937,19 @@ void test_fft1_1dfft_5dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft(execution_space(), x, out, + KokkosFFT::fft(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axis, n_new); - KokkosFFT::ifft(execution_space(), out, _x, + KokkosFFT::ifft(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axis, n_new); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft(execution_space(), xr, outr, + KokkosFFT::rfft(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axis, n_new); - KokkosFFT::irfft(execution_space(), outr, _xr, + KokkosFFT::irfft(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axis, n_new); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -958,13 +972,13 @@ void test_fft1_1dfft_6dview(T atol = 1.e-12) { const std::size_t n_new = shape.at(axis) + i0; shape.at(axis) = n_new; shape_c2r.at(axis) = n_new / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5] = shape; - auto [_m0, _m1, _m2, _m3, _m4, _m5] = shape_c2r; - ComplexView6DType _x("_x", _n0, _n1, _n2, _n3, _n4, _n5), - out("out", _n0, _n1, _n2, _n3, _n4, _n5), ref_x; - RealView6DType xr("xr", _n0, _n1, _n2, _n3, _n4, _n5), - _xr("_xr", _n0, _n1, _n2, _n3, _n4, _n5), ref_xr; - ComplexView6DType outr("outr", _m0, _m1, _m2, _m3, _m4, _m5); + auto [s0, s1, s2, s3, s4, s5] = shape; + auto [sr0, sr1, sr2, sr3, sr4, sr5] = shape_c2r; + ComplexView6DType inv_x_hat("inv_x_hat", s0, s1, s2, s3, s4, s5), + x_hat("x_hat", s0, s1, s2, s3, s4, s5), ref_x; + RealView6DType xr("xr", s0, s1, s2, s3, s4, s5), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3, s4, s5), ref_xr; + ComplexView6DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -978,19 +992,19 @@ void test_fft1_1dfft_6dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft(execution_space(), x, out, + KokkosFFT::fft(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axis, n_new); - KokkosFFT::ifft(execution_space(), out, _x, + KokkosFFT::ifft(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axis, n_new); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft(execution_space(), xr, outr, + KokkosFFT::rfft(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axis, n_new); - KokkosFFT::irfft(execution_space(), outr, _xr, + KokkosFFT::irfft(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axis, n_new); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -1013,13 +1027,13 @@ void test_fft1_1dfft_7dview(T atol = 1.e-12) { const std::size_t n_new = shape.at(axis) + i0; shape.at(axis) = n_new; shape_c2r.at(axis) = n_new / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5, _n6] = shape; - auto [_m0, _m1, _m2, _m3, _m4, _m5, _m6] = shape_c2r; - ComplexView7DType _x("_x", _n0, _n1, _n2, _n3, _n4, _n5, _n6), - out("out", _n0, _n1, _n2, _n3, _n4, _n5, _n6), ref_x; - RealView7DType xr("xr", _n0, _n1, _n2, _n3, _n4, _n5, _n6), - _xr("_xr", _n0, _n1, _n2, _n3, _n4, _n5, _n6), ref_xr; - ComplexView7DType outr("outr", _m0, _m1, _m2, _m3, _m4, _m5, _m6); + auto [s0, s1, s2, s3, s4, s5, s6] = shape; + auto [sr0, sr1, sr2, sr3, sr4, sr5, sr6] = shape_c2r; + ComplexView7DType inv_x_hat("inv_x_hat", s0, s1, s2, s3, s4, s5, s6), + x_hat("x_hat", s0, s1, s2, s3, s4, s5, s6), ref_x; + RealView7DType xr("xr", s0, s1, s2, s3, s4, s5, s6), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3, s4, s5, s6), ref_xr; + ComplexView7DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5, sr6); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -1033,19 +1047,19 @@ void test_fft1_1dfft_7dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft(execution_space(), x, out, + KokkosFFT::fft(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axis, n_new); - KokkosFFT::ifft(execution_space(), out, _x, + KokkosFFT::ifft(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axis, n_new); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft(execution_space(), xr, outr, + KokkosFFT::rfft(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axis, n_new); - KokkosFFT::irfft(execution_space(), outr, _xr, + KokkosFFT::irfft(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axis, n_new); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -1068,13 +1082,14 @@ void test_fft1_1dfft_8dview(T atol = 1.e-12) { const std::size_t n_new = shape.at(axis) + i0; shape.at(axis) = n_new; shape_c2r.at(axis) = n_new / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7] = shape; - auto [_m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7] = shape_c2r; - ComplexView8DType _x("_x", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7), - out("out", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7), ref_x; - RealView8DType xr("xr", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7), - _xr("_xr", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7), ref_xr; - ComplexView8DType outr("outr", _m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7); + auto [s0, s1, s2, s3, s4, s5, s6, s7] = shape; + auto [sr0, sr1, sr2, sr3, sr4, sr5, sr6, sr7] = shape_c2r; + ComplexView8DType inv_x_hat("inv_x_hat", s0, s1, s2, s3, s4, s5, s6, s7), + x_hat("x_hat", s0, s1, s2, s3, s4, s5, s6, s7), ref_x; + RealView8DType xr("xr", s0, s1, s2, s3, s4, s5, s6, s7), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3, s4, s5, s6, s7), ref_xr; + ComplexView8DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5, sr6, + sr7); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -1088,19 +1103,19 @@ void test_fft1_1dfft_8dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft(execution_space(), x, out, + KokkosFFT::fft(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axis, n_new); - KokkosFFT::ifft(execution_space(), out, _x, + KokkosFFT::ifft(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axis, n_new); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft(execution_space(), xr, outr, + KokkosFFT::rfft(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axis, n_new); - KokkosFFT::irfft(execution_space(), outr, _xr, + KokkosFFT::irfft(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axis, n_new); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -1795,14 +1810,14 @@ void test_fft2_2dfft_3dview(T atol = 1.e-12) { shape_c2r.at(axis0) = n0_new; shape_c2r.at(axis1) = n1_new / 2 + 1; - auto [_n0, _n1, _n2] = shape; - auto [_m0, _m1, _m2] = shape_c2r; + auto [s0, s1, s2] = shape; + auto [sr0, sr1, sr2] = shape_c2r; - ComplexView3DType _x("_x", _n0, _n1, _n2), out("out", _n0, _n1, _n2), - ref_x; - RealView3DType xr("xr", _n0, _n1, _n2), _xr("_xr", _n0, _n1, _n2), - ref_xr; - ComplexView3DType outr("outr", _m0, _m1, _m2); + ComplexView3DType inv_x_hat("inv_x_hat", s0, s1, s2), + x_hat("x_hat", s0, s1, s2), ref_x; + RealView3DType xr("xr", s0, s1, s2), + inv_xr_hat("inv_xr_hat", s0, s1, s2), ref_xr; + ComplexView3DType xr_hat("xr_hat", sr0, sr1, sr2); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -1816,23 +1831,23 @@ void test_fft2_2dfft_3dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft2(execution_space(), x, out, + KokkosFFT::fft2(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::ifft2(execution_space(), out, _x, + KokkosFFT::ifft2(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft2(execution_space(), xr, outr, + KokkosFFT::rfft2(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::irfft2(execution_space(), outr, _xr, + KokkosFFT::irfft2(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -1874,14 +1889,14 @@ void test_fft2_2dfft_4dview(T atol = 1.e-12) { shape_c2r.at(axis0) = n0_new; shape_c2r.at(axis1) = n1_new / 2 + 1; - auto [_n0, _n1, _n2, _n3] = shape; - auto [_m0, _m1, _m2, _m3] = shape_c2r; + auto [s0, s1, s2, s3] = shape; + auto [sr0, sr1, sr2, sr3] = shape_c2r; - ComplexView4DType _x("_x", _n0, _n1, _n2, _n3), - out("out", _n0, _n1, _n2, _n3), ref_x; - RealView4DType xr("xr", _n0, _n1, _n2, _n3), - _xr("_xr", _n0, _n1, _n2, _n3), ref_xr; - ComplexView4DType outr("outr", _m0, _m1, _m2, _m3); + ComplexView4DType inv_x_hat("inv_x_hat", s0, s1, s2, s3), + x_hat("x_hat", s0, s1, s2, s3), ref_x; + RealView4DType xr("xr", s0, s1, s2, s3), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3), ref_xr; + ComplexView4DType xr_hat("xr_hat", sr0, sr1, sr2, sr3); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -1895,23 +1910,23 @@ void test_fft2_2dfft_4dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft2(execution_space(), x, out, + KokkosFFT::fft2(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::ifft2(execution_space(), out, _x, + KokkosFFT::ifft2(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft2(execution_space(), xr, outr, + KokkosFFT::rfft2(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::irfft2(execution_space(), outr, _xr, + KokkosFFT::irfft2(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -1953,14 +1968,14 @@ void test_fft2_2dfft_5dview(T atol = 1.e-12) { shape_c2r.at(axis0) = n0_new; shape_c2r.at(axis1) = n1_new / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4] = shape; - auto [_m0, _m1, _m2, _m3, _m4] = shape_c2r; + auto [s0, s1, s2, s3, s4] = shape; + auto [sr0, sr1, sr2, sr3, sr4] = shape_c2r; - ComplexView5DType _x("_x", _n0, _n1, _n2, _n3, _n4), - out("out", _n0, _n1, _n2, _n3, _n4), ref_x; - RealView5DType xr("xr", _n0, _n1, _n2, _n3, _n4), - _xr("_xr", _n0, _n1, _n2, _n3, _n4), ref_xr; - ComplexView5DType outr("outr", _m0, _m1, _m2, _m3, _m4); + ComplexView5DType inv_x_hat("inv_x_hat", s0, s1, s2, s3, s4), + x_hat("x_hat", s0, s1, s2, s3, s4), ref_x; + RealView5DType xr("xr", s0, s1, s2, s3, s4), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3, s4), ref_xr; + ComplexView5DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -1974,23 +1989,23 @@ void test_fft2_2dfft_5dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft2(execution_space(), x, out, + KokkosFFT::fft2(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::ifft2(execution_space(), out, _x, + KokkosFFT::ifft2(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft2(execution_space(), xr, outr, + KokkosFFT::rfft2(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::irfft2(execution_space(), outr, _xr, + KokkosFFT::irfft2(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -2032,14 +2047,14 @@ void test_fft2_2dfft_6dview(T atol = 1.e-12) { shape_c2r.at(axis0) = n0_new; shape_c2r.at(axis1) = n1_new / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5] = shape; - auto [_m0, _m1, _m2, _m3, _m4, _m5] = shape_c2r; + auto [s0, s1, s2, s3, s4, s5] = shape; + auto [sr0, sr1, sr2, sr3, sr4, sr5] = shape_c2r; - ComplexView6DType _x("_x", _n0, _n1, _n2, _n3, _n4, _n5), - out("out", _n0, _n1, _n2, _n3, _n4, _n5), ref_x; - RealView6DType xr("xr", _n0, _n1, _n2, _n3, _n4, _n5), - _xr("_xr", _n0, _n1, _n2, _n3, _n4, _n5), ref_xr; - ComplexView6DType outr("outr", _m0, _m1, _m2, _m3, _m4, _m5); + ComplexView6DType inv_x_hat("inv_x_hat", s0, s1, s2, s3, s4, s5), + x_hat("x_hat", s0, s1, s2, s3, s4, s5), ref_x; + RealView6DType xr("xr", s0, s1, s2, s3, s4, s5), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3, s4, s5), ref_xr; + ComplexView6DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -2053,23 +2068,23 @@ void test_fft2_2dfft_6dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft2(execution_space(), x, out, + KokkosFFT::fft2(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::ifft2(execution_space(), out, _x, + KokkosFFT::ifft2(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft2(execution_space(), xr, outr, + KokkosFFT::rfft2(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::irfft2(execution_space(), outr, _xr, + KokkosFFT::irfft2(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -2110,16 +2125,16 @@ void test_fft2_2dfft_7dview(T atol = 1.e-12) { shape_c2r.at(axis0) = n0_new; shape_c2r.at(axis1) = n1_new / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5, _n6] = shape; - auto [_m0, _m1, _m2, _m3, _m4, _m5, _m6] = shape_c2r; + auto [s0, s1, s2, s3, s4, s5, s6] = shape; + auto [sr0, sr1, sr2, sr3, sr4, sr5, sr6] = shape_c2r; - ComplexView7DType _x("_x", _n0, _n1, _n2, _n3, _n4, _n5, _n6), - out("out", _n0, _n1, _n2, _n3, _n4, _n5, _n6), ref_x; + ComplexView7DType inv_x_hat("inv_x_hat", s0, s1, s2, s3, s4, s5, s6), + x_hat("x_hat", s0, s1, s2, s3, s4, s5, s6), ref_x; - RealView7DType xr("xr", _n0, _n1, _n2, _n3, _n4, _n5, _n6), - _xr("_xr", _n0, _n1, _n2, _n3, _n4, _n5, _n6), ref_xr; + RealView7DType xr("xr", s0, s1, s2, s3, s4, s5, s6), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3, s4, s5, s6), ref_xr; - ComplexView7DType outr("outr", _m0, _m1, _m2, _m3, _m4, _m5, _m6); + ComplexView7DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5, sr6); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -2133,23 +2148,23 @@ void test_fft2_2dfft_7dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft2(execution_space(), x, out, + KokkosFFT::fft2(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::ifft2(execution_space(), out, _x, + KokkosFFT::ifft2(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft2(execution_space(), xr, outr, + KokkosFFT::rfft2(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::irfft2(execution_space(), outr, _xr, + KokkosFFT::irfft2(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -2190,17 +2205,18 @@ void test_fft2_2dfft_8dview(T atol = 1.e-12) { shape_c2r.at(axis0) = n0_new; shape_c2r.at(axis1) = n1_new / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7] = shape; - auto [_m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7] = shape_c2r; + auto [s0, s1, s2, s3, s4, s5, s6, s7] = shape; + auto [sr0, sr1, sr2, sr3, sr4, sr5, sr6, sr7] = shape_c2r; - ComplexView8DType _x("_x", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7), - out("out", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7), ref_x; + ComplexView8DType inv_x_hat("inv_x_hat", s0, s1, s2, s3, s4, s5, s6, + s7), + x_hat("x_hat", s0, s1, s2, s3, s4, s5, s6, s7), ref_x; - RealView8DType xr("xr", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7), - _xr("_xr", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7), ref_xr; + RealView8DType xr("xr", s0, s1, s2, s3, s4, s5, s6, s7), + inv_xr_hat("inv_xr_hat", s0, s1, s2, s3, s4, s5, s6, s7), ref_xr; - ComplexView8DType outr("outr", _m0, _m1, _m2, _m3, _m4, _m5, _m6, - _m7); + ComplexView8DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5, sr6, + sr7); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -2214,23 +2230,23 @@ void test_fft2_2dfft_8dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fft2(execution_space(), x, out, + KokkosFFT::fft2(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::ifft2(execution_space(), out, _x, + KokkosFFT::ifft2(execution_space(), x_hat, inv_x_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfft2(execution_space(), xr, outr, + KokkosFFT::rfft2(execution_space(), xr, xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - KokkosFFT::irfft2(execution_space(), outr, _xr, + KokkosFFT::irfft2(execution_space(), xr_hat, inv_xr_hat, KokkosFFT::Normalization::backward, axes, new_shape); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -3061,13 +3077,14 @@ void test_fftn_3dfft_4dview(T atol = 1.e-12) { std::array shape_c2r = shape; shape_c2r.at(axis2) = shape_c2r.at(axis2) / 2 + 1; - auto [_n0, _n1, _n2, _n3] = shape_c2r; + auto [sr0, sr1, sr2, sr3] = shape_c2r; - ComplexView4DType _x("_x", n0, n1, n2, n3), out("out", n0, n1, n2, n3), - ref_out("ref_out", n0, n1, n2, n3); + ComplexView4DType inv_x_hat("inv_x_hat", n0, n1, n2, n3), + x_hat("x_hat", n0, n1, n2, n3); RealView4DType xr("xr", n0, n1, n2, n3), - ref_xr("ref_xr", n0, n1, n2, n3), _xr("_xr", n0, n1, n2, n3); - ComplexView4DType outr("outr", _n0, _n1, _n2, _n3); + ref_xr("ref_xr", n0, n1, n2, n3), + inv_xr_hat("inv_xr_hat", n0, n1, n2, n3); + ComplexView4DType xr_hat("xr_hat", sr0, sr1, sr2, sr3); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -3081,22 +3098,22 @@ void test_fftn_3dfft_4dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fftn(execution_space(), x, out, axes, + KokkosFFT::fftn(execution_space(), x, x_hat, axes, KokkosFFT::Normalization::backward); - KokkosFFT::ifftn(execution_space(), out, _x, axes, + KokkosFFT::ifftn(execution_space(), x_hat, inv_x_hat, axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfftn(execution_space(), xr, outr, axes, + KokkosFFT::rfftn(execution_space(), xr, xr_hat, axes, KokkosFFT::Normalization::backward); - KokkosFFT::irfftn(execution_space(), outr, _xr, axes, + KokkosFFT::irfftn(execution_space(), xr_hat, inv_xr_hat, axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } } @@ -3139,12 +3156,13 @@ void test_fftn_3dfft_5dview(T atol = 1.e-12) { std::array shape_c2r = shape; shape_c2r.at(last_axis) = shape_c2r.at(last_axis) / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4] = shape_c2r; - ComplexView5DType _x("_x", n0, n1, n2, n3, n4), - out("out", n0, n1, n2, n3, n4), ref_out("ref_out", n0, n1, n2, n3, n4); + auto [sr0, sr1, sr2, sr3, sr4] = shape_c2r; + ComplexView5DType inv_x_hat("inv_x_hat", n0, n1, n2, n3, n4), + x_hat("x_hat", n0, n1, n2, n3, n4); RealView5DType xr("xr", n0, n1, n2, n3, n4), - ref_xr("ref_xr", n0, n1, n2, n3, n4), _xr("_xr", n0, n1, n2, n3, n4); - ComplexView5DType outr("outr", _n0, _n1, _n2, _n3, _n4); + ref_xr("ref_xr", n0, n1, n2, n3, n4), + inv_xr_hat("inv_xr_hat", n0, n1, n2, n3, n4); + ComplexView5DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -3158,22 +3176,22 @@ void test_fftn_3dfft_5dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fftn(execution_space(), x, out, tested_axes, + KokkosFFT::fftn(execution_space(), x, x_hat, tested_axes, KokkosFFT::Normalization::backward); - KokkosFFT::ifftn(execution_space(), out, _x, tested_axes, + KokkosFFT::ifftn(execution_space(), x_hat, inv_x_hat, tested_axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfftn(execution_space(), xr, outr, tested_axes, + KokkosFFT::rfftn(execution_space(), xr, xr_hat, tested_axes, KokkosFFT::Normalization::backward); - KokkosFFT::irfftn(execution_space(), outr, _xr, tested_axes, + KokkosFFT::irfftn(execution_space(), xr_hat, inv_xr_hat, tested_axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } @@ -3214,14 +3232,13 @@ void test_fftn_3dfft_6dview(T atol = 1.e-12) { std::array shape_c2r = shape; shape_c2r.at(last_axis) = shape_c2r.at(last_axis) / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5] = shape_c2r; - ComplexView6DType _x("_x", n0, n1, n2, n3, n4, n5), - out("out", n0, n1, n2, n3, n4, n5), - ref_out("ref_out", n0, n1, n2, n3, n4, n5); + auto [sr0, sr1, sr2, sr3, sr4, sr5] = shape_c2r; + ComplexView6DType inv_x_hat("inv_x_hat", n0, n1, n2, n3, n4, n5), + x_hat("x_hat", n0, n1, n2, n3, n4, n5); RealView6DType xr("xr", n0, n1, n2, n3, n4, n5), ref_xr("ref_xr", n0, n1, n2, n3, n4, n5), - _xr("_xr", n0, n1, n2, n3, n4, n5); - ComplexView6DType outr("outr", _n0, _n1, _n2, _n3, _n4, _n5); + inv_xr_hat("inv_xr_hat", n0, n1, n2, n3, n4, n5); + ComplexView6DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -3235,22 +3252,22 @@ void test_fftn_3dfft_6dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fftn(execution_space(), x, out, tested_axes, + KokkosFFT::fftn(execution_space(), x, x_hat, tested_axes, KokkosFFT::Normalization::backward); - KokkosFFT::ifftn(execution_space(), out, _x, tested_axes, + KokkosFFT::ifftn(execution_space(), x_hat, inv_x_hat, tested_axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfftn(execution_space(), xr, outr, tested_axes, + KokkosFFT::rfftn(execution_space(), xr, xr_hat, tested_axes, KokkosFFT::Normalization::backward); - KokkosFFT::irfftn(execution_space(), outr, _xr, tested_axes, + KokkosFFT::irfftn(execution_space(), xr_hat, inv_xr_hat, tested_axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } @@ -3291,14 +3308,13 @@ void test_fftn_3dfft_7dview(T atol = 1.e-12) { std::array shape_c2r = shape; shape_c2r.at(last_axis) = shape_c2r.at(last_axis) / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5, _n6] = shape_c2r; - ComplexView7DType _x("_x", n0, n1, n2, n3, n4, n5, n6), - out("out", n0, n1, n2, n3, n4, n5, n6), - ref_out("ref_out", n0, n1, n2, n3, n4, n5, n6); + auto [sr0, sr1, sr2, sr3, sr4, sr5, sr6] = shape_c2r; + ComplexView7DType inv_x_hat("inv_x_hat", n0, n1, n2, n3, n4, n5, n6), + x_hat("x_hat", n0, n1, n2, n3, n4, n5, n6); RealView7DType xr("xr", n0, n1, n2, n3, n4, n5, n6), ref_xr("ref_xr", n0, n1, n2, n3, n4, n5, n6), - _xr("_xr", n0, n1, n2, n3, n4, n5, n6); - ComplexView7DType outr("outr", _n0, _n1, _n2, _n3, _n4, _n5, _n6); + inv_xr_hat("inv_xr_hat", n0, n1, n2, n3, n4, n5, n6); + ComplexView7DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5, sr6); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -3312,22 +3328,22 @@ void test_fftn_3dfft_7dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fftn(execution_space(), x, out, tested_axes, + KokkosFFT::fftn(execution_space(), x, x_hat, tested_axes, KokkosFFT::Normalization::backward); - KokkosFFT::ifftn(execution_space(), out, _x, tested_axes, + KokkosFFT::ifftn(execution_space(), x_hat, inv_x_hat, tested_axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfftn(execution_space(), xr, outr, tested_axes, + KokkosFFT::rfftn(execution_space(), xr, xr_hat, tested_axes, KokkosFFT::Normalization::backward); - KokkosFFT::irfftn(execution_space(), outr, _xr, tested_axes, + KokkosFFT::irfftn(execution_space(), xr_hat, inv_xr_hat, tested_axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } } @@ -3368,14 +3384,13 @@ void test_fftn_3dfft_8dview(T atol = 1.e-12) { std::array shape_c2r = shape; shape_c2r.at(last_axis) = shape_c2r.at(last_axis) / 2 + 1; - auto [_n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7] = shape_c2r; - ComplexView8DType _x("_x", n0, n1, n2, n3, n4, n5, n6, n7), - out("out", n0, n1, n2, n3, n4, n5, n6, n7), - ref_out("ref_out", n0, n1, n2, n3, n4, n5, n6, n7); + auto [sr0, sr1, sr2, sr3, sr4, sr5, sr6, sr7] = shape_c2r; + ComplexView8DType inv_x_hat("inv_x_hat", n0, n1, n2, n3, n4, n5, n6, n7), + x_hat("x_hat", n0, n1, n2, n3, n4, n5, n6, n7); RealView8DType xr("xr", n0, n1, n2, n3, n4, n5, n6, n7), ref_xr("ref_xr", n0, n1, n2, n3, n4, n5, n6, n7), - _xr("_xr", n0, n1, n2, n3, n4, n5, n6, n7); - ComplexView8DType outr("outr", _n0, _n1, _n2, _n3, _n4, _n5, _n6, _n7); + inv_xr_hat("inv_xr_hat", n0, n1, n2, n3, n4, n5, n6, n7); + ComplexView8DType xr_hat("xr_hat", sr0, sr1, sr2, sr3, sr4, sr5, sr6, sr7); const Kokkos::complex z(1.0, 1.0); Kokkos::Random_XorShift64_Pool<> random_pool(12345); @@ -3389,22 +3404,22 @@ void test_fftn_3dfft_8dview(T atol = 1.e-12) { // Along one axis // Simple identity tests - KokkosFFT::fftn(execution_space(), x, out, tested_axes, + KokkosFFT::fftn(execution_space(), x, x_hat, tested_axes, KokkosFFT::Normalization::backward); - KokkosFFT::ifftn(execution_space(), out, _x, tested_axes, + KokkosFFT::ifftn(execution_space(), x_hat, inv_x_hat, tested_axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_x, ref_x, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_x_hat, ref_x, 1.e-5, atol)); // Simple identity tests for r2c and c2r transforms - KokkosFFT::rfftn(execution_space(), xr, outr, tested_axes, + KokkosFFT::rfftn(execution_space(), xr, xr_hat, tested_axes, KokkosFFT::Normalization::backward); - KokkosFFT::irfftn(execution_space(), outr, _xr, tested_axes, + KokkosFFT::irfftn(execution_space(), xr_hat, inv_xr_hat, tested_axes, KokkosFFT::Normalization::backward); - EXPECT_TRUE(allclose(_xr, ref_xr, 1.e-5, atol)); + EXPECT_TRUE(allclose(inv_xr_hat, ref_xr, 1.e-5, atol)); } }