Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Ddtr.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_DDTR_ASTROACCELERATE_DDTR_H
25 #define SKA_CHEETAH_DDTR_ASTROACCELERATE_DDTR_H
26 
27 #include "DdtrWorker.h"
28 #include "DedispersionPlan.h"
29 #include "cheetah/ddtr/Config.h"
30 #include <panda/DeviceLocal.h>
31 
32 namespace ska {
33 namespace cheetah {
34 namespace ddtr {
35 namespace astroaccelerate {
36 
41 template<typename DdtrTraits>
42 class Ddtr
43 {
44  typedef typename DdtrTraits::value_type NumericalT;
45  typedef typename DdtrTraits::DedispersionHandler DedispersionHandler;
46  typedef typename DdtrTraits::DmTrialsType DmTrialsType;
47  typedef typename DdtrTraits::TimeFrequencyType TimeFrequencyType;
48 
49  typedef ddtr::Config::Dm Dm;
50  typedef typename DdtrTraits::BufferFillerType BufferFillerType;
51  typedef typename DdtrTraits::BufferType BufferType;
52  typedef std::vector<ddtr::Config::Dm> DmListType;
53  typedef typename TimeFrequencyType::FrequencyType FrequencyType;
54  typedef typename TimeFrequencyType::TimeType TimeType;
55  typedef std::vector<FrequencyType> FrequencyListType;
56 
57  public:
58  typedef cheetah::Cuda Architecture;
59  typedef panda::nvidia::DeviceCapability<3, 5, panda::nvidia::giga> ArchitectureCapability;
62 
63  public:
64  Ddtr(ddtr::Config const& config);
65  Ddtr(Ddtr const&) = delete;
66  Ddtr(Ddtr&&);
67 
68  std::shared_ptr<DmTrialsType> operator()(panda::PoolResource<cheetah::Cuda>& gpu, BufferType const& data);
69 
75  void operator()(TimeFrequencyType const& data);
76 
77  void plan(DedispersionPlan const& plan)
78  {
79  _plan = std::make_shared<DedispersionPlan>(plan);
80  //_max_delay = _plan->buffer_overlap();
81  //_dm_trial_metadata = _plan->dm_trial_metadata();
82  }
83 
84  protected:
85  std::size_t set_dedispersion_strategy(std::size_t min_gpu_memory, TimeFrequencyType const& tf_data, panda::PoolResource<cheetah::Cuda> const& gpu);
86 
87  private:
88  struct DdtrWorkerFactory;
89 
90  private:
91 // DedispersionHandler& _dm_trials_handler;
92  std::shared_ptr<DedispersionPlan> _plan;
93  std::unique_ptr<DdtrWorkerFactory> _factory;
94  panda::DeviceLocal<panda::PoolResource<cheetah::Cuda>, DdtrWorkerFactory> _workers;
95 };
96 
97 
98 } // namespace astroaccelerate
99 } // namespace ddtr
100 } // namespace cheetah
101 } // namespace ska
102 #include "detail/Ddtr.cpp"
103 
104 #endif // SKA_CHEETAH_DDTR_ASTROACCELERATE_DDTR_H
an nvidia CUDA gpu algorithm for dedispersion
Definition: Ddtr.h:42
Some limits and constants for FLDO.
Definition: Brdz.h:35