Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Fft.h
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef SKA_CHEETAH_FFT_ALTERA_FFT_H
25 #define SKA_CHEETAH_FFT_ALTERA_FFT_H
26 
27 #ifdef ENABLE_OPENCL
28 #include "cheetah/fft/altera/detail/FftWorker.h"
29 #endif // ENABLE_OPENCL
30 
31 #include "cheetah/fft/altera/Config.h"
32 #include "cheetah/data/ComplexTypeTraits.h"
33 #include "cheetah/data/FrequencySeries.h"
34 #include "cheetah/data/TimeSeries.h"
35 #include "cheetah/utils/AlgorithmBase.h"
36 #include "cheetah/utils/Architectures.h"
37 #include "panda/DeviceLocal.h"
38 
39 namespace ska {
40 namespace cheetah {
41 namespace fft {
42 class Config;
43 namespace altera {
44 
52 #ifdef ENABLE_OPENCL
53 class Fft: utils::AlgorithmBase<Config, fft::Config>
54 {
55 
56  public:
57  typedef typename cheetah::Fpga Architecture;
58  template<typename T>
59  using ComplexT = typename data::ComplexTypeTraits<Architecture,T>::type;
60 
61  private:
62  typedef panda::PoolResource<Architecture> ResourceType;
63 
64  public:
65  Fft(fft::Config const& algo_config);
66  Fft(Fft const&) = delete;
67  Fft(Fft&&) = default;
68 
72  template <typename T, typename InputAlloc, typename OutputAlloc>
73  void process(ResourceType& fpga,
74  data::TimeSeries<cheetah::Fpga,T,InputAlloc> const& input,
75  data::FrequencySeries<cheetah::Fpga, ComplexT<T>, OutputAlloc>& output);
76 
77  /*
78  * commented FFT types for future scope: C2R, C2C_fwd, C2C_inv
79  */
80  /*
81  template <typename T, typename InputAlloc, typename OutputAlloc>
82  void process(ResourceType& fpga,
83  data::FrequencySeries<cheetah::Fpga, ComplexT<T>, InputAlloc> const& input,
84  data::TimeSeries<cheetah::Fpga,T,OutputAlloc>& output);
85  */
86 
87  /*
88  template <typename T, typename InputAlloc, typename OutputAlloc>
89  void process(ResourceType& fpga,
90  data::TimeSeries<cheetah::Fpga, std::complex<T>, InputAlloc> const& input,
91  data::FrequencySeries<cheetah::Fpga, ComplexT<T>, OutputAlloc>& output);
92  */
93 
94  /*
95  template <typename T, typename InputAlloc, typename OutputAlloc>
96  void process(ResourceType& fpga,
97  data::FrequencySeries<cheetah::Fpga, std::complex<T>, InputAlloc> const& input,
98  data::TimeSeries<cheetah::Fpga, ComplexT<T>, OutputAlloc>& output);
99  */
100 
101  private:
102  struct WorkerFactory {
103  public:
104  WorkerFactory(fft::Config const&);
105  FftWorker* operator()(panda::PoolResource<Architecture> const& device);
106 
107  private:
108  fft::Config const& _config;
109  };
110 
111  private:
112  panda::DeviceLocal<panda::PoolResource<Architecture>, WorkerFactory> _workers;
113 
114 };
115 #else // ENABLE_OPENCL
116 
117 // Dummy class
118 class Fft
119 {
120  public:
121  typedef typename cheetah::Fpga Architecture;
122 
123  public:
124  Fft(fft::Config const&) {};
125 };
126 #endif // ENABLE_OPENCL
127 
128 } // namespace altera
129 } // namespace fft
130 } // namespace cheetah
131 } // namespace ska
132 
133 #include "cheetah/fft/altera/detail/Fft.cpp"
134 
135 #endif // SKA_CHEETAH_FFT_ALTERA_CXFT_H
Configuration for the fft module.
Definition: Config.h:42
Intel FPGA OpenCL FFT interface.
Definition: Fft.h:118
Some limits and constants for FLDO.
Definition: Brdz.h:35