CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
TrackingRecHitSoADevice< TrackerTraits > Class Template Reference

#include <TrackingRecHitSoADevice.h>

Inheritance diagram for TrackingRecHitSoADevice< TrackerTraits >:
cms::cuda::PortableDeviceCollection< TrackingRecHitLayout< TrackerTraits > >

Public Types

using AverageGeometry = typename hitSoA::AverageGeometry
 
using hitSoA = TrackingRecHitSoA< TrackerTraits >
 
using ParamsOnGPU = typename hitSoA::ParamsOnGPU
 
- Public Types inherited from cms::cuda::PortableDeviceCollection< TrackingRecHitLayout< TrackerTraits > >
using Buffer = cms::cuda::device::unique_ptr< std::byte[]>
 
using ConstView = typename Layout::ConstView
 
using Layout = TrackingRecHitLayout< TrackerTraits >
 
using View = typename Layout::View
 

Public Member Functions

cms::cuda::host::unique_ptr< uint32_t[]> hitsModuleStartToHostAsync (cudaStream_t stream) const
 
cms::cuda::host::unique_ptr< float[]> localCoordToHostAsync (cudaStream_t stream) const
 
uint32_t nHits () const
 
uint32_t offsetBPIX2 () const
 
 TrackingRecHitSoADevice ()=default
 
 TrackingRecHitSoADevice (uint32_t nHits, int32_t offsetBPIX2, ParamsOnGPU const *cpeParams, uint32_t const *hitsModuleStart, cudaStream_t stream)
 
- Public Member Functions inherited from cms::cuda::PortableDeviceCollection< TrackingRecHitLayout< TrackerTraits > >
Bufferbuffer ()
 
Buffer const & buffer () const
 
size_t bufferSize () const
 
Buffer const & const_buffer () const
 
ConstView const & const_view () const
 
Viewoperator* ()
 
ConstView const & operator* () const
 
Viewoperator-> ()
 
ConstView const * operator-> () const
 
PortableDeviceCollectionoperator= (PortableDeviceCollection const &)=delete
 
PortableDeviceCollectionoperator= (PortableDeviceCollection &&)=default
 
 PortableDeviceCollection ()=default
 
 PortableDeviceCollection (int32_t elements, cudaStream_t stream)
 
 PortableDeviceCollection (PortableDeviceCollection const &)=delete
 
 PortableDeviceCollection (PortableDeviceCollection &&)=default
 
Viewview ()
 
ConstView const & view () const
 
 ~PortableDeviceCollection ()=default
 

Private Attributes

uint32_t offsetBPIX2_ = 0
 

Detailed Description

template<typename TrackerTraits>
class TrackingRecHitSoADevice< TrackerTraits >

Definition at line 12 of file TrackingRecHitSoADevice.h.

Member Typedef Documentation

◆ AverageGeometry

template<typename TrackerTraits>
using TrackingRecHitSoADevice< TrackerTraits >::AverageGeometry = typename hitSoA::AverageGeometry

Definition at line 23 of file TrackingRecHitSoADevice.h.

◆ hitSoA

template<typename TrackerTraits>
using TrackingRecHitSoADevice< TrackerTraits >::hitSoA = TrackingRecHitSoA<TrackerTraits>

Definition at line 14 of file TrackingRecHitSoADevice.h.

◆ ParamsOnGPU

template<typename TrackerTraits>
using TrackingRecHitSoADevice< TrackerTraits >::ParamsOnGPU = typename hitSoA::ParamsOnGPU

Definition at line 24 of file TrackingRecHitSoADevice.h.

Constructor & Destructor Documentation

◆ TrackingRecHitSoADevice() [1/2]

template<typename TrackerTraits>
TrackingRecHitSoADevice< TrackerTraits >::TrackingRecHitSoADevice ( )
default

◆ TrackingRecHitSoADevice() [2/2]

template<typename TrackerTraits>
TrackingRecHitSoADevice< TrackerTraits >::TrackingRecHitSoADevice ( uint32_t  nHits,
int32_t  offsetBPIX2,
ParamsOnGPU const *  cpeParams,
uint32_t const *  hitsModuleStart,
cudaStream_t  stream 
)
inlineexplicit

Definition at line 27 of file TrackingRecHitSoADevice.h.

References cudaCheck, data, TrackingRecHitSoADevice< TrackerTraits >::nHits(), phase1PixelTopology::numberOfModules, TrackingRecHitSoADevice< TrackerTraits >::offsetBPIX2(), cms::cuda::stream, and cms::cuda::PortableDeviceCollection< TrackingRecHitLayout< TrackerTraits > >::view().

34  cudaCheck(cudaMemcpyAsync(&(view().nHits()), &nHits, sizeof(uint32_t), cudaMemcpyDefault, stream));
35  // hitsModuleStart is on Device
36  cudaCheck(cudaMemcpyAsync(view().hitsModuleStart().data(),
37  hitsModuleStart,
38  sizeof(uint32_t) * int(TrackerTraits::numberOfModules + 1),
39  cudaMemcpyDefault,
40  stream));
41  cudaCheck(cudaMemcpyAsync(&(view().offsetBPIX2()), &offsetBPIX2, sizeof(int32_t), cudaMemcpyDefault, stream));
42 
43  // cpeParams argument is a pointer to device memory, copy
44  // its contents into the Layout.
45  cudaCheck(cudaMemcpyAsync(&(view().cpeParams()), cpeParams, int(sizeof(ParamsOnGPU)), cudaMemcpyDefault, stream));
46  }
typename hitSoA::ParamsOnGPU ParamsOnGPU
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
constexpr uint16_t numberOfModules
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69

Member Function Documentation

◆ hitsModuleStartToHostAsync()

template<typename TrackerTraits>
cms::cuda::host::unique_ptr<uint32_t[]> TrackingRecHitSoADevice< TrackerTraits >::hitsModuleStartToHostAsync ( cudaStream_t  stream) const
inline

Definition at line 59 of file TrackingRecHitSoADevice.h.

References cudaCheck, phase1PixelTopology::numberOfModules, runTheMatrix::ret, cms::cuda::stream, and cms::cuda::PortableDeviceCollection< TrackingRecHitLayout< TrackerTraits > >::view().

59  {
60  auto ret = cms::cuda::make_host_unique<uint32_t[]>(TrackerTraits::numberOfModules + 1, stream);
61  cudaCheck(cudaMemcpyAsync(ret.get(),
62  view().hitsModuleStart().data(),
63  sizeof(uint32_t) * (TrackerTraits::numberOfModules + 1),
64  cudaMemcpyDefault,
65  stream));
66  return ret;
67  }
ret
prodAgent to be discontinued
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
constexpr uint16_t numberOfModules
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69

◆ localCoordToHostAsync()

template<typename TrackerTraits>
cms::cuda::host::unique_ptr<float[]> TrackingRecHitSoADevice< TrackerTraits >::localCoordToHostAsync ( cudaStream_t  stream) const
inline

Definition at line 48 of file TrackingRecHitSoADevice.h.

References cudaCheck, nano_mu_digi_cff::float, TrackingRecHitSoADevice< TrackerTraits >::nHits(), runTheMatrix::ret, cms::cuda::stream, and cms::cuda::PortableDeviceCollection< TrackingRecHitLayout< TrackerTraits > >::view().

48  {
49  auto ret = cms::cuda::make_host_unique<float[]>(4 * nHits(), stream);
50  size_t rowSize = sizeof(float) * nHits();
51 
52  size_t srcPitch = ptrdiff_t(view().yLocal()) - ptrdiff_t(view().xLocal());
53  cudaCheck(
54  cudaMemcpy2DAsync(ret.get(), rowSize, view().xLocal(), srcPitch, rowSize, 4, cudaMemcpyDeviceToHost, stream));
55 
56  return ret;
57  } //move to utilities
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

◆ nHits()

template<typename TrackerTraits>
uint32_t TrackingRecHitSoADevice< TrackerTraits >::nHits ( ) const
inline

◆ offsetBPIX2()

template<typename TrackerTraits>
uint32_t TrackingRecHitSoADevice< TrackerTraits >::offsetBPIX2 ( ) const
inline

Definition at line 70 of file TrackingRecHitSoADevice.h.

References TrackingRecHitSoADevice< TrackerTraits >::offsetBPIX2_.

Referenced by CAHitNtupletGeneratorOnGPU< TrackerTraits >::makeTuplesAsync(), and TrackingRecHitSoADevice< TrackerTraits >::TrackingRecHitSoADevice().

70  {
71  return offsetBPIX2_;
72  } //offsetBPIX2 is used on host functions so is useful to have it also stored in the class and not only in the layout

Member Data Documentation

◆ offsetBPIX2_

template<typename TrackerTraits>
uint32_t TrackingRecHitSoADevice< TrackerTraits >::offsetBPIX2_ = 0
private