Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Public Member Functions | List of all members
ska::cheetah::hrms::cuda::detail::HarmonicSumFunctor< T, max_harms > Struct Template Reference

A thrust functor for harmonic summing. More...

Collaboration diagram for ska::cheetah::hrms::cuda::detail::HarmonicSumFunctor< T, max_harms >:
Collaboration graph

Public Member Functions

 HarmonicSumFunctor (T const *input, T **output)
 Construct a new instance. More...
 
__host__ __device__ void operator() (unsigned idx) const
 

Detailed Description

template<typename T, unsigned max_harms>
struct ska::cheetah::hrms::cuda::detail::HarmonicSumFunctor< T, max_harms >

A thrust functor for harmonic summing.

This is a private class that is only used by the cuda::Hrms object to implement harmonic summing using the for_each capabilites of Thrust.

Template Parameters
TThe value type of the series to be summed
max_harmsThe max number of sums to be performed used for compile-time loop unrolling.

Definition at line 27 of file Hrms.cu.

Constructor & Destructor Documentation

◆ HarmonicSumFunctor()

template<typename T , unsigned max_harms>
ska::cheetah::hrms::cuda::detail::HarmonicSumFunctor< T, max_harms >::HarmonicSumFunctor ( T const *  input,
T **  output 
)

Construct a new instance.

Parameters
inputPointer to the data to be summed.
outputArray of pointers to the output data buffers

Definition at line 51 of file Hrms.cu.

52  : _input(input)
53  , _output(output)
54 {
55 }

Member Function Documentation

◆ operator()()

template<typename T , unsigned max_harms>
__host__ __device__ void ska::cheetah::hrms::cuda::detail::HarmonicSumFunctor< T, max_harms >::operator() ( unsigned  idx) const
inline

For a given index this method will calculate the relevant summed value for that index in each output array.

This is not an optimised implementation of the harmonic summing, but it should be within ~5% of the speed of a texture + tricks implementation (assuming enough information is available at compile time to unroll).

Definition at line 63 of file Hrms.cu.

64 {
65  unsigned int ii, jj, harm;
66  float fharm;
67  T val = _input[idx];
68 
69  //#pragma unroll -- these want to be unrolled
70  for (jj=0; jj<max_harms; jj++)
71  {
72  harm = 1<<(jj+1);
73  fharm = 1.0f/harm;
74 
75  //#pragma unroll -- these want to be unrolled
76  for (ii=1;ii<harm;ii+=2)
77  {
78  float factor = ii*fharm;
79  val += _input[(unsigned int) (idx*factor + 0.5f)];
80  }
81  _output[jj][idx] = val;
82  }
83 }

The documentation for this struct was generated from the following file: