13#ifndef EIGEN_GPU_CUFFT_SUPPORT_H
14#define EIGEN_GPU_CUFFT_SUPPORT_H
17#include "./InternalHeaderCheck.h"
19#include "./GpuSupport.h"
26#define EIGEN_CUFFT_CHECK(x) \
28 const cufftResult _r = (x); \
29 if (_r != CUFFT_SUCCESS) \
30 ::Eigen::gpu::internal::gpu_check_failed_code("cuFFT", static_cast<int>(_r), #x, __FILE__, __LINE__); \
33template <
typename Scalar>
37struct cufft_c2c_type<float> {
38 static constexpr cufftType value = CUFFT_C2C;
41struct cufft_c2c_type<double> {
42 static constexpr cufftType value = CUFFT_Z2Z;
45template <
typename Scalar>
49struct cufft_r2c_type<float> {
50 static constexpr cufftType value = CUFFT_R2C;
53struct cufft_r2c_type<double> {
54 static constexpr cufftType value = CUFFT_D2Z;
57template <
typename Scalar>
61struct cufft_c2r_type<float> {
62 static constexpr cufftType value = CUFFT_C2R;
65struct cufft_c2r_type<double> {
66 static constexpr cufftType value = CUFFT_Z2D;
74 CufftPlan() =
default;
75 explicit CufftPlan(cufftHandle plan) : plan_(plan), owns_(true) {}
77 CufftPlan(
const CufftPlan&) =
delete;
78 CufftPlan& operator=(
const CufftPlan&) =
delete;
80 CufftPlan(CufftPlan&& o) noexcept : plan_(o.plan_), owns_(o.owns_) { o.owns_ =
false; }
82 CufftPlan& operator=(CufftPlan&& o)
noexcept {
92 ~CufftPlan() { destroy(); }
94 cufftHandle get()
const {
return plan_; }
97 void destroy() noexcept {
98 if (owns_) (void)cufftDestroy(plan_);
106inline cufftResult cufftExecC2C_dispatch(cufftHandle plan, std::complex<float>* in, std::complex<float>* out,
108 return cufftExecC2C(plan,
reinterpret_cast<cufftComplex*
>(in),
reinterpret_cast<cufftComplex*
>(out), direction);
110inline cufftResult cufftExecC2C_dispatch(cufftHandle plan, std::complex<double>* in, std::complex<double>* out,
112 return cufftExecZ2Z(plan,
reinterpret_cast<cufftDoubleComplex*
>(in),
reinterpret_cast<cufftDoubleComplex*
>(out),
116inline cufftResult cufftExecR2C_dispatch(cufftHandle plan,
float* in, std::complex<float>* out) {
117 return cufftExecR2C(plan, in,
reinterpret_cast<cufftComplex*
>(out));
119inline cufftResult cufftExecR2C_dispatch(cufftHandle plan,
double* in, std::complex<double>* out) {
120 return cufftExecD2Z(plan, in,
reinterpret_cast<cufftDoubleComplex*
>(out));
123inline cufftResult cufftExecC2R_dispatch(cufftHandle plan, std::complex<float>* in,
float* out) {
124 return cufftExecC2R(plan,
reinterpret_cast<cufftComplex*
>(in), out);
126inline cufftResult cufftExecC2R_dispatch(cufftHandle plan, std::complex<double>* in,
double* out) {
127 return cufftExecZ2D(plan,
reinterpret_cast<cufftDoubleComplex*
>(in), out);
Namespace containing all symbols from the Eigen library.