Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
FftPlan.cu
1 #include "cheetah/fft/cuda/FftPlan.cuh"
2 
3 namespace ska {
4 namespace cheetah {
5 namespace fft {
6 namespace cuda {
7 
8 bool FftPlan::valid(cufftType cufft_type, std::size_t size, std::size_t batch) const
9 {
10  return ((cufft_type==_cufft_type) && (size==_size) && (batch==_batch));
11 }
12 
13 
15  : _plan(0)
16  , _size(0)
17  , _batch(0)
18  , _cufft_type(CUFFT_R2C)
19 {
20 }
21 
23 {
24  destroy_plan();
25 }
26 
27 void FftPlan::destroy_plan()
28 {
29  if (_plan)
30  CUFFT_ERROR_CHECK(cufftDestroy(_plan));
31  _plan = 0;
32  _size = 0;
33  _batch = 0;
34 }
35 
36 template <>
37 cufftType FftPlan::convert_to_cufft_type<float>(FftType fft_type) const
38 {
39  switch (fft_type)
40  {
41  case R2C:
42  return CUFFT_R2C;
43  case C2R:
44  return CUFFT_C2R;
45  case C2C:
46  return CUFFT_C2C;
47  default:
48  return CUFFT_R2C; // this should throw but no return value raises warning
49  }
50 }
51 
52 template <>
53 cufftType FftPlan::convert_to_cufft_type<double>(FftType fft_type) const
54 {
55  switch (fft_type)
56  {
57  case R2C:
58  return CUFFT_D2Z;
59  case C2R:
60  return CUFFT_Z2D;
61  case C2C:
62  return CUFFT_Z2Z;
63  default:
64  return CUFFT_D2Z; // this should throw but no return value raises warning
65  }
66 }
67 
68 } // namespace cuda
69 } // namespace fft
70 } // namespace cheetah
71 } // namespace ska
~FftPlan()
Destroys the undetlying cufft plan if allocated.
Definition: FftPlan.cu:22
FftPlan()
Construct an uninitialised cufft plan.
Definition: FftPlan.cu:14
Some limits and constants for FLDO.
Definition: Brdz.h:35