Skip to content

Conversation

@yasahi-hpc
Copy link
Collaborator

This PR aims at extracting the core logic of get_map_axes which does not rely on View.
For distributed FFT, we do not have an access to the global View which does not necessarily exist.
The extracted function can compute the mapping from the meta data of global View rather than View itself.

@yasahi-hpc yasahi-hpc self-assigned this Oct 17, 2025
KOKKOSFFT_THROW_IF(!KokkosFFT::Impl::are_valid_axes(view, axes),
"get_map_axes: input axes are not valid for the view");

template <typename Layout, std::size_t DIM, typename iType, std::size_t FFT_DIM>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the type parameter iType named in a manner that conforms to the rest of the code base?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, some of them are called IntType and others are called iType
Probably I will rename them IntType, before the release

}

template <typename ViewType, std::size_t DIM>
auto get_map_axes(const ViewType& view, axis_type<DIM> axes) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is axis_type<DIM> always of the form std::array<iType, DIM>?

Also, the name DIM that is used here has a different meaning to the DIM in the other function (it is ViewType::rank() in the other case).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is axis_type always of the form std::array<iType, DIM>?

yes, axis_type<DIM> is an alias to std::array<int, DIM>

OK, I will rename

@science-enthusiast
Copy link

Could you show an example how a call to the following function can be made in the distributed case?

template <typename Layout, std::size_t DIM, typename IntType, std::size_t FFT_DIM>
auto get_map_axes(const std::array<IntType, FFT_DIM>& axes)

Especially, how Layout and DIM are provided?

Otherwise, the PR looks good to me.

@yasahi-hpc
Copy link
Collaborator Author

Could you show an example how a call to the following function can be made in the distributed case?

template <typename Layout, std::size_t DIM, typename IntType, std::size_t FFT_DIM>
auto get_map_axes(const std::array<IntType, FFT_DIM>& axes)

Especially, how Layout and DIM are provided?

Otherwise, the PR looks good to me.

Something like this
https://github.com/yasahi-hpc/distributed-FFT-for-kokkos/blob/c81c339468d4be79bcca2ab92331b8a5537cb3da/distributed/src/KokkosFFT_Distributed_SlabBlockAnalyses.hpp#L42

This class does not have an access to Views. The order of the template argument has been changed

Copy link

@science-enthusiast science-enthusiast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@yasahi-hpc
Copy link
Collaborator Author

@science-enthusiast

Thanks! I will merge this

@yasahi-hpc yasahi-hpc merged commit 3792a08 into kokkos:main Oct 17, 2025
39 checks passed
@yasahi-hpc yasahi-hpc deleted the refactor-get-map-axes branch October 17, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants