CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
auto nMaxModules () const
 
auto offsetBPIX2 () const
 
TrackingRecHit2DHeterogeneousoperator= (const TrackingRecHit2DHeterogeneous &)=delete
 
TrackingRecHit2DHeterogeneousoperator= (TrackingRecHit2DHeterogeneous &&)=default
 
auto phiBinner ()
 
auto phiBinnerStorage ()
 
 TrackingRecHit2DHeterogeneous ()=default
 
 TrackingRecHit2DHeterogeneous (uint32_t nHits, bool isPhase2, int32_t offsetBPIX2, pixelCPEforGPU::ParamsOnGPU const *cpeParams, uint32_t const *hitsModuleStart, cudaStream_t stream, TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > const *input=nullptr)
 
 TrackingRecHit2DHeterogeneous (const TrackingRecHit2DHeterogeneous &)=delete
 
 TrackingRecHit2DHeterogeneous (TrackingRecHit2DHeterogeneous &&)=default
 
TrackingRecHit2DSOAViewview ()
 
TrackingRecHit2DSOAView const * view () const
 
 ~TrackingRecHit2DHeterogeneous ()=default
 

Private Attributes

unique_ptr
< TrackingRecHit2DSOAView::AverageGeometry
m_AverageGeometryStore
 
uint32_t * m_hitsLayerStart
 
uint32_t const * m_hitsModuleStart
 
int16_t * m_iphi
 
uint32_t m_nHits
 
uint32_t m_nMaxModules
 
int32_t m_offsetBPIX2
 
PhiBinnerm_phiBinner
 
PhiBinner::index_typem_phiBinnerStorage
 
unique_ptr
< TrackingRecHit2DSOAView::PhiBinner
m_PhiBinnerStore
 
unique_ptr< uint16_t[]> m_store16
 
unique_ptr< float[]> m_store32
 
unique_ptr
< TrackingRecHit2DSOAView
m_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 9 of file TrackingRecHit2DHeterogeneous.h.

Member Typedef Documentation

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

Definition at line 14 of file TrackingRecHit2DHeterogeneous.h.

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

Definition at line 12 of file TrackingRecHit2DHeterogeneous.h.

Constructor & Destructor Documentation

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

Definition at line 88 of file TrackingRecHit2DHeterogeneous.h.

References cms::cuda::assert(), cms::cuda::copyAsync(), TrackingRecHit2DHeterogeneous< Traits >::copyFromGPU(), TrackingRecHit2DHeterogeneous< Traits >::hitsModuleStart(), mps_fire::i, 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_nMaxModules, TrackingRecHit2DSOAView::m_nMaxModules, 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, phase2PixelTopology::numberOfLayers, phase1PixelTopology::numberOfModules, phase2PixelTopology::numberOfModules, cms::cuda::stream, svgfig::template(), relativeConstraints::value, and TrackingRecHit2DHeterogeneous< Traits >::view().

97  auto view = Traits::template make_host_unique<TrackingRecHit2DSOAView>(stream);
98 
100 
101  view->m_nHits = nHits;
103  m_view = Traits::template make_unique<TrackingRecHit2DSOAView>(stream); // leave it on host and pass it by value?
104  m_AverageGeometryStore = Traits::template make_unique<TrackingRecHit2DSOAView::AverageGeometry>(stream);
105  view->m_averageGeometry = m_AverageGeometryStore.get();
106  view->m_cpeParams = cpeParams;
108 
109  // if empy do not bother
110  if (0 == nHits) {
113  } else {
114  m_view.reset(view.release()); // NOLINT: std::move() breaks CUDA version
115  }
116  return;
117  }
118 
119  // the single arrays are not 128 bit alligned...
120  // the hits are actually accessed in order only in building
121  // if ordering is relevant they may have to be stored phi-ordered by layer or so
122  // this will break 1to1 correspondence with cluster and module locality
123  // so unless proven VERY inefficient we keep it ordered as generated
124 
125  // host copy is "reduced" (to be reviewed at some point)
127  // it has to compile for ALL cases
128  copyFromGPU(input, stream);
129  } else {
130  assert(input == nullptr);
131 
133 
134  m_store16 = Traits::template make_unique<uint16_t[]>(nHits * n16, stream);
135  m_store32 = Traits::template make_unique<float[]>(nHits * n32 + nL + 1, stream);
136  m_PhiBinnerStore = Traits::template make_unique<TrackingRecHit2DSOAView::PhiBinner>(stream);
137  }
138 
139  static_assert(sizeof(TrackingRecHit2DSOAView::hindex_type) == sizeof(float));
141 
142  auto get32 = [&](int i) { return m_store32.get() + i * nHits; };
143 
144  // copy all the pointers
147  reinterpret_cast<TrackingRecHit2DSOAView::PhiBinner::index_type*>(get32(9));
148 
149  view->m_xl = get32(0);
150  view->m_yl = get32(1);
151  view->m_xerr = get32(2);
152  view->m_yerr = get32(3);
153  view->m_chargeAndStatus = reinterpret_cast<uint32_t*>(get32(4));
154 
156  assert(input == nullptr);
157  view->m_xg = get32(5);
158  view->m_yg = get32(6);
159  view->m_zg = get32(7);
160  view->m_rg = get32(8);
161 
162  auto get16 = [&](int i) { return m_store16.get() + i * nHits; };
163  m_iphi = view->m_iphi = reinterpret_cast<int16_t*>(get16(1));
164 
165  view->m_xsize = reinterpret_cast<int16_t*>(get16(2));
166  view->m_ysize = reinterpret_cast<int16_t*>(get16(3));
167  view->m_detInd = get16(0);
168 
170  m_hitsLayerStart = view->m_hitsLayerStart = reinterpret_cast<uint32_t*>(get32(n32));
171  }
172 
173  // transfer view
176  } else {
177  m_view.reset(view.release()); // NOLINT: std::move() breaks CUDA version
178  }
179 }
constexpr uint32_t numberOfLayers
void copyFromGPU(TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > const *input, cudaStream_t stream)
unique_ptr< TrackingRecHit2DSOAView > m_view
constexpr uint32_t numberOfModules
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
assert(be >=bs)
typename Base::index_type index_type
unique_ptr< TrackingRecHit2DSOAView::AverageGeometry > m_AverageGeometryStore
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
PhiBinner::index_type * m_phiBinnerStorage
constexpr uint32_t numberOfModules
constexpr uint8_t numberOfLayers
pixelCPEforGPU::ParamsOnGPU const * m_cpeParams
def template
Definition: svgfig.py:521
unique_ptr< TrackingRecHit2DSOAView::PhiBinner > m_PhiBinnerStore
template<typename Traits>
TrackingRecHit2DHeterogeneous< Traits >::~TrackingRecHit2DHeterogeneous ( )
default
template<typename Traits>
TrackingRecHit2DHeterogeneous< Traits >::TrackingRecHit2DHeterogeneous ( const TrackingRecHit2DHeterogeneous< Traits > &  )
delete
template<typename Traits>
TrackingRecHit2DHeterogeneous< Traits >::TrackingRecHit2DHeterogeneous ( TrackingRecHit2DHeterogeneous< Traits > &&  )
default

Member Function Documentation

template<typename Traits>
void TrackingRecHit2DHeterogeneous< Traits >::copyFromGPU ( TrackingRecHit2DHeterogeneous< cms::cudacompat::GPUTraits > const *  input,
cudaStream_t  stream 
)
template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::hitsLayerStart ( )
inline
template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::hitsModuleStart ( ) const
inline
cms::cuda::host::unique_ptr< uint32_t[]> TrackingRecHit2DGPU::hitsModuleStartToHostAsync ( cudaStream_t  stream) const

Definition at line 15 of file TrackingRecHit2DHeterogeneous.cc.

References cudaCheck, TrackingRecHit2DHeterogeneous< Traits >::m_hitsModuleStart, TrackingRecHit2DHeterogeneous< Traits >::nMaxModules(), runTheMatrix::ret, and cms::cuda::stream.

15  {
16  auto ret = cms::cuda::make_host_unique<uint32_t[]>(nMaxModules() + 1, stream);
17  cudaCheck(
18  cudaMemcpyAsync(ret.get(), m_hitsModuleStart, sizeof(uint32_t) * (nMaxModules() + 1), cudaMemcpyDefault, stream));
19  return ret;
20 }
tuple ret
prodAgent to be discontinued
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::iphi ( )
inline
cms::cuda::host::unique_ptr< float[]> TrackingRecHit2DGPU::localCoordToHostAsync ( cudaStream_t  stream) const

Definition at line 8 of file TrackingRecHit2DHeterogeneous.cc.

References cms::cuda::copyAsync(), TrackingRecHit2DHeterogeneous< Traits >::m_store32, TrackingRecHit2DHeterogeneous< Traits >::nHits(), runTheMatrix::ret, and cms::cuda::stream.

8  {
9  auto ret = cms::cuda::make_host_unique<float[]>(5 * nHits(), stream);
11  return ret;
12 }
tuple ret
prodAgent to be discontinued
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::nHits ( ) const
inline
template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::nMaxModules ( ) const
inline
template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::offsetBPIX2 ( ) const
inline
template<typename Traits>
TrackingRecHit2DHeterogeneous& TrackingRecHit2DHeterogeneous< Traits >::operator= ( const TrackingRecHit2DHeterogeneous< Traits > &  )
delete
template<typename Traits>
TrackingRecHit2DHeterogeneous& TrackingRecHit2DHeterogeneous< Traits >::operator= ( TrackingRecHit2DHeterogeneous< Traits > &&  )
default
template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::phiBinner ( )
inline
template<typename Traits>
auto TrackingRecHit2DHeterogeneous< Traits >::phiBinnerStorage ( )
inline
template<typename Traits>
TrackingRecHit2DSOAView* TrackingRecHit2DHeterogeneous< Traits >::view ( )
inline
template<typename Traits>
TrackingRecHit2DSOAView const* TrackingRecHit2DHeterogeneous< Traits >::view ( ) const
inline

Definition at line 35 of file TrackingRecHit2DHeterogeneous.h.

References TrackingRecHit2DHeterogeneous< Traits >::m_view.

35 { return m_view.get(); }
unique_ptr< TrackingRecHit2DSOAView > m_view

Member Data Documentation

template<typename Traits>
unique_ptr<TrackingRecHit2DSOAView::AverageGeometry> TrackingRecHit2DHeterogeneous< Traits >::m_AverageGeometryStore
private
template<typename Traits>
uint32_t* TrackingRecHit2DHeterogeneous< Traits >::m_hitsLayerStart
private
template<typename Traits>
uint32_t const* TrackingRecHit2DHeterogeneous< Traits >::m_hitsModuleStart
private
template<typename Traits>
int16_t* TrackingRecHit2DHeterogeneous< Traits >::m_iphi
private
template<typename Traits>
uint32_t TrackingRecHit2DHeterogeneous< Traits >::m_nHits
private
template<typename Traits>
uint32_t TrackingRecHit2DHeterogeneous< Traits >::m_nMaxModules
private
template<typename Traits>
int32_t TrackingRecHit2DHeterogeneous< Traits >::m_offsetBPIX2
private
template<typename Traits>
PhiBinner* TrackingRecHit2DHeterogeneous< Traits >::m_phiBinner
private
template<typename Traits>
PhiBinner::index_type* TrackingRecHit2DHeterogeneous< Traits >::m_phiBinnerStorage
private
template<typename Traits>
unique_ptr<TrackingRecHit2DSOAView::PhiBinner> TrackingRecHit2DHeterogeneous< Traits >::m_PhiBinnerStore
private
template<typename Traits>
unique_ptr<uint16_t[]> TrackingRecHit2DHeterogeneous< Traits >::m_store16
private
template<typename Traits>
unique_ptr<float[]> TrackingRecHit2DHeterogeneous< Traits >::m_store32
private
template<typename Traits>
unique_ptr<TrackingRecHit2DSOAView> TrackingRecHit2DHeterogeneous< Traits >::m_view
private
template<typename Traits>
constexpr uint32_t TrackingRecHit2DHeterogeneous< Traits >::n16 = 4
staticprivate
template<typename Traits>
constexpr uint32_t TrackingRecHit2DHeterogeneous< Traits >::n32 = 10
staticprivate