CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions
cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS > Class Template Reference

#include <HistoContainer.h>

Inheritance diagram for cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >:
cms::alpakatools::OneToManyAssocRandomAccess< I, NHISTS *NBINS+1, SIZE > cms::alpakatools::OneToManyAssocBase< I, ONES, SIZE >

Public Types

using Base = OneToManyAssocRandomAccess< I, NHISTS *NBINS+1, SIZE >
 
using Counter = typename Base::Counter
 
using index_type = typename Base::index_type
 
using UT = typename std::make_unsigned< T >::type
 
using View = typename Base::View
 
- Public Types inherited from cms::alpakatools::OneToManyAssocRandomAccess< I, NHISTS *NBINS+1, SIZE >
using Counter = typename OneToManyAssocBase< I, ONES, SIZE >::Counter
 
using View = typename OneToManyAssocBase< I, ONES, SIZE >::View
 
- Public Types inherited from cms::alpakatools::OneToManyAssocBase< I, ONES, SIZE >
using Counter = uint32_t
 
using CountersOnly = OneToManyAssocBase< I, ONES, 0 >
 
using index_type = I
 

Public Member Functions

template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void count (const TAcc &acc, T t)
 
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void count (const TAcc &acc, T t, uint32_t nh)
 
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void fill (const TAcc &acc, T t, index_type j)
 
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void fill (const TAcc &acc, T t, index_type j, uint32_t nh)
 
- Public Member Functions inherited from cms::alpakatools::OneToManyAssocRandomAccess< I, NHISTS *NBINS+1, SIZE >
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE void finalize (TAcc &acc, Counter *ws=nullptr)
 
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE void finalize ()
 
- Public Member Functions inherited from cms::alpakatools::OneToManyAssocBase< I, ONES, SIZE >
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void add (const TAcc &acc, CountersOnly const &co)
 
constexpr index_type const * begin () const
 
constexpr index_type const * begin (uint32_t b) const
 
constexpr auto capacity () const
 
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void count (const TAcc &acc, I b)
 
constexpr index_type const * end () const
 
constexpr index_type const * end (uint32_t b) const
 
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void fill (const TAcc &acc, I b, index_type j)
 
ALPAKA_FN_HOST_ACC void initStorage (View view)
 
constexpr auto nOnes () const
 
constexpr auto size () const
 
constexpr auto size (uint32_t b) const
 
constexpr auto totOnes () const
 
ALPAKA_FN_HOST_ACC void zero ()
 

Static Public Member Functions

static constexpr UT bin (T t)
 
static constexpr auto histOff (uint32_t nh)
 
static constexpr uint32_t ilog2 (uint32_t v)
 
static constexpr uint32_t nbins ()
 
static constexpr uint32_t nbits ()
 
static constexpr int32_t nhists ()
 
static constexpr uint32_t sizeT ()
 
static constexpr uint32_t totbins ()
 
- Static Public Member Functions inherited from cms::alpakatools::OneToManyAssocRandomAccess< I, NHISTS *NBINS+1, SIZE >
static ALPAKA_FN_INLINE void launchFinalize (OneToManyAssocRandomAccess *h, TQueue &queue)
 
static ALPAKA_FN_INLINE void launchFinalize (View view, TQueue &queue)
 
- Static Public Member Functions inherited from cms::alpakatools::OneToManyAssocBase< I, ONES, SIZE >
template<typename TAcc >
ALPAKA_FN_ACC static ALPAKA_FN_INLINE uint32_t atomicDecrement (const TAcc &acc, Counter &x)
 
template<typename TAcc >
ALPAKA_FN_ACC static ALPAKA_FN_INLINE uint32_t atomicIncrement (const TAcc &acc, Counter &x)
 
static constexpr int32_t ctCapacity ()
 
static constexpr int32_t ctNOnes ()
 
template<typename TAcc , typename TQueue >
static ALPAKA_FN_INLINE void launchZero (OneToManyAssocBase *h, TQueue &queue)
 
template<typename TAcc , typename TQueue >
static ALPAKA_FN_INLINE void launchZero (View view, TQueue &queue)
 

Additional Inherited Members

- Public Attributes inherited from cms::alpakatools::OneToManyAssocBase< I, ONES, SIZE >
FlexiStorage< index_type, SIZE > content
 
FlexiStorage< Counter, ONES > off
 
int32_t psws
 

Detailed Description

template<typename T, uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
class cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >

Definition at line 129 of file HistoContainer.h.

Member Typedef Documentation

◆ Base

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
using cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::Base = OneToManyAssocRandomAccess<I, NHISTS * NBINS + 1, SIZE>

Definition at line 131 of file HistoContainer.h.

◆ Counter

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
using cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::Counter = typename Base::Counter

Definition at line 133 of file HistoContainer.h.

◆ index_type

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
using cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::index_type = typename Base::index_type

Definition at line 134 of file HistoContainer.h.

◆ UT

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
using cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::UT = typename std::make_unsigned<T>::type

Definition at line 135 of file HistoContainer.h.

◆ View

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
using cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::View = typename Base::View

Definition at line 132 of file HistoContainer.h.

Member Function Documentation

◆ bin()

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
static constexpr UT cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::bin ( T  t)
inlinestatic

◆ count() [1/2]

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::count ( const TAcc &  acc,
T  t 
)
inline

Definition at line 165 of file HistoContainer.h.

References ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::ALPAKA_ASSERT_ACC(), b, newFWLiteAna::bin, LaserClient_cfi::nbins, and submitPVValidationJobs::t.

165  {
166  uint32_t b = bin(t);
168  Base::atomicIncrement(acc, this->off[b]);
169  }
static constexpr uint32_t nbins()
FlexiStorage< Counter, ONES > off
static constexpr UT bin(T t)
double b
Definition: hdecay.h:120
ALPAKA_FN_ACC static ALPAKA_FN_INLINE uint32_t atomicIncrement(const TAcc &acc, Counter &x)

◆ count() [2/2]

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::count ( const TAcc &  acc,
T  t,
uint32_t  nh 
)
inline

Definition at line 181 of file HistoContainer.h.

References ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::ALPAKA_ASSERT_ACC(), b, newFWLiteAna::bin, LaserClient_cfi::nbins, cms::cuda::nh, and submitPVValidationJobs::t.

181  {
182  uint32_t b = bin(t);
184  b += histOff(nh);
186  Base::atomicIncrement(acc, this->off[b]);
187  }
static constexpr uint32_t nbins()
FlexiStorage< Counter, ONES > off
static constexpr UT bin(T t)
static constexpr uint32_t totbins()
uint32_t nh
static constexpr auto histOff(uint32_t nh)
double b
Definition: hdecay.h:120
ALPAKA_FN_ACC static ALPAKA_FN_INLINE uint32_t atomicIncrement(const TAcc &acc, Counter &x)

◆ fill() [1/2]

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::fill ( const TAcc &  acc,
T  t,
index_type  j 
)
inline

Definition at line 172 of file HistoContainer.h.

References ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::ALPAKA_ASSERT_ACC(), b, newFWLiteAna::bin, Skims_PA_cff::content, dqmiolumiharvest::j, LaserClient_cfi::nbins, submitPVValidationJobs::t, and w().

172  {
173  uint32_t b = bin(t);
175  auto w = Base::atomicDecrement(acc, this->off[b]);
176  ALPAKA_ASSERT_ACC(w > 0);
177  this->content[w - 1] = j;
178  }
T w() const
static constexpr uint32_t nbins()
FlexiStorage< Counter, ONES > off
static constexpr UT bin(T t)
double b
Definition: hdecay.h:120
FlexiStorage< index_type, SIZE > content
ALPAKA_FN_ACC static ALPAKA_FN_INLINE uint32_t atomicDecrement(const TAcc &acc, Counter &x)

◆ fill() [2/2]

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
template<typename TAcc >
ALPAKA_FN_ACC ALPAKA_FN_INLINE void cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::fill ( const TAcc &  acc,
T  t,
index_type  j,
uint32_t  nh 
)
inline

Definition at line 190 of file HistoContainer.h.

References ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::ALPAKA_ASSERT_ACC(), b, newFWLiteAna::bin, Skims_PA_cff::content, dqmiolumiharvest::j, LaserClient_cfi::nbins, cms::cuda::nh, submitPVValidationJobs::t, and w().

190  {
191  uint32_t b = bin(t);
193  b += histOff(nh);
195  auto w = Base::atomicDecrement(acc, this->off[b]);
196  ALPAKA_ASSERT_ACC(w > 0);
197  this->content[w - 1] = j;
198  }
T w() const
static constexpr uint32_t nbins()
FlexiStorage< Counter, ONES > off
static constexpr UT bin(T t)
static constexpr uint32_t totbins()
uint32_t nh
static constexpr auto histOff(uint32_t nh)
double b
Definition: hdecay.h:120
FlexiStorage< index_type, SIZE > content
ALPAKA_FN_ACC static ALPAKA_FN_INLINE uint32_t atomicDecrement(const TAcc &acc, Counter &x)

◆ histOff()

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
static constexpr auto cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::histOff ( uint32_t  nh)
inlinestatic

Definition at line 156 of file HistoContainer.h.

References NBINS, and cms::cuda::nh.

156 { return NBINS * nh; }
uint32_t nh
const int NBINS

◆ ilog2()

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
static constexpr uint32_t cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::ilog2 ( uint32_t  v)
inlinestatic

Definition at line 137 of file HistoContainer.h.

References b, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), mps_fire::i, alignCSCRings::s, and cms::cuda::v.

137  {
138  constexpr uint32_t b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
139  constexpr uint32_t s[] = {1, 2, 4, 8, 16};
140 
141  uint32_t r = 0; // result of log2(v) will go here
142  for (auto i = 4; i >= 0; i--)
143  if (v & b[i]) {
144  v >>= s[i];
145  r |= s[i];
146  }
147  return r;
148  }
uint32_t T const *__restrict__ v
double b
Definition: hdecay.h:120

◆ nbins()

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
static constexpr uint32_t cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::nbins ( )
inlinestatic

Definition at line 152 of file HistoContainer.h.

References NBINS.

152 { return NBINS; }
const int NBINS

◆ nbits()

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
static constexpr uint32_t cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::nbits ( )
inlinestatic

Definition at line 154 of file HistoContainer.h.

References trklet::ilog2(), and NBINS.

154 { return ilog2(NBINS - 1) + 1; }
static constexpr uint32_t ilog2(uint32_t v)
const int NBINS

◆ nhists()

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
static constexpr int32_t cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::nhists ( )
inlinestatic

Definition at line 151 of file HistoContainer.h.

151 { return NHISTS; }

◆ sizeT()

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
static constexpr uint32_t cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::sizeT ( )
inlinestatic

Definition at line 150 of file HistoContainer.h.

150 { return S; }

◆ totbins()

template<typename T , uint32_t NBINS, int32_t SIZE, uint32_t S = sizeof(T) * 8, typename I = uint32_t, uint32_t NHISTS = 1>
static constexpr uint32_t cms::alpakatools::HistoContainer< T, NBINS, SIZE, S, I, NHISTS >::totbins ( )
inlinestatic