Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
FftTester.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_TEST_FFTTESTER_H
25 #define SKA_CHEETAH_FFT_TEST_FFTTESTER_H
26 
27 #include "cheetah/utils/test_utils/AlgorithmTester.h"
28 #include "cheetah/data/Units.h"
29 #include "cheetah/fft/Config.h"
30 #include "cheetah/fft/Fft.h"
31 #include "panda/AlgorithmInfo.h"
32 
33 #include <gtest/gtest.h>
34 
35 namespace ska {
36 namespace cheetah {
37 namespace fft {
38 namespace test {
39 
80 template<typename Algorithm, typename NumericalT>
82  : public utils::test::AlgorithmTesterTraits<typename Algorithm::Architecture, typename panda::AlgorithmInfo<Algorithm>::ArchitectureCapability>
83 {
84  public:
85  typedef Algorithm Algo;
86  typedef typename Algorithm::Architecture Arch;
87  typedef typename panda::AlgorithmInfo<Algorithm>::ArchitectureCapability ArchCap;
89  typedef typename data::ComplexTypeTraits<Arch,NumericalT>::type ComplexT;
90  typedef typename BaseT::DeviceType DeviceType;
91  typedef NumericalT NumericalRep;
92 
93  public:
95  virtual ~FftTesterTraits() {}
96 
102  static double accuracy() { return 1.0e-10; }
103 
108  template<typename DataType>
109  typename DataType::Allocator allocator(panda::PoolResource<Arch>& device) {
110  return typename DataType::Allocator(device);
111  }
112 
113  public:
114  // do not override method calls below this comment
115  fft::Fft& api();
116 
117 
118  public:
123  static const std::size_t fft_trial_length = 1024;
124 
125  private:
126  fft::Config _config;
127  fft::Fft _api;
128 
129 };
130 
131 
132 template <typename TestTraits>
134 {
135  protected:
136  void SetUp();
137  void TearDown();
138 
139  public:
140  FftTester();
141  ~FftTester();
142 
143  private:
144 };
145 
146 TYPED_TEST_CASE_P(FftTester);
147 
148 } // namespace test
149 } // namespace fft
150 } // namespace cheetah
151 } // namespace ska
152 
153 #include "cheetah/fft/test_utils/detail/FftTester.cpp"
154 
155 
156 #endif // SKA_CHEETAH_FFT_TEST_FFTTESTER_H
Configuration for the fft module.
Definition: Config.h:42
A class for performing FFTs.
Definition: Fft.h:50
static double accuracy()
defines accuracy requirement for when the input data is compared with the Fourier transform followed ...
Definition: FftTester.h:102
A helper class to determine the type of complex data for different architectures. ...
Some limits and constants for FLDO.
Definition: Brdz.h:35
static const std::size_t fft_trial_length
FFT trial length (size of input data)
Definition: FftTester.h:123
describes the algorithm to be tested to the AlgorithmTester
Base class for generic algortihm tests that require an accelerator device.
DataType::Allocator allocator(panda::PoolResource< Arch > &device)
provides a default allocator contruction for the DataType provided
Definition: FftTester.h:109