10 #include "etl/impl/std/fft.hpp" 11 #include "etl/impl/blas/fft.hpp" 12 #include "etl/impl/cufft/fft.hpp" 19 enum class precision {
34 constexpr
fft_impl select_default_fft1_impl(
bool no_gpu) {
39 if (cufft && !no_gpu) {
57 constexpr
fft_impl select_default_fft1_many_impl(
bool no_gpu) {
64 if (cufft && !no_gpu) {
81 constexpr
fft_impl select_default_ifft1_impl(
bool no_gpu) {
86 if (cufft && !no_gpu) {
104 constexpr
fft_impl select_default_fft2_impl(
bool no_gpu) {
109 if (cufft && !no_gpu) {
128 constexpr
fft_impl select_default_fft2_many_impl(
bool no_gpu) {
135 if (cufft && !no_gpu) {
144 #ifdef ETL_MANUAL_SELECT 166 std::cerr <<
"Forced selection to MKL fft implementation, but not possible for this expression" << std::endl;
175 std::cerr <<
"Forced selection to CUFFT fft implementation, but not possible for this expression" << std::endl;
195 inline fft_impl select_fft1_impl() {
196 return select_forced_fft_impl(select_default_fft1_impl(
local_context().cpu));
205 inline fft_impl select_fft1_many_impl() {
206 return select_forced_fft_impl(select_default_fft1_many_impl(
local_context().cpu));
214 inline fft_impl select_ifft1_impl() {
215 return select_forced_fft_impl(select_default_ifft1_impl(
local_context().cpu));
224 inline fft_impl select_fft2_impl() {
225 return select_forced_fft_impl(select_default_fft2_impl(
local_context().cpu));
235 inline fft_impl select_fft2_many_impl() {
236 return select_forced_fft_impl(select_default_fft2_many_impl(
local_context().cpu));
246 constexpr
fft_impl select_fft1_impl() {
247 return (select_default_fft1_impl(
false));
256 constexpr
fft_impl select_fft1_many_impl() {
257 return (select_default_fft1_many_impl(
false));
265 constexpr
fft_impl select_ifft1_impl() {
266 return (select_default_ifft1_impl(
false));
275 constexpr
fft_impl select_fft2_impl() {
276 return (select_default_fft2_impl(
false));
286 constexpr
fft_impl select_fft2_many_impl() {
287 return (select_default_fft2_many_impl(
false));
300 template <
typename A>
308 template <
typename A,
typename C>
310 constexpr_select
auto impl = select_fft1_impl();
338 template <
typename A>
346 template <
typename C>
348 constexpr_select
auto impl = select_fft1_impl();
353 etl::impl::standard::fft1(c, c);
358 etl::impl::blas::fft1(c, c);
363 etl::impl::cufft::inplace_fft1(c);
376 template <
typename A>
384 template <
typename A,
typename C>
386 constexpr_select
auto impl = select_ifft1_impl();
414 template <
typename A>
422 template <
typename C>
424 constexpr_select
auto impl = select_ifft1_impl();
429 etl::impl::standard::ifft1(c, c);
434 etl::impl::blas::ifft1(c, c);
439 etl::impl::cufft::inplace_ifft1(c);
452 template <
typename A>
460 template <
typename A,
typename C>
462 constexpr_select
auto impl = select_ifft1_impl();
490 template <
typename A>
498 template <
typename A,
typename C>
500 constexpr_select
auto impl = select_fft2_impl();
528 template <
typename A>
536 template <
typename C>
538 constexpr_select
auto impl = select_fft2_impl();
543 etl::impl::standard::fft2(c, c);
548 etl::impl::blas::fft2(c, c);
553 etl::impl::cufft::inplace_fft2(c);
566 template <
typename A>
574 template <
typename A,
typename C>
576 constexpr_select
auto impl = select_fft2_impl();
604 template <
typename A>
612 template <
typename C>
614 constexpr_select
auto impl = select_fft2_impl();
619 etl::impl::standard::ifft2(c, c);
624 etl::impl::blas::ifft2(c, c);
629 etl::impl::cufft::inplace_ifft2(c);
642 template <
typename A>
650 template <
typename A,
typename C>
652 constexpr_select
auto impl = select_fft2_impl();
680 template <
typename A>
688 template <
typename A,
typename C>
690 const auto impl = select_fft1_many_impl();
718 template <
typename A>
726 template <
typename C>
728 const auto impl = select_fft1_many_impl();
733 etl::impl::standard::fft1_many(c, c);
738 etl::impl::blas::fft1_many(c, c);
743 etl::impl::cufft::inplace_fft1_many(c);
756 template <
typename A>
764 template <
typename A,
typename C>
766 const auto impl = select_fft2_many_impl();
794 template <
typename A>
802 template <
typename C>
804 const auto impl = select_fft2_many_impl();
809 etl::impl::standard::fft2_many(c, c);
814 etl::impl::blas::fft2_many(c, c);
819 etl::impl::cufft::inplace_fft2_many(c);
832 template <
typename A>
840 template <
typename A,
typename C>
842 constexpr_select
auto impl = select_fft1_many_impl();
870 template <
typename A>
878 template <
typename C>
880 constexpr_select
auto impl = select_fft1_many_impl();
885 etl::impl::standard::ifft1_many(c, c);
890 etl::impl::blas::ifft1_many(c, c);
895 etl::impl::cufft::inplace_ifft1_many(c);
908 template <
typename A>
916 template <
typename A,
typename C>
918 constexpr_select
auto impl = select_fft2_many_impl();
946 template <
typename A>
954 template <
typename C>
956 constexpr_select
auto impl = select_fft2_many_impl();
961 etl::impl::standard::ifft2_many(c, c);
966 etl::impl::blas::ifft2_many(c, c);
971 etl::impl::cufft::inplace_ifft2_many(c);
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:689
Functor for Batched 2D FFT.
Definition: fft.hpp:789
Functor for 2D IFFT (real)
Definition: fft.hpp:637
Functor for 2D FFT.
Definition: fft.hpp:485
constexpr bool mkl_enabled
Indicates if the MKL library is available for ETL.
Definition: config.hpp:64
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:461
Functor for Batched 2D IFFT.
Definition: fft.hpp:903
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:765
static void apply(C &&c)
Apply the functor.
Definition: fft.hpp:613
Functor for 1D IFFT.
Definition: fft.hpp:409
static void apply(C &&c)
Apply the functor.
Definition: fft.hpp:537
D D
The number of dimensions.
Definition: dyn_matrix_view.hpp:24
Functor for Batched 1D IFFT.
Definition: fft.hpp:827
Functor for 2D FFT.
Definition: fft.hpp:523
Functor for 1D IFFT.
Definition: fft.hpp:371
Definition: expression_builder.hpp:699
fft_impl
The different FFT implementations.
Definition: fft_impl.hpp:20
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:499
The Intel MKL implementation.
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:651
context & local_context()
Return the configuration context of the current thread.
Definition: context.hpp:50
Functor for Batched 2D IFFT.
Definition: fft.hpp:941
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:917
static void apply(C &&c)
Apply the functor.
Definition: fft.hpp:727
Functor for Batched 1D IFFT.
Definition: fft.hpp:865
Functor for Batched 2D FFT.
Definition: fft.hpp:751
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:309
static void apply(C &&c)
Apply the functor.
Definition: fft.hpp:955
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:385
decltype(auto) smart_forward_gpu(E &expr)
Smart forwarding for a temporary expression that will be computed in GPU.
Definition: helpers.hpp:343
Functor for 1D FFT.
Definition: fft.hpp:295
The NVidia CuFFT implementation.
static void apply(C &&c)
Apply the functor.
Definition: fft.hpp:879
Functor for Batched 1D FFT.
Definition: fft.hpp:675
decltype(auto) smart_forward(E &expr)
Smart forwarding for a temporary expression.
Definition: helpers.hpp:323
static void apply(C &&c)
Apply the functor.
Definition: fft.hpp:347
constexpr bool cufft_enabled
Indicates if the NVIDIA CUFFT library is available for ETL.
Definition: config.hpp:104
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:575
Functor for 2D IFFT.
Definition: fft.hpp:599
Functor for Inplace 1D FFT.
Definition: fft.hpp:333
Functor for 2D IFFT.
Definition: fft.hpp:561
void inc_counter([[maybe_unused]] const char *name)
Increase the given counter.
Definition: counters.hpp:25
static void apply(C &&c)
Apply the functor.
Definition: fft.hpp:423
static void apply(A &&a, C &&c)
Apply the functor.
Definition: fft.hpp:841
Functor for Batched 1D FFT.
Definition: fft.hpp:713
Functor for 1D IFFT (real)
Definition: fft.hpp:447
static void apply(C &&c)
Apply the functor.
Definition: fft.hpp:803