You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs: Add default explanations for APIs
* Add docs for unmanaged view example
* docs: Explain the meanings of axes
* docs: we do not rely on assertions any more
* docs: fix based on a review
* docs: fix title for unmanaged view example
* fix: docs of fftshift based on reviews
* docs: improve the explanations for axes parameters
* docs: further fix
* docs: fixed typo based on reviews
---------
Co-authored-by: Yuuichi Asahi <y.asahi@nr.titech.ac.jp>
Copy file name to clipboardexpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
13
13
> EXPERIMENTAL FFT interfaces for Kokkos C++ Performance Portability Programming EcoSystem
14
14
15
15
Kokkos-fft implements local interfaces between [Kokkos](https://github.com/kokkos/kokkos) and de facto standard FFT libraries, including [fftw](http://www.fftw.org), [cufft](https://developer.nvidia.com/cufft), [hipfft](https://github.com/ROCm/hipFFT) ([rocfft](https://github.com/ROCm/rocFFT)), and [oneMKL](https://spec.oneapi.io/versions/latest/elements/oneMKL/source/index.html). "Local" means not using MPI, or running within a single MPI process without knowing about MPI. We are inclined to implement the [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html)-like interfaces adapted for [Kokkos](https://github.com/kokkos/kokkos).
16
-
A key concept is that **"As easy as numpy, as fast as vendor libraries"**. Accordingly, our API follows the API by [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) with minor differences. A fft library dedicated to Kokkos Device backend (e.g. [cufft](https://developer.nvidia.com/cufft) for CUDA backend) is automatically used. If something is wrong with runtime values (say `View` extents), it will raise runtime errors (C++ exceptions or assertions). See [documentations](https://kokkosfft.readthedocs.io/) for more information.
16
+
A key concept is that **"As easy as numpy, as fast as vendor libraries"**. Accordingly, our API follows the API by [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) with minor differences. A fft library dedicated to Kokkos Device backend (e.g. [cufft](https://developer.nvidia.com/cufft) for CUDA backend) is automatically used. If something is wrong with runtime values (say `View` extents), it will raise runtime errors (C++ `std::runtime_error`). See [documentations](https://kokkosfft.readthedocs.io/) for more information.
17
17
18
18
Here is an example for 1D real to complex transform with `rfft` in Kokkos-fft.
Copy file name to clipboardexpand all lines: docs/intro/using.rst
+47-1
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ If the rank of Views is higher than the dimension of FFT, a batched FFT plan is
34
34
APIs start from ``i`` represent inverse transforms.
35
35
For Real FFTs, users have to pay attention to the input and output data types as well as their extents.
36
36
Inconsistent data types are suppressed by compilation errors. If extents are inconsistent,
37
-
it will raise runtime errors (C++ exceptions or assertions).
37
+
it will raise runtime errors (C++ ``std::runtime_error``).
38
38
The following listing shows good and bad examples of Real FFTs.
39
39
40
40
.. code-block:: C++
@@ -130,3 +130,49 @@ In some backend, FFT plan creation leads to some overhead, wherein we need this
130
130
.. note::
131
131
132
132
Input and Output Views used to call FFT APIs must have the same types and extents as the ones used for plan creation.
133
+
134
+
Axes parameters
135
+
---------------
136
+
137
+
As well as ``numpy.fft``, you can specify negative axes to perform FFT over chosen axes, which is not common in C++.
138
+
Actually for FFT APIs, default axes are set as ``{-DIM, -(DIM-1), ...}`` where ``DIM`` is the rank of the FFT dimensions,
139
+
corresponding to the FFTs over last ``DIM`` axes. If we consider that default View layout is C layout (row-major or ``Kokkos::LayoutRight``),
140
+
this default axes parameter results in FFTs performed over the contiguous dimensions. For example, ``KokkosFFT::fft2(execution_space(), in, out)`` is equivalent to ``KokkosFFT::fft2(execution_space(), in, out, axis_type<2>({-2, -1}))``.
141
+
Negative axes are counted from the last axis, which is the same as ``numpy.fft``.
142
+
For example, ``-1`` means the last axis, ``-2`` means the second last axis, and so on.
143
+
Negative axes ``-1`` and ``-2`` respectively correspond to ``rank-1`` and ``rank-2``, where the ``rank`` is the rank of the Views.
144
+
145
+
The following listing shows examples of axes parameters with negative or positive values.
146
+
147
+
.. code-block:: C++
148
+
149
+
template <typename T> using View2D = Kokkos::View<T**, Kokkos::LayoutLeft, execution_space>;
150
+
template <typename T> using View3D = Kokkos::View<T***, Kokkos::LayoutLeft, execution_space>;
0 commit comments