18#include <Kokkos_Complex.hpp>
20#include <heffte_fft3d.h>
21#include <heffte_fft3d_r2c.h>
35 struct is_ccomplex<
Kokkos::complex<float>> : std::true_type {};
38 struct is_zcomplex<
Kokkos::complex<double>> : std::true_type {};
75#if defined(Heffte_ENABLE_FFTW)
78 using backend = heffte::backend::fftw;
79 using backendSine = heffte::backend::fftw_sin;
80 using backendCos = heffte::backend::fftw_cos;
81 using backendCos1 = heffte::backend::fftw_cos1;
83#elif defined(Heffte_ENABLE_MKL)
86 using backend = heffte::backend::mkl;
87 using backendSine = heffte::backend::mkl_sin;
88 using backendCos = heffte::backend::mkl_cos;
92#ifdef Heffte_ENABLE_CUDA
93#ifdef KOKKOS_ENABLE_CUDA
95 struct HeffteBackendType<
Kokkos::CudaSpace> {
96 using backend = heffte::backend::cufft;
97 using backendSine = heffte::backend::cufft_sin;
98 using backendCos = heffte::backend::cufft_cos;
99 using backendCos1 = heffte::backend::cufft_cos1;
102#error cuFFT backend is enabled for heFFTe but CUDA is not enabled for Kokkos!
106#ifdef KOKKOS_ENABLE_HIP
107#ifdef Heffte_ENABLE_ROCM
109 struct HeffteBackendType<
Kokkos::HIPSpace> {
110 using backend = heffte::backend::rocfft;
111 using backendSine = heffte::backend::rocfft_sin;
112 using backendCos = heffte::backend::rocfft_cos;
113 using backendCos1 = heffte::backend::rocfft_cos1;
118 using backend = heffte::backend::stock;
119 using backendSine = heffte::backend::stock_sin;
120 using backendCos = heffte::backend::stock_cos;
121 using backendCos1 = heffte::backend::stock_cos1;
126#if !defined(Heffte_ENABLE_MKL) && !defined(Heffte_ENABLE_FFTW)
142 template <
typename Field,
template <
typename...>
class FFT,
typename Backend,
159 std::array<long long, 3>& high);
160 void setup(
const heffte::box3d<long long>& inbox,
const heffte::box3d<long long>& outbox,
163 std::shared_ptr<FFT<heffteBackend, long long>>
heffte_m;
166 template <
typename FieldType>
168 typename Kokkos::View<
typename FieldType::view_type::data_type, Kokkos::LayoutLeft,
169 typename FieldType::memory_space>::uniform_type;
173#define IN_PLACE_FFT_BASE_CLASS(Field, Backend) \
174 FFTBase<Field, heffte::fft3d, \
175 typename detail::HeffteBackendType<typename Field::memory_space>::Backend>
176#define EXT_FFT_BASE_CLASS(Field, Backend, Type) \
177 FFTBase<Field, heffte::fft3d_r2c, \
178 typename detail::HeffteBackendType<typename Field::memory_space>::Backend, \
184 template <
class Transform,
typename Field>
190 template <
typename ComplexField>
192 constexpr static unsigned Dim = ComplexField::dim;
199 using typename Base::heffteBackend,
typename Base::workspace_t,
typename Base::Layout_t;
205 void warmup(ComplexField& f);
218 template <
typename RealField>
221 Kokkos::complex<typename RealField::value_type>) {
222 constexpr static unsigned Dim = RealField::dim;
223 using Real_t =
typename RealField::value_type;
225 Kokkos::complex<typename RealField::value_type>);
230 typename RealField::Centering_t,
231 typename RealField::execution_space>::uniform_type;
233 using typename Base::heffteBackend,
typename Base::workspace_t,
typename Base::Layout_t;
238 FFT(
const Layout_t& layoutInput,
const Layout_t& layoutOutput,
const ParameterList& params);
262 template <
typename Field>
269 using typename Base::heffteBackend,
typename Base::workspace_t,
typename Base::Layout_t;
287 template <
typename Field>
294 using typename Base::heffteBackend,
typename Base::workspace_t,
typename Base::Layout_t;
312 template <
typename Field>
319 using typename Base::heffteBackend,
typename Base::workspace_t,
typename Base::Layout_t;
#define EXT_FFT_BASE_CLASS(Field, Backend, Type)
#define IN_PLACE_FFT_BASE_CLASS(Field, Backend)
heffte::backend::stock backend
heffte::backend::stock_cos1 backendCos1
heffte::backend::stock_sin backendSine
heffte::backend::stock_cos backendCos
typename FFT< heffteBackend >::template buffer_container< BufferType > workspace_t
typename Kokkos::View< typename FieldType::view_type::data_type, Kokkos::LayoutLeft, typename FieldType::memory_space >::uniform_type temp_view_type
FieldLayout< Dim > Layout_t
void domainToBounds(const NDIndex< Dim > &domain, std::array< long long, 3 > &low, std::array< long long, 3 > &high)
temp_view_type< Field > tempField
static constexpr unsigned Dim
void setup(const heffte::box3d< long long > &inbox, const heffte::box3d< long long > &outbox, const ParameterList ¶ms)
std::shared_ptr< FFT< heffteBackend, long long > > heffte_m
FFTBase(const Layout_t &layout, const ParameterList ¶ms)
void transform(TransformDirection direction, ComplexField &f)
IN_PLACE_FFT_BASE_CLASS(ComplexField, backend) Base
void warmup(ComplexField &f)
static constexpr unsigned Dim
typename ComplexField::value_type Complex_t
EXT_FFT_BASE_CLASS(RealField, backend, Kokkos::complex< typename RealField::value_type >) Base
static constexpr unsigned Dim
typename Field< Complex_t, Dim, typename RealField::Mesh_t, typename RealField::Centering_t, typename RealField::execution_space >::uniform_type ComplexField
void transform(TransformDirection direction, RealField &f, ComplexField &g)
typename RealField::value_type Real_t
void warmup(RealField &f, ComplexField &g)
Base::template temp_view_type< ComplexField > tempFieldComplex
Kokkos::complex< Real_t > Complex_t
FFT(const Layout_t &layoutInput, const Layout_t &layoutOutput, const ParameterList ¶ms)
static constexpr unsigned Dim
void transform(TransformDirection direction, Field &f)
IN_PLACE_FFT_BASE_CLASS(Field, backendSine) Base
IN_PLACE_FFT_BASE_CLASS(Field, backendCos) Base
void transform(TransformDirection direction, Field &f)
static constexpr unsigned Dim
void transform(TransformDirection direction, Field &f)
IN_PLACE_FFT_BASE_CLASS(Field, backendCos1) Base
static constexpr unsigned Dim
static constexpr unsigned dim