Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Fldo.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_FLDO_CUDA_FLDO_H
25 #define SKA_CHEETAH_FLDO_CUDA_FLDO_H
26 #include "cheetah/fldo/Config.h"
27 #include "cheetah/fldo/cuda/Config.h"
28 #include "cheetah/fldo/Types.h"
29 
30 namespace ska {
31 namespace cheetah {
32 namespace fldo {
33 namespace cuda {
34 
35 template<typename FldoTraits
36  ,typename Enable=void>
37 class Fldo
38 {
39  public:
40  typedef cheetah::Cpu Architecture;
41  typedef panda::PoolResource<Architecture> ResourceType;
42  typedef cuda::Config Config;
43  typedef FldoTraits Traits;
44 
45  private:
47 
48  public:
49  Fldo(fldo::Config const&) {
50 #ifdef ENABLE_CUDA
51  throw panda::Error("fldo cuda origami algo does not exist for this data type");
52 #else // ENABLE_CUDA
53  throw panda::Error("fldo cuda(origami) algo has not been compiled in. recompile with cmake -DENABLE_CUDA=true option");
54 #endif // ENABLE_CUDA
55  };
56 
57  std::shared_ptr<data::Ocld> operator()(ResourceType&
58  , std::vector<std::shared_ptr<TimeFrequencyType>> const&
59  , data::Scl const&)
60  {
61  std::shared_ptr<data::Ocld> output = data::Ocld::make_shared();
62  return output;
63  }
64 };
65 
66 } // namespace ska
67 } // namespace cheetah
68 } // namespace fldo
69 } // namespace cuda
70 
71 #ifdef ENABLE_CUDA
72 #include "cheetah/fldo/cuda/detail/Fldo.cuh"
73 
74 namespace ska {
75 namespace cheetah {
76 namespace fldo {
77 namespace cuda {
78 
79 // 8-bit implemntations
80 template<typename FldoTraits>
81 class Fldo<FldoTraits
82  , typename std::enable_if<std::is_same<typename FldoTraits::TimeFrequencyType::value_type, uint8_t>::value>::type>
83  : public detail::Fldo<FldoTraits>
84 {
85  typedef detail::Fldo<FldoTraits> BaseT;
86 
87  public:
88  typedef cheetah::Cuda Architecture;
89  typedef typename BaseT::ArchitectureCapability ArchitectureCapability;
90 
91  typedef panda::PoolResource<Architecture> ResourceType;
92  typedef typename BaseT::Config Config;
93  typedef FldoTraits Traits;
94 
95  public:
97 
101  inline
102  std::shared_ptr<data::Ocld> operator()(ResourceType& res
103  , std::vector<std::shared_ptr<data::TimeFrequency<Cpu, uint8_t>>> const& data
104  , data::Scl const& scl)
105  {
106  return BaseT::operator()(res, data, scl);
107  }
108 };
109 
110 } // namespace cuda
111 } // namespace fldo
112 } // namespace cheetah
113 } // namespace ska
114 
115 #endif //ENABLE_CUDA
116 
117 
118 #endif // SKA_CHEETAH_FLDO_CUDA_FLDO_H
Some limits and constants for FLDO.
Definition: Brdz.h:35
Sifted Candidate List.
Definition: Scl.h:45
The interface for the CUDA FLDO algorithm.
Definition: Fldo.cuh:65
Configuration details for the fldo module.
Definition: Config.h:51