Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Series.h
1 #ifndef SKA_CHEETAH_DATA_CUDA_SERIES_H
2 #define SKA_CHEETAH_DATA_CUDA_SERIES_H
3 #ifdef ENABLE_CUDA
4 #include "cheetah/data/Series.h"
5 #include "cheetah/cuda_utils/cuda_thrust.h"
6 #include <panda/arch/nvidia/DeviceCopy.h>
7 
8 namespace ska {
9 namespace cheetah {
10 namespace data {
11 
12 
13 template <typename ValueType, typename Alloc>
14 class Series<cheetah::Cuda, ValueType, Alloc>: public VectorLike<thrust::device_vector<ValueType,Alloc>>
15 {
16 #ifdef __CUDACC__
17 #if __CUDACC_VER_MAJOR__ > 10 || (__CUDACC_VER_MAJOR__ == 10 && __CUDACC_VER_MINOR__ >= 2)
18 #define __NVCC_THRUST_SUPPORTS_ALLOCATOR_CONSTRUCTORS__
19 #endif
20  typedef VectorLike<thrust::device_vector<ValueType,Alloc>> BaseT;
21 
22  public:
23  typedef cheetah::Cuda ArchitectureType;
24  typedef Alloc Allocator;
25 
26  public:
27  Series(std::size_t size)
28  : BaseT(size)
29  {
30  }
31 
32  template<typename OtherArch, typename OtherAlloc>
33  Series(Series<OtherArch, ValueType, OtherAlloc> const& copy)
34  : BaseT(copy.size())
35  {
36  panda::copy(copy.begin(), copy.end(), this->begin());
37  }
38 
39  Series(std::size_t size, Allocator const& allocator)
40 #ifdef __NVCC_THRUST_SUPPORTS_ALLOCATOR_CONSTRUCTORS__
41  : BaseT(size, allocator)
42  {
43 #else // __NVCC_THRUST_SUPPORTS_ALLOCATOR_CONSTRUCTORS__
44  : BaseT(size)
45  {
46  (void) allocator;
47 #endif // __NVCC_THRUST_SUPPORTS_ALLOCATOR_CONSTRUCTORS__
48  }
49 
50 
54  template<typename OtherArch, typename OtherAlloc>
55  Series(Series<OtherArch, ValueType, OtherAlloc> const& copy, Alloc const& allocator=Alloc())
56 #ifdef __NVCC_THRUST_SUPPORTS_ALLOCATOR_CONSTRUCTORS__
57  : BaseT(copy.size(), allocator)
58  {
59 #else // __NVCC_THRUST_SUPPORTS_ALLOCATOR_CONSTRUCTORS__
60  : BaseT(copy.size())
61  {
62  (void) allocator;
63 #endif // __NVCC_THRUST_SUPPORTS_ALLOCATOR_CONSTRUCTORS__
64  thrust::copy(copy.begin(), copy.end(), this->begin());
65  }
66 #endif // __CUDACC__
67 };
68 
69 } // namespace data
70 } // namespace cheetah
71 } // namespace ska
72 
73 #endif //ENABLE_CUDA
74 #endif // SKA_CHEETAH_DATA_CUDA_SERIES_H
Some limits and constants for FLDO.
Definition: Brdz.h:35
ConstIterator begin() const
Iterators to device memory.
Definition: Series.cpp:67
std::size_t size() const
the size of the series
Definition: Series.cpp:109