CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes | Static Private Attributes
TrackingRecHit2DHeterogeneous< Traits > Class Template Reference

#include <TrackingRecHit2DHeterogeneous.h>

Public Types

using PhiBinner = TrackingRecHit2DSOAView::PhiBinner
 
template<typename T >
using unique_ptr = typename Traits::template unique_ptr< T >
 

Public Member Functions

void copyFromGPU (TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > const *input, cudaStream_t stream)
 
auto hitsLayerStart ()
 
auto hitsModuleStart () const
 
cms::cuda::host::unique_ptr< uint32_t[]> hitsModuleStartToHostAsync (cudaStream_t stream) const
 
auto iphi ()
 
cms::cuda::host::unique_ptr< float[]> localCoordToHostAsync (cudaStream_t stream) const
 
auto nHits () const
 
TrackingRecHit2DHeterogeneousoperator= (const TrackingRecHit2DHeterogeneous &)=delete
 
TrackingRecHit2DHeterogeneousoperator= (TrackingRecHit2DHeterogeneous &&)=default
 
auto phiBinner ()
 
auto phiBinnerStorage ()
 
 TrackingRecHit2DHeterogeneous ()=default
 
 TrackingRecHit2DHeterogeneous (const TrackingRecHit2DHeterogeneous &)=delete
 
 TrackingRecHit2DHeterogeneous (TrackingRecHit2DHeterogeneous &&)=default
 
 TrackingRecHit2DHeterogeneous (uint32_t nHits, pixelCPEforGPU::ParamsOnGPU const *cpeParams, uint32_t const *hitsModuleStart, cudaStream_t stream, TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > const *input=nullptr)
 
TrackingRecHit2DSOAViewview ()
 
TrackingRecHit2DSOAView const * view () const
 
 ~TrackingRecHit2DHeterogeneous ()=default
 

Private Attributes

unique_ptr< TrackingRecHit2DSOAView::AverageGeometrym_AverageGeometryStore
 
uint32_t * m_hitsLayerStart
 
uint32_t const * m_hitsModuleStart
 
int16_t * m_iphi
 
uint32_t m_nHits
 
PhiBinnerm_phiBinner
 
PhiBinner::index_typem_phiBinnerStorage
 
unique_ptr< TrackingRecHit2DSOAView::PhiBinnerm_PhiBinnerStore
 
unique_ptr< uint16_t[]> m_store16
 
unique_ptr< float[]> m_store32
 
unique_ptr< TrackingRecHit2DSOAViewm_view
 

Static Private Attributes

static constexpr uint32_t n16 = 4
 
static constexpr uint32_t n32 = 10
 

Detailed Description

template<typename Traits>
class TrackingRecHit2DHeterogeneous< Traits >

Definition at line 8 of file TrackingRecHit2DHeterogeneous.h.

Member Typedef Documentation

◆ PhiBinner

template<typename Traits>
using TrackingRecHit2DHeterogeneous< Traits >::PhiBinner = TrackingRecHit2DSOAView::PhiBinner

Definition at line 13 of file TrackingRecHit2DHeterogeneous.h.

◆ unique_ptr

template<typename Traits>
template<typename T >
using TrackingRecHit2DHeterogeneous< Traits >::unique_ptr = typename Traits::template unique_ptr<T>

Definition at line 11 of file TrackingRecHit2DHeterogeneous.h.

Constructor & Destructor Documentation

◆ TrackingRecHit2DHeterogeneous() [1/4]

template<typename Traits>
TrackingRecHit2DHeterogeneous< Traits >::TrackingRecHit2DHeterogeneous ( )
default

◆ TrackingRecHit2DHeterogeneous() [2/4]

template<typename Traits >
TrackingRecHit2DHeterogeneous< Traits >::TrackingRecHit2DHeterogeneous ( uint32_t  nHits,
pixelCPEforGPU::ParamsOnGPU const *  cpeParams,
uint32_t const *  hitsModuleStart,
cudaStream_t  stream,
TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > const *  input = nullptr 
)
explicit

Definition at line 81 of file TrackingRecHit2DHeterogeneous.h.

88  auto view = Traits::template make_host_unique<TrackingRecHit2DSOAView>(stream);
89 
90  view->m_nHits = nHits;
91  m_view = Traits::template make_unique<TrackingRecHit2DSOAView>(stream); // leave it on host and pass it by value?
92  m_AverageGeometryStore = Traits::template make_unique<TrackingRecHit2DSOAView::AverageGeometry>(stream);
94  view->m_cpeParams = cpeParams;
96 
97  // if empy do not bother
98  if (0 == nHits) {
101  } else {
102  m_view.reset(view.release()); // NOLINT: std::move() breaks CUDA version
103  }
104  return;
105  }
106 
107  // the single arrays are not 128 bit alligned...
108  // the hits are actually accessed in order only in building
109  // if ordering is relevant they may have to be stored phi-ordered by layer or so
110  // this will break 1to1 correspondence with cluster and module locality
111  // so unless proven VERY inefficient we keep it ordered as generated
112 
113  // host copy is "reduced" (to be reviewed at some point)
115  // it has to compile for ALL cases
117  } else {
118  assert(input == nullptr);
119  m_store16 = Traits::template make_unique<uint16_t[]>(nHits * n16, stream);
121  m_PhiBinnerStore = Traits::template make_unique<TrackingRecHit2DSOAView::PhiBinner>(stream);
122  }
123 
124  static_assert(sizeof(TrackingRecHit2DSOAView::hindex_type) == sizeof(float));
126 
127  auto get32 = [&](int i) { return m_store32.get() + i * nHits; };
128 
129  // copy all the pointers
132  reinterpret_cast<TrackingRecHit2DSOAView::PhiBinner::index_type*>(get32(9));
133 
134  view->m_xl = get32(0);
135  view->m_yl = get32(1);
136  view->m_xerr = get32(2);
137  view->m_yerr = get32(3);
138  view->m_chargeAndStatus = reinterpret_cast<uint32_t*>(get32(4));
139 
141  assert(input == nullptr);
142  view->m_xg = get32(5);
143  view->m_yg = get32(6);
144  view->m_zg = get32(7);
145  view->m_rg = get32(8);
146 
147  auto get16 = [&](int i) { return m_store16.get() + i * nHits; };
148  m_iphi = view->m_iphi = reinterpret_cast<int16_t*>(get16(1));
149 
150  view->m_xsize = reinterpret_cast<int16_t*>(get16(2));
151  view->m_ysize = reinterpret_cast<int16_t*>(get16(3));
152  view->m_detInd = get16(0);
153 
155  m_hitsLayerStart = view->m_hitsLayerStart = reinterpret_cast<uint32_t*>(get32(n32));
156  }
157 
158  // transfer view
161  } else {
162  m_view.reset(view.release()); // NOLINT: std::move() breaks CUDA version
163  }
164 }

References cms::cuda::assert(), cms::cuda::copyAsync(), TrackingRecHit2DHeterogeneous< Traits >::copyFromGPU(), TrackingRecHit2DHeterogeneous< Traits >::hitsModuleStart(), mps_fire::i, input, TrackingRecHit2DSOAView::m_averageGeometry, TrackingRecHit2DHeterogeneous< Traits >::m_AverageGeometryStore, TrackingRecHit2DSOAView::m_chargeAndStatus, TrackingRecHit2DSOAView::m_cpeParams, TrackingRecHit2DSOAView::m_detInd, TrackingRecHit2DHeterogeneous< Traits >::m_hitsLayerStart, TrackingRecHit2DSOAView::m_hitsLayerStart, TrackingRecHit2DSOAView::m_hitsModuleStart, TrackingRecHit2DHeterogeneous< Traits >::m_iphi, TrackingRecHit2DSOAView::m_iphi, TrackingRecHit2DSOAView::m_nHits, TrackingRecHit2DHeterogeneous< Traits >::m_phiBinner, TrackingRecHit2DSOAView::m_phiBinner, TrackingRecHit2DHeterogeneous< Traits >::m_phiBinnerStorage, TrackingRecHit2DSOAView::m_phiBinnerStorage, TrackingRecHit2DHeterogeneous< Traits >::m_PhiBinnerStore, TrackingRecHit2DSOAView::m_rg, TrackingRecHit2DHeterogeneous< Traits >::m_store16, TrackingRecHit2DHeterogeneous< Traits >::m_store32, TrackingRecHit2DHeterogeneous< Traits >::m_view, TrackingRecHit2DSOAView::m_xerr, TrackingRecHit2DSOAView::m_xg, TrackingRecHit2DSOAView::m_xl, TrackingRecHit2DSOAView::m_xsize, TrackingRecHit2DSOAView::m_yerr, TrackingRecHit2DSOAView::m_yg, TrackingRecHit2DSOAView::m_yl, TrackingRecHit2DSOAView::m_ysize, TrackingRecHit2DSOAView::m_zg, TrackingRecHit2DHeterogeneous< Traits >::n16, TrackingRecHit2DHeterogeneous< Traits >::n32, TrackingRecHit2DHeterogeneous< Traits >::nHits(), phase1PixelTopology::numberOfLayers, cms::cuda::stream, svgfig::template(), relativeConstraints::value, and TrackingRecHit2DHeterogeneous< Traits >::view().

◆ ~TrackingRecHit2DHeterogeneous()

template<typename Traits>
TrackingRecHit2DHeterogeneous< Traits >::~TrackingRecHit2DHeterogeneous ( )
default

◆ TrackingRecHit2DHeterogeneous() [3/4]

template<typename Traits>
TrackingRecHit2DHeterogeneous< Traits >::TrackingRecHit2DHeterogeneous ( const TrackingRecHit2DHeterogeneous< Traits > &  )
delete

◆ TrackingRecHit2DHeterogeneous() [4/4]

template<typename Traits>
TrackingRecHit2DHeterogeneous< Traits >::TrackingRecHit2DHeterogeneous ( TrackingRecHit2DHeterogeneous< Traits > &&  )
default

Member Function Documentation

◆ copyFromGPU()

template<typename Traits>
void TrackingRecHit2DHeterogeneous< Traits >::copyFromGPU ( TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > const *  input,
cudaStream_t  stream 
)

◆ hitsLayerStart()

template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::hitsLayerStart ( )
inline

◆ hitsModuleStart()

template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::hitsModuleStart ( ) const
inline

◆ hitsModuleStartToHostAsync()

cms::cuda::host::unique_ptr< uint32_t[]> TrackingRecHit2DGPU::hitsModuleStartToHostAsync ( cudaStream_t  stream) const

Definition at line 15 of file TrackingRecHit2DHeterogeneous.cc.

15  {
16  auto ret = cms::cuda::make_host_unique<uint32_t[]>(gpuClustering::maxNumModules + 1, stream);
17  cudaCheck(cudaMemcpyAsync(
18  ret.get(), m_hitsModuleStart, sizeof(uint32_t) * (gpuClustering::maxNumModules + 1), cudaMemcpyDefault, stream));
19  return ret;
20 }

References cudaCheck, TrackingRecHit2DHeterogeneous< Traits >::m_hitsModuleStart, gpuClustering::maxNumModules, runTheMatrix::ret, and cms::cuda::stream.

◆ iphi()

template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::iphi ( )
inline

Definition at line 40 of file TrackingRecHit2DHeterogeneous.h.

40 { return m_iphi; }

References TrackingRecHit2DHeterogeneous< Traits >::m_iphi.

◆ localCoordToHostAsync()

cms::cuda::host::unique_ptr< float[]> TrackingRecHit2DGPU::localCoordToHostAsync ( cudaStream_t  stream) const

◆ nHits()

template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::nHits ( ) const
inline

◆ operator=() [1/2]

template<typename Traits>
TrackingRecHit2DHeterogeneous& TrackingRecHit2DHeterogeneous< Traits >::operator= ( const TrackingRecHit2DHeterogeneous< Traits > &  )
delete

◆ operator=() [2/2]

template<typename Traits>
TrackingRecHit2DHeterogeneous& TrackingRecHit2DHeterogeneous< Traits >::operator= ( TrackingRecHit2DHeterogeneous< Traits > &&  )
default

◆ phiBinner()

template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::phiBinner ( )
inline

◆ phiBinnerStorage()

template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::phiBinnerStorage ( )
inline

◆ view() [1/2]

template<typename Traits>
TrackingRecHit2DSOAView* TrackingRecHit2DHeterogeneous< Traits >::view ( )
inline

◆ view() [2/2]

template<typename Traits>
TrackingRecHit2DSOAView const* TrackingRecHit2DHeterogeneous< Traits >::view ( ) const
inline

Definition at line 32 of file TrackingRecHit2DHeterogeneous.h.

32 { return m_view.get(); }

References TrackingRecHit2DHeterogeneous< Traits >::m_view.

Member Data Documentation

◆ m_AverageGeometryStore

template<typename Traits>
unique_ptr<TrackingRecHit2DSOAView::AverageGeometry> TrackingRecHit2DHeterogeneous< Traits >::m_AverageGeometryStore
private

◆ m_hitsLayerStart

template<typename Traits>
uint32_t* TrackingRecHit2DHeterogeneous< Traits >::m_hitsLayerStart
private

◆ m_hitsModuleStart

template<typename Traits>
uint32_t const* TrackingRecHit2DHeterogeneous< Traits >::m_hitsModuleStart
private

◆ m_iphi

template<typename Traits>
int16_t* TrackingRecHit2DHeterogeneous< Traits >::m_iphi
private

◆ m_nHits

template<typename Traits>
uint32_t TrackingRecHit2DHeterogeneous< Traits >::m_nHits
private

◆ m_phiBinner

template<typename Traits>
PhiBinner* TrackingRecHit2DHeterogeneous< Traits >::m_phiBinner
private

◆ m_phiBinnerStorage

template<typename Traits>
PhiBinner::index_type* TrackingRecHit2DHeterogeneous< Traits >::m_phiBinnerStorage
private

◆ m_PhiBinnerStore

template<typename Traits>
unique_ptr<TrackingRecHit2DSOAView::PhiBinner> TrackingRecHit2DHeterogeneous< Traits >::m_PhiBinnerStore
private

◆ m_store16

template<typename Traits>
unique_ptr<uint16_t[]> TrackingRecHit2DHeterogeneous< Traits >::m_store16
private

◆ m_store32

template<typename Traits>
unique_ptr<float[]> TrackingRecHit2DHeterogeneous< Traits >::m_store32
private

◆ m_view

template<typename Traits>
unique_ptr<TrackingRecHit2DSOAView> TrackingRecHit2DHeterogeneous< Traits >::m_view
private

◆ n16

template<typename Traits>
constexpr uint32_t TrackingRecHit2DHeterogeneous< Traits >::n16 = 4
staticconstexprprivate

◆ n32

template<typename Traits>
constexpr uint32_t TrackingRecHit2DHeterogeneous< Traits >::n32 = 10
staticconstexprprivate
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
TrackingRecHit2DSOAView::m_iphi
int16_t * m_iphi
Definition: TrackingRecHit2DSOAView.h:96
TrackingRecHit2DHeterogeneous::view
TrackingRecHit2DSOAView * view()
Definition: TrackingRecHit2DHeterogeneous.h:31
TrackingRecHit2DHeterogeneous::m_iphi
int16_t * m_iphi
Definition: TrackingRecHit2DHeterogeneous.h:70
TrackingRecHit2DSOAView::m_yg
float * m_yg
Definition: TrackingRecHit2DSOAView.h:95
TrackingRecHit2DSOAView::m_hitsLayerStart
uint32_t * m_hitsLayerStart
Definition: TrackingRecHit2DSOAView.h:111
TrackingRecHit2DSOAView::m_xerr
float * m_xerr
Definition: TrackingRecHit2DSOAView.h:92
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
TrackingRecHit2DHeterogeneous::m_view
unique_ptr< TrackingRecHit2DSOAView > m_view
Definition: TrackingRecHit2DHeterogeneous.h:60
phase1PixelTopology::numberOfLayers
constexpr uint32_t numberOfLayers
Definition: phase1PixelTopology.h:25
TrackingRecHit2DSOAView::m_xl
float * m_xl
Definition: TrackingRecHit2DSOAView.h:91
cms::cuda::stream
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: HistoContainer.h:51
TrackingRecHit2DSOAView::hindex_type
uint32_t hindex_type
Definition: TrackingRecHit2DSOAView.h:21
cms::cuda::assert
assert(be >=bs)
TrackingRecHit2DSOAView::m_nHits
uint32_t m_nHits
Definition: TrackingRecHit2DSOAView.h:116
TrackingRecHit2DHeterogeneous::n16
static constexpr uint32_t n16
Definition: TrackingRecHit2DHeterogeneous.h:50
TrackingRecHit2DHeterogeneous::m_phiBinnerStorage
PhiBinner::index_type * m_phiBinnerStorage
Definition: TrackingRecHit2DHeterogeneous.h:68
cms::cuda::HistoContainer::index_type
typename Base::index_type index_type
Definition: HistoContainer.h:106
TrackingRecHit2DHeterogeneous::copyFromGPU
void copyFromGPU(TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > const *input, cudaStream_t stream)
TrackingRecHit2DSOAView::m_ysize
int16_t * m_ysize
Definition: TrackingRecHit2DSOAView.h:102
TrackingRecHit2DHeterogeneous::m_hitsModuleStart
uint32_t const * m_hitsModuleStart
Definition: TrackingRecHit2DHeterogeneous.h:64
gpuClustering::maxNumModules
constexpr uint16_t maxNumModules
Definition: gpuClusteringConstants.h:18
TrackingRecHit2DHeterogeneous::m_phiBinner
PhiBinner * m_phiBinner
Definition: TrackingRecHit2DHeterogeneous.h:67
TrackingRecHit2DHeterogeneous::m_store16
unique_ptr< uint16_t[]> m_store16
Definition: TrackingRecHit2DHeterogeneous.h:52
TrackingRecHit2DHeterogeneous::n32
static constexpr uint32_t n32
Definition: TrackingRecHit2DHeterogeneous.h:51
TrackingRecHit2DSOAView::m_averageGeometry
AverageGeometry * m_averageGeometry
Definition: TrackingRecHit2DSOAView.h:107
TrackingRecHit2DHeterogeneous::hitsModuleStart
auto hitsModuleStart() const
Definition: TrackingRecHit2DHeterogeneous.h:36
TrackingRecHit2DSOAView::m_cpeParams
pixelCPEforGPU::ParamsOnGPU const * m_cpeParams
Definition: TrackingRecHit2DSOAView.h:108
TrackingRecHit2DSOAView::m_yerr
float * m_yerr
Definition: TrackingRecHit2DSOAView.h:92
TrackingRecHit2DHeterogeneous::nHits
auto nHits() const
Definition: TrackingRecHit2DHeterogeneous.h:34
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
TrackingRecHit2DHeterogeneous::m_AverageGeometryStore
unique_ptr< TrackingRecHit2DSOAView::AverageGeometry > m_AverageGeometryStore
Definition: TrackingRecHit2DHeterogeneous.h:58
TrackingRecHit2DSOAView::m_phiBinner
PhiBinner * m_phiBinner
Definition: TrackingRecHit2DSOAView.h:113
cudaCheck
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
TrackingRecHit2DHeterogeneous::m_store32
unique_ptr< float[]> m_store32
Definition: TrackingRecHit2DHeterogeneous.h:55
TrackingRecHit2DSOAView::m_chargeAndStatus
m_chargeAndStatus[i]
Definition: TrackingRecHit2DSOAView.h:59
relativeConstraints.value
value
Definition: relativeConstraints.py:53
TrackingRecHit2DSOAView::m_yl
float * m_yl
Definition: TrackingRecHit2DSOAView.h:91
TrackingRecHit2DSOAView::m_phiBinnerStorage
PhiBinner::index_type * m_phiBinnerStorage
Definition: TrackingRecHit2DSOAView.h:114
TrackingRecHit2DHeterogeneous::m_PhiBinnerStore
unique_ptr< TrackingRecHit2DSOAView::PhiBinner > m_PhiBinnerStore
Definition: TrackingRecHit2DHeterogeneous.h:57
TrackingRecHit2DSOAView::m_xg
float * m_xg
Definition: TrackingRecHit2DSOAView.h:95
TrackingRecHit2DSOAView::m_xsize
int16_t * m_xsize
Definition: TrackingRecHit2DSOAView.h:101
TrackingRecHit2DSOAView::m_detInd
uint16_t * m_detInd
Definition: TrackingRecHit2DSOAView.h:103
TrackingRecHit2DHeterogeneous::m_hitsLayerStart
uint32_t * m_hitsLayerStart
Definition: TrackingRecHit2DHeterogeneous.h:69
TrackingRecHit2DHeterogeneous::m_nHits
uint32_t m_nHits
Definition: TrackingRecHit2DHeterogeneous.h:62
TrackingRecHit2DSOAView::m_hitsModuleStart
uint32_t const * m_hitsModuleStart
Definition: TrackingRecHit2DSOAView.h:109
TrackingRecHit2DSOAView::m_rg
float * m_rg
Definition: TrackingRecHit2DSOAView.h:95
TrackingRecHit2DSOAView::m_zg
float * m_zg
Definition: TrackingRecHit2DSOAView.h:95
cms::cuda::copyAsync
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20