Skip to content

Commit

Permalink
rename: is_in_place to is_inplace
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Oct 5, 2024
1 parent 0951ada commit fb9007b
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 45 deletions.
6 changes: 3 additions & 3 deletions common/src/KokkosFFT_layouts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Impl {
template <typename InViewType, typename OutViewType, std::size_t DIM = 1>
auto get_extents(const InViewType& in, const OutViewType& out,
axis_type<DIM> axes, shape_type<DIM> shape = {},
bool is_in_place = false) {
bool is_inplace = false) {
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;
using array_layout_type = typename InViewType::array_layout;
Expand Down Expand Up @@ -66,7 +66,7 @@ auto get_extents(const InViewType& in, const OutViewType& out,

if (is_real_v<in_value_type>) {
// Then R2C
if (is_in_place) {
if (is_inplace) {
_in_extents.at(inner_most_axis) = _out_extents.at(inner_most_axis) * 2;
} else {
KOKKOSFFT_THROW_IF(
Expand All @@ -79,7 +79,7 @@ auto get_extents(const InViewType& in, const OutViewType& out,

if (is_real_v<out_value_type>) {
// Then C2R
if (is_in_place) {
if (is_inplace) {
_out_extents.at(inner_most_axis) = _in_extents.at(inner_most_axis) * 2;
} else {
KOKKOSFFT_THROW_IF(
Expand Down
16 changes: 8 additions & 8 deletions fft/src/KokkosFFT_Cuda_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<1> axes, shape_type<1> s,
bool is_in_place) {
bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -45,7 +45,7 @@ auto create_plan(const ExecutionSpace& exec_space,
auto type = KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
const int nx = fft_extents.at(0);
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());
Expand All @@ -66,7 +66,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<2> axes, shape_type<2> s,
bool is_in_place) {
bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -88,7 +88,7 @@ auto create_plan(const ExecutionSpace& exec_space,
auto type = KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
[[maybe_unused]] auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
const int nx = fft_extents.at(0), ny = fft_extents.at(1);
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());
Expand All @@ -109,7 +109,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<3> axes, shape_type<3> s,
bool is_in_place) {
bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -131,7 +131,7 @@ auto create_plan(const ExecutionSpace& exec_space,
auto type = KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
[[maybe_unused]] auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);

const int nx = fft_extents.at(0), ny = fft_extents.at(1),
nz = fft_extents.at(2);
Expand All @@ -154,7 +154,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<fft_rank> axes,
shape_type<fft_rank> s, bool is_in_place) {
shape_type<fft_rank> s, bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -175,7 +175,7 @@ auto create_plan(const ExecutionSpace& exec_space,
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
Expand Down
16 changes: 8 additions & 8 deletions fft/src/KokkosFFT_HIP_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<1> axes, shape_type<1> s,
bool is_in_place) {
bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -45,7 +45,7 @@ auto create_plan(const ExecutionSpace& exec_space,
auto type = KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
const int nx = fft_extents.at(0);
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());
Expand All @@ -66,7 +66,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<2> axes, shape_type<2> s,
bool is_in_place) {
bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -88,7 +88,7 @@ auto create_plan(const ExecutionSpace& exec_space,
auto type = KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
[[maybe_unused]] auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
const int nx = fft_extents.at(0), ny = fft_extents.at(1);
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());
Expand All @@ -109,7 +109,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<3> axes, shape_type<3> s,
bool is_in_place) {
bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -131,7 +131,7 @@ auto create_plan(const ExecutionSpace& exec_space,
auto type = KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
[[maybe_unused]] auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);

const int nx = fft_extents.at(0), ny = fft_extents.at(1),
nz = fft_extents.at(2);
Expand All @@ -154,7 +154,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<fft_rank> axes,
shape_type<fft_rank> s, bool is_in_place) {
shape_type<fft_rank> s, bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -175,7 +175,7 @@ auto create_plan(const ExecutionSpace& exec_space,
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
Expand Down
4 changes: 2 additions & 2 deletions fft/src/KokkosFFT_Host_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
[[maybe_unused]] Direction direction, axis_type<fft_rank> axes,
shape_type<fft_rank> s, bool is_in_place) {
shape_type<fft_rank> s, bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -64,7 +64,7 @@ auto create_plan(const ExecutionSpace& exec_space,
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
Expand Down
20 changes: 10 additions & 10 deletions fft/src/KokkosFFT_Plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Plan {
bool m_is_crop_or_pad_needed = false;

//! in-place transform or not
bool m_is_in_place = false;
bool m_is_inplace = false;

//! axes for fft
axis_type<DIM> m_axes;
Expand Down Expand Up @@ -204,16 +204,16 @@ class Plan {
m_shape = KokkosFFT::Impl::get_modified_shape(in, out, s, m_axes);
m_is_crop_or_pad_needed =
KokkosFFT::Impl::is_crop_or_pad_needed(in, m_shape);
m_is_in_place = KokkosFFT::Impl::are_aliasing(in.data(), out.data());
KOKKOSFFT_THROW_IF(m_is_in_place && m_is_transpose_needed,
m_is_inplace = KokkosFFT::Impl::are_aliasing(in.data(), out.data());
KOKKOSFFT_THROW_IF(m_is_inplace && m_is_transpose_needed,
"In-place transform is not supported with transpose. "
"Please use out-of-place transform.");
KOKKOSFFT_THROW_IF(m_is_in_place && m_is_crop_or_pad_needed,
KOKKOSFFT_THROW_IF(m_is_inplace && m_is_crop_or_pad_needed,
"In-place transform is not supported with reshape. "
"Please use out-of-place transform.");
m_fft_size = KokkosFFT::Impl::create_plan(exec_space, m_plan, in, out,
m_buffer, m_info, direction,
m_axes, s, m_is_in_place);
m_axes, s, m_is_inplace);
}

/// \brief Constructor for multidimensional FFT
Expand Down Expand Up @@ -267,16 +267,16 @@ class Plan {
m_shape = KokkosFFT::Impl::get_modified_shape(in, out, s, m_axes);
m_is_crop_or_pad_needed =
KokkosFFT::Impl::is_crop_or_pad_needed(in, m_shape);
m_is_in_place = KokkosFFT::Impl::are_aliasing(in.data(), out.data());
KOKKOSFFT_THROW_IF(m_is_in_place && m_is_transpose_needed,
m_is_inplace = KokkosFFT::Impl::are_aliasing(in.data(), out.data());
KOKKOSFFT_THROW_IF(m_is_inplace && m_is_transpose_needed,
"In-place transform is not supported with transpose. "
"Please use out-of-place transform.");
KOKKOSFFT_THROW_IF(m_is_in_place && m_is_crop_or_pad_needed,
KOKKOSFFT_THROW_IF(m_is_inplace && m_is_crop_or_pad_needed,
"In-place transform is not supported with reshape. "
"Please use out-of-place transform.");
m_fft_size =
KokkosFFT::Impl::create_plan(exec_space, m_plan, in, out, m_buffer,
m_info, direction, axes, s, m_is_in_place);
m_info, direction, axes, s, m_is_inplace);
}

~Plan() {
Expand Down Expand Up @@ -333,7 +333,7 @@ class Plan {
KokkosFFT::Direction direction() const { return m_direction; }
bool is_transpose_needed() const { return m_is_transpose_needed; }
bool is_crop_or_pad_needed() const { return m_is_crop_or_pad_needed; }
bool is_in_place() const { return m_is_in_place; }
bool is_inplace() const { return m_is_inplace; }
extents_type shape() const { return m_shape; }
map_type map() const { return m_map; }
map_type map_inv() const { return m_map_inv; }
Expand Down
6 changes: 3 additions & 3 deletions fft/src/KokkosFFT_ROCM_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ auto create_plan(const ExecutionSpace& exec_space,
const OutViewType& out, BufferViewType& buffer,
InfoType& execution_info, Direction direction,
axis_type<fft_rank> axes, shape_type<fft_rank> s,
bool is_in_place) {
bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -114,7 +114,7 @@ auto create_plan(const ExecutionSpace& exec_space,
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
Expand Down Expand Up @@ -156,7 +156,7 @@ auto create_plan(const ExecutionSpace& exec_space,

// Out-of-place transform
const rocfft_result_placement place =
is_in_place ? rocfft_placement_inplace : rocfft_placement_notinplace;
is_inplace ? rocfft_placement_inplace : rocfft_placement_notinplace;

// Create a plan
plan = std::make_unique<PlanType>();
Expand Down
6 changes: 3 additions & 3 deletions fft/src/KokkosFFT_SYCL_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<fft_rank> axes,
shape_type<fft_rank> s, bool is_in_place) {
shape_type<fft_rank> s, bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand All @@ -69,7 +69,7 @@ auto create_plan(const ExecutionSpace& exec_space,
"KokkosFFT::create_plan: Rank of View must be larger than Rank of FFT.");

auto [in_extents, out_extents, fft_extents, howmany] =
KokkosFFT::Impl::get_extents(in, out, axes, s, is_in_place);
KokkosFFT::Impl::get_extents(in, out, axes, s, is_inplace);
int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1,
std::multiplies<>());
int odist = std::accumulate(out_extents.begin(), out_extents.end(), 1,
Expand Down Expand Up @@ -99,7 +99,7 @@ auto create_plan(const ExecutionSpace& exec_space,
static_cast<std::int64_t>(howmany));

// Data layout in conjugate-even domain
int placement = is_in_place ? DFTI_INPLACE : DFTI_NOT_INPLACE;
int placement = is_inplace ? DFTI_INPLACE : DFTI_NOT_INPLACE;
plan->set_value(oneapi::mkl::dft::config_param::PLACEMENT, placement);
plan->set_value(oneapi::mkl::dft::config_param::CONJUGATE_EVEN_STORAGE,
DFTI_COMPLEX_COMPLEX);
Expand Down
4 changes: 2 additions & 2 deletions fft/src/KokkosFFT_Transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ void exec_impl(
KokkosFFT::Impl::exec_plan(plan.plan(), idata, odata, direction, plan.info());

if constexpr (is_complex_v<in_value_type> && is_real_v<out_value_type>) {
auto const is_in_place = plan.is_in_place();
if (is_in_place) {
auto const is_inplace = plan.is_inplace();
if (is_inplace) {
// For the in-place Complex to Real transform, the output must be reshaped
// to fit the original size (in.size() * 2) for correct normalization
using OutUViewType =
Expand Down
12 changes: 6 additions & 6 deletions fft/unit_test/Test_Transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void test_fft1_identity(T atol = 1.0e-12) {
}

template <typename T, typename LayoutType>
void test_fft1_identity_in_place(T atol = 1.0e-12) {
void test_fft1_identity_inplace(T atol = 1.0e-12) {
const int maxlen = 32;
using RealView1DType = Kokkos::View<T*, LayoutType, execution_space>;
using RealUView1DType = Kokkos::View<T*, LayoutType, execution_space,
Expand Down Expand Up @@ -1124,12 +1124,12 @@ TYPED_TEST(FFT1D, Identity_1DView) {
}

// Identity tests on 1D Views for in-place transform
TYPED_TEST(FFT1D, Identity_1DView_in_place) {
TYPED_TEST(FFT1D, Identity_1DView_inplace) {
using float_type = typename TestFixture::float_type;
using layout_type = typename TestFixture::layout_type;

float_type atol = std::is_same_v<float_type, float> ? 1.0e-6 : 1.0e-12;
test_fft1_identity_in_place<float_type, layout_type>(atol);
test_fft1_identity_inplace<float_type, layout_type>(atol);
}

// Identity tests on 1D Views with plan reuse
Expand Down Expand Up @@ -1695,7 +1695,7 @@ void test_fft2_2dfft_2dview_shape(T atol = 1.0e-12) {
}

template <typename T, typename LayoutType>
void test_fft2_2dfft_2dview_in_place(T atol = 1.0e-12) {
void test_fft2_2dfft_2dview_inplace([[maybe_unused]] T atol = 1.0e-12) {
const int n0 = 4, n1 = 6;
using RealView2DType = Kokkos::View<T**, LayoutType, execution_space>;
using RealUView2DType = Kokkos::View<T**, LayoutType, execution_space,
Expand Down Expand Up @@ -2300,11 +2300,11 @@ TYPED_TEST(FFT2D, 2DFFT_2DView_shape) {
}

// fft2 on 2D Views with in-place transform
TYPED_TEST(FFT2D, 2DFFT_2DView_in_place) {
TYPED_TEST(FFT2D, 2DFFT_2DView_inplace) {
using float_type = typename TestFixture::float_type;
using layout_type = typename TestFixture::layout_type;

test_fft2_2dfft_2dview_in_place<float_type, layout_type>();
test_fft2_2dfft_2dview_inplace<float_type, layout_type>();
}

// batced fft2 on 3D Views
Expand Down

0 comments on commit fb9007b

Please sign in to comment.