CMS 3D CMS Logo

SiPixelClustersCUDA.h
Go to the documentation of this file.
1 #ifndef CUDADataFormats_SiPixelCluster_interface_SiPixelClustersCUDA_h
2 #define CUDADataFormats_SiPixelCluster_interface_SiPixelClustersCUDA_h
3 
7 
8 #include <cuda_runtime.h>
9 
11 public:
12  SiPixelClustersCUDA() = default;
13  explicit SiPixelClustersCUDA(size_t maxModules, cudaStream_t stream);
14  ~SiPixelClustersCUDA() = default;
15 
16  SiPixelClustersCUDA(const SiPixelClustersCUDA &) = delete;
20 
22 
23  uint32_t nClusters() const { return nClusters_h; }
24 
25  uint32_t *moduleStart() { return moduleStart_d.get(); }
26  uint32_t *clusInModule() { return clusInModule_d.get(); }
27  uint32_t *moduleId() { return moduleId_d.get(); }
28  uint32_t *clusModuleStart() { return clusModuleStart_d.get(); }
29 
30  uint32_t const *moduleStart() const { return moduleStart_d.get(); }
31  uint32_t const *clusInModule() const { return clusInModule_d.get(); }
32  uint32_t const *moduleId() const { return moduleId_d.get(); }
33  uint32_t const *clusModuleStart() const { return clusModuleStart_d.get(); }
34 
36  public:
37  __device__ __forceinline__ uint32_t moduleStart(int i) const { return __ldg(moduleStart_ + i); }
38  __device__ __forceinline__ uint32_t clusInModule(int i) const { return __ldg(clusInModule_ + i); }
39  __device__ __forceinline__ uint32_t moduleId(int i) const { return __ldg(moduleId_ + i); }
40  __device__ __forceinline__ uint32_t clusModuleStart(int i) const { return __ldg(clusModuleStart_ + i); }
41 
42  uint32_t const *moduleStart_;
43  uint32_t const *clusInModule_;
44  uint32_t const *moduleId_;
45  uint32_t const *clusModuleStart_;
46  };
47 
48  DeviceConstView *view() const { return view_d.get(); }
49 
50 private:
51  cms::cuda::device::unique_ptr<uint32_t[]> moduleStart_d; // index of the first pixel of each module
52  cms::cuda::device::unique_ptr<uint32_t[]> clusInModule_d; // number of clusters found in each module
54 
55  // originally from rechits
56  cms::cuda::device::unique_ptr<uint32_t[]> clusModuleStart_d; // index of the first cluster of each module
57 
59 
60  uint32_t nClusters_h = 0;
61 };
62 
63 #endif // CUDADataFormats_SiPixelCluster_interface_SiPixelClustersCUDA_h
SiPixelClustersCUDA::view
DeviceConstView * view() const
Definition: SiPixelClustersCUDA.h:48
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelClustersCUDA::~SiPixelClustersCUDA
~SiPixelClustersCUDA()=default
SiPixelClustersCUDA::clusModuleStart
const uint32_t * clusModuleStart() const
Definition: SiPixelClustersCUDA.h:33
SiPixelClustersCUDA
Definition: SiPixelClustersCUDA.h:10
SiPixelClustersCUDA::clusModuleStart
uint32_t * clusModuleStart()
Definition: SiPixelClustersCUDA.h:28
SiPixelClustersCUDA::DeviceConstView::moduleId_
const uint32_t * moduleId_
Definition: SiPixelClustersCUDA.h:44
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
SiPixelClustersCUDA::moduleId_d
cms::cuda::device::unique_ptr< uint32_t[]> moduleId_d
Definition: SiPixelClustersCUDA.h:53
SiPixelClustersCUDA::moduleStart_d
cms::cuda::device::unique_ptr< uint32_t[]> moduleStart_d
Definition: SiPixelClustersCUDA.h:51
SiPixelClustersCUDA::operator=
SiPixelClustersCUDA & operator=(const SiPixelClustersCUDA &)=delete
SiPixelClustersCUDA::clusModuleStart_d
cms::cuda::device::unique_ptr< uint32_t[]> clusModuleStart_d
Definition: SiPixelClustersCUDA.h:56
device_unique_ptr.h
SiPixelClustersCUDA::clusInModule
uint32_t * clusInModule()
Definition: SiPixelClustersCUDA.h:26
host_unique_ptr.h
SiPixelClustersCUDA::moduleId
uint32_t * moduleId()
Definition: SiPixelClustersCUDA.h:27
SiPixelClustersCUDA::setNClusters
void setNClusters(uint32_t nClusters)
Definition: SiPixelClustersCUDA.h:21
SiPixelClustersCUDA::DeviceConstView::clusModuleStart_
const uint32_t * clusModuleStart_
Definition: SiPixelClustersCUDA.h:45
SiPixelClustersCUDA::DeviceConstView
Definition: SiPixelClustersCUDA.h:35
SiPixelClustersCUDA::DeviceConstView::clusInModule_
const uint32_t * clusInModule_
Definition: SiPixelClustersCUDA.h:43
SiPixelClustersCUDA::moduleId
const uint32_t * moduleId() const
Definition: SiPixelClustersCUDA.h:32
SiPixelClustersCUDA::clusInModule_d
cms::cuda::device::unique_ptr< uint32_t[]> clusInModule_d
Definition: SiPixelClustersCUDA.h:52
SiPixelClustersCUDA::SiPixelClustersCUDA
SiPixelClustersCUDA()=default
SiPixelClustersCUDA::moduleStart
uint32_t * moduleStart()
Definition: SiPixelClustersCUDA.h:25
__device__
#define __device__
Definition: SiPixelGainForHLTonGPU.h:15
__forceinline__
#define __forceinline__
Definition: cudaCompat.h:22
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition: device_unique_ptr.h:33
SiPixelClustersCUDA::view_d
cms::cuda::device::unique_ptr< DeviceConstView > view_d
Definition: SiPixelClustersCUDA.h:58
cudaCompat.h
SiPixelClustersCUDA::moduleStart
const uint32_t * moduleStart() const
Definition: SiPixelClustersCUDA.h:30
SiPixelClustersCUDA::nClusters_h
uint32_t nClusters_h
Definition: SiPixelClustersCUDA.h:60
cms::cudacompat::__ldg
T __ldg(T const *x)
Definition: cudaCompat.h:82
SiPixelClustersCUDA::nClusters
uint32_t nClusters() const
Definition: SiPixelClustersCUDA.h:23
SiPixelClustersCUDA::DeviceConstView::moduleStart_
const uint32_t * moduleStart_
Definition: SiPixelClustersCUDA.h:42
SiPixelClustersCUDA::clusInModule
const uint32_t * clusInModule() const
Definition: SiPixelClustersCUDA.h:31