Skip to content

Commit

Permalink
Add insert newline at eof check (#178)
Browse files Browse the repository at this point in the history
* update clang-format version and add InsertNewlineAtEOF check

* Apply new format to source files

* format

---------

Co-authored-by: Yuuichi Asahi <[email protected]>
  • Loading branch information
yasahi-hpc and Yuuichi Asahi authored Oct 24, 2024
1 parent cef9cf5 commit 51a9895
Show file tree
Hide file tree
Showing 41 changed files with 56 additions and 55 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ AlignConsecutiveAssignments: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
CommentPragmas: ' SPDX-'
InsertNewlineAtEOF: true
6 changes: 3 additions & 3 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.13
- uses: DoozyX/clang-format-lint-action@v0.18
with:
source: 'common/ fft/ examples/'
source: 'common/ fft/ examples/ install_test/'
exclude: ''
extensions: 'hpp,cpp'
clangFormatVersion: 12
clangFormatVersion: 17

# check if Docker images should be recreated
check_docker_files:
Expand Down
2 changes: 1 addition & 1 deletion common/src/KokkosFFT_Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,4 @@ void ifftshift(const ExecutionSpace& exec_space, ViewType& inout,
}
} // namespace KokkosFFT

#endif
#endif
2 changes: 1 addition & 1 deletion common/src/KokkosFFT_common_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ constexpr std::size_t MAX_FFT_DIM = 3;

} // namespace KokkosFFT

#endif
#endif
2 changes: 1 addition & 1 deletion common/src/KokkosFFT_normalization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ inline auto swap_direction(Normalization normalization) {
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
10 changes: 5 additions & 5 deletions common/unit_test/Test_Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ void test_get_shift(int direction) {
KokkosFFT::axis_type<2> shift1_axis1_odd_ref = {0, direction * n2 / 2};
KokkosFFT::axis_type<2> shift1_axis1_even_ref = {0, direction * n2 / 2};
KokkosFFT::axis_type<2> shift2_odd_ref = {direction * n_odd / 2,
direction * n2 / 2};
direction * n2 / 2};
KokkosFFT::axis_type<2> shift2_even_ref = {direction * n_even / 2,
direction * n2 / 2};
direction * n2 / 2};

auto shift1_odd = KokkosFFT::Impl::get_shift(
x1_odd, KokkosFFT::axis_type<1>({0}), direction);
Expand Down Expand Up @@ -266,7 +266,7 @@ void test_fftshift1D_2DView(int n0) {

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};
-15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1};
_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,
Expand All @@ -276,7 +276,7 @@ void test_fftshift1D_2DView(int n0) {
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};
-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,
Expand Down Expand Up @@ -387,4 +387,4 @@ TEST_P(FFTShiftParamTests, 2DShift2DView) {
}

INSTANTIATE_TEST_SUITE_P(FFTShift, FFTShiftParamTests,
::testing::Values(9, 10));
::testing::Values(9, 10));
2 changes: 1 addition & 1 deletion common/unit_test/Test_Layouts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,4 +721,4 @@ TYPED_TEST(Layouts2D, 2DFFT_3DView) {
using layout_type = typename TestFixture::layout_type;

test_layouts_2d_batched_FFT_3d<layout_type>();
}
}
2 changes: 1 addition & 1 deletion common/unit_test/Test_Normalization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ TEST(Normalization, None) {
KokkosFFT::Direction::backward,
KokkosFFT::Normalization::none, len);
EXPECT_TRUE(allclose(x_b, ref_b, 1.e-5, 1.e-12));
}
}
2 changes: 1 addition & 1 deletion common/unit_test/Test_Padding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1704,4 +1704,4 @@ TEST(CropOrPad8D, 8DView) {
}
}
}
}
}
2 changes: 1 addition & 1 deletion common/unit_test/Test_Transpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2440,4 +2440,4 @@ TYPED_TEST(Transpose3D, 8DView) {
using layout_type = typename TestFixture::layout_type;

test_transpose_3d_8dview<layout_type>();
}
}
2 changes: 1 addition & 1 deletion common/unit_test/Test_Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ using RightView2D = Kokkos::View<T**, Kokkos::LayoutRight, execution_space>;
template <typename T>
using RightView3D = Kokkos::View<T***, Kokkos::LayoutRight, execution_space>;

#endif
#endif
2 changes: 1 addition & 1 deletion examples/01_1DFFT/01_1DFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ int main(int argc, char* argv[]) {
Kokkos::finalize();

return 0;
}
}
2 changes: 1 addition & 1 deletion examples/02_2DFFT/02_2DFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ int main(int argc, char* argv[]) {
Kokkos::finalize();

return 0;
}
}
2 changes: 1 addition & 1 deletion examples/04_batchedFFT/04_batchedFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ int main(int argc, char* argv[]) {
Kokkos::finalize();

return 0;
}
}
2 changes: 1 addition & 1 deletion examples/05_1DFFT_HOST_DEVICE/05_1DFFT_HOST_DEVICE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ int main(int argc, char* argv[]) {
Kokkos::finalize();

return 0;
}
}
2 changes: 1 addition & 1 deletion examples/06_1DFFT_reuse_plans/06_1DFFT_reuse_plans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ int main(int argc, char* argv[]) {
Kokkos::finalize();

return 0;
}
}
2 changes: 1 addition & 1 deletion fft/perf_test/Benchmark_Context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ void report_results(benchmark::State& state, InViewType in, OutViewType out,

} // namespace KokkosFFTBenchmark

#endif
#endif
2 changes: 1 addition & 1 deletion fft/perf_test/PerfTest_FFT1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ BENCHMARK(IRFFT_1DView<double, Kokkos::LayoutRight>)
->UseManualTime()
->Unit(benchmark::kMicrosecond);

} // namespace KokkosFFTBenchmark
} // namespace KokkosFFTBenchmark
2 changes: 1 addition & 1 deletion fft/perf_test/PerfTest_FFT1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ static void IRFFT_1DView(benchmark::State& state) {

} // namespace KokkosFFTBenchmark

#endif
#endif
2 changes: 1 addition & 1 deletion fft/perf_test/PerfTest_FFT2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ BENCHMARK(IRFFT2_2DView<double, Kokkos::LayoutRight>)
->UseManualTime()
->Unit(benchmark::kMicrosecond);

} // namespace KokkosFFTBenchmark
} // namespace KokkosFFTBenchmark
2 changes: 1 addition & 1 deletion fft/perf_test/PerfTest_FFT2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ static void IRFFT2_2DView(benchmark::State& state) {

} // namespace KokkosFFTBenchmark

#endif
#endif
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
#include "KokkosFFT_Plans.hpp"
#include "KokkosFFT_Transform.hpp"

#endif
#endif
4 changes: 2 additions & 2 deletions fft/src/KokkosFFT_Cuda_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ auto create_plan(const ExecutionSpace& exec_space,
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());

Expand Down
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_Cuda_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,4 @@ auto direction_type(Direction direction) {
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
4 changes: 2 additions & 2 deletions fft/src/KokkosFFT_HIP_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ auto create_plan(const ExecutionSpace& exec_space,
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());

Expand Down
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_HIP_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,4 @@ auto direction_type(Direction direction) {
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
4 changes: 2 additions & 2 deletions fft/src/KokkosFFT_Host_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ auto create_plan(const ExecutionSpace& exec_space,
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());

Expand Down
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_Host_transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ void exec_plan(PlanType plan, fftw_complex* idata, fftw_complex* odata,
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_Host_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ auto direction_type(Direction direction) {
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
8 changes: 4 additions & 4 deletions fft/src/KokkosFFT_Plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@ class Plan {
fft_info_type>(m_plan, m_info);
}

Plan() = delete;
Plan(const Plan&) = delete;
Plan() = delete;
Plan(const Plan&) = delete;
Plan& operator=(const Plan&) = delete;
Plan& operator=(Plan&&) = delete;
Plan(Plan&&) = delete;
Plan& operator=(Plan&&) = delete;
Plan(Plan&&) = delete;

/// \brief Execute FFT on input and output Views with normalization
///
Expand Down
4 changes: 2 additions & 2 deletions fft/src/KokkosFFT_ROCM_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ auto create_plan(const ExecutionSpace& exec_space,
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());

Expand Down
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_ROCM_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ auto direction_type(Direction direction) {
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
6 changes: 3 additions & 3 deletions fft/src/KokkosFFT_SYCL_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ auto create_plan(const ExecutionSpace& exec_space,
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
std::multiplies<>());
std::multiplies<>());
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());

Expand Down Expand Up @@ -118,4 +118,4 @@ void destroy_plan_and_info(std::unique_ptr<PlanType>&, InfoType&) {
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_SYCL_transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ void exec_plan(PlanType& plan, std::complex<double>* idata,
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_SYCL_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,4 @@ auto direction_type(Direction direction) {
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_default_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ struct fft_data_type<ExecutionSpace, Kokkos::complex<T>> {
} // namespace Impl
} // namespace KokkosFFT

#endif
#endif
2 changes: 1 addition & 1 deletion fft/unit_test/Test_Transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3464,4 +3464,4 @@ TYPED_TEST(FFTND, 3DFFT_batched_8DView) {

float_type atol = std::is_same_v<float_type, float> ? 1.0e-5 : 1.0e-10;
test_fftn_3dfft_8dview<float_type, layout_type>(atol);
}
}
2 changes: 1 addition & 1 deletion fft/unit_test/Test_Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ using RightView2D = Kokkos::View<T**, Kokkos::LayoutRight, execution_space>;
template <typename T>
using RightView3D = Kokkos::View<T***, Kokkos::LayoutRight, execution_space>;

#endif
#endif
2 changes: 1 addition & 1 deletion fft/unit_test/Test_Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ void display(ViewType& a) {
std::cout << std::resetiosflags(std::ios_base::floatfield);
}

#endif
#endif
2 changes: 1 addition & 1 deletion install_test/as_library/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ int main(int argc, char* argv[]) {
Kokkos::finalize();

return 0;
}
}
2 changes: 1 addition & 1 deletion install_test/as_subdirectory/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ int main(int argc, char* argv[]) {
Kokkos::finalize();

return 0;
}
}

0 comments on commit 51a9895

Please sign in to comment.