CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
21  void setNClusters(uint32_t nClusters, int32_t offsetBPIX2) {
24  }
25 
26  uint32_t nClusters() const { return nClusters_h; }
27  int32_t offsetBPIX2() const { return offsetBPIX2_h; }
28 
29  uint32_t *moduleStart() { return moduleStart_d.get(); }
30  uint32_t *clusInModule() { return clusInModule_d.get(); }
31  uint32_t *moduleId() { return moduleId_d.get(); }
32  uint32_t *clusModuleStart() { return clusModuleStart_d.get(); }
33 
34  uint32_t const *moduleStart() const { return moduleStart_d.get(); }
35  uint32_t const *clusInModule() const { return clusInModule_d.get(); }
36  uint32_t const *moduleId() const { return moduleId_d.get(); }
37  uint32_t const *clusModuleStart() const { return clusModuleStart_d.get(); }
38 
40  public:
41  __device__ __forceinline__ uint32_t moduleStart(int i) const { return __ldg(moduleStart_ + i); }
42  __device__ __forceinline__ uint32_t clusInModule(int i) const { return __ldg(clusInModule_ + i); }
43  __device__ __forceinline__ uint32_t moduleId(int i) const { return __ldg(moduleId_ + i); }
44  __device__ __forceinline__ uint32_t clusModuleStart(int i) const { return __ldg(clusModuleStart_ + i); }
45 
46  uint32_t const *moduleStart_;
47  uint32_t const *clusInModule_;
48  uint32_t const *moduleId_;
49  uint32_t const *clusModuleStart_;
50  };
51 
52  DeviceConstView *view() const { return view_d.get(); }
53 
54 private:
55  cms::cuda::device::unique_ptr<uint32_t[]> moduleStart_d; // index of the first pixel of each module
56  cms::cuda::device::unique_ptr<uint32_t[]> clusInModule_d; // number of clusters found in each module
58 
59  // originally from rechits
60  cms::cuda::device::unique_ptr<uint32_t[]> clusModuleStart_d; // index of the first cluster of each module
61 
63 
64  uint32_t nClusters_h = 0;
65  int32_t offsetBPIX2_h = 0;
66 };
67 
68 #endif // CUDADataFormats_SiPixelCluster_interface_SiPixelClustersCUDA_h
#define __forceinline__
Definition: cudaCompat.h:22
uint32_t const * moduleStart() const
cms::cuda::device::unique_ptr< uint32_t[]> moduleStart_d
uint32_t const * clusModuleStart() const
uint32_t nClusters() const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
cms::cuda::device::unique_ptr< uint32_t[]> moduleId_d
uint32_t const * clusInModule() const
uint32_t * clusModuleStart()
SiPixelClustersCUDA & operator=(const SiPixelClustersCUDA &)=delete
SiPixelClustersCUDA()=default
void setNClusters(uint32_t nClusters, int32_t offsetBPIX2)
cms::cuda::device::unique_ptr< uint32_t[]> clusInModule_d
T __ldg(T const *x)
Definition: cudaCompat.h:113
DeviceConstView * view() const
cms::cuda::device::unique_ptr< DeviceConstView > view_d
cms::cuda::device::unique_ptr< uint32_t[]> clusModuleStart_d
uint32_t const * moduleId() const
~SiPixelClustersCUDA()=default
int32_t offsetBPIX2() const
#define __device__