CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiPixelDigisCUDA.h
Go to the documentation of this file.
1 #ifndef CUDADataFormats_SiPixelDigi_interface_SiPixelDigisCUDA_h
2 #define CUDADataFormats_SiPixelDigi_interface_SiPixelDigisCUDA_h
3 
4 #include <cuda_runtime.h>
5 
9 
11 public:
12  SiPixelDigisCUDA() = default;
13  explicit SiPixelDigisCUDA(size_t maxFedWords, cudaStream_t stream);
14  ~SiPixelDigisCUDA() = default;
15 
16  SiPixelDigisCUDA(const SiPixelDigisCUDA &) = delete;
17  SiPixelDigisCUDA &operator=(const SiPixelDigisCUDA &) = delete;
18  SiPixelDigisCUDA(SiPixelDigisCUDA &&) = default;
20 
21  void setNModulesDigis(uint32_t nModules, uint32_t nDigis) {
23  nDigis_h = nDigis;
24  }
25 
26  uint32_t nModules() const { return nModules_h; }
27  uint32_t nDigis() const { return nDigis_h; }
28 
29  uint16_t *xx() { return xx_d.get(); }
30  uint16_t *yy() { return yy_d.get(); }
31  uint16_t *adc() { return adc_d.get(); }
32  uint16_t *moduleInd() { return moduleInd_d.get(); }
33  int32_t *clus() { return clus_d.get(); }
34  uint32_t *pdigi() { return pdigi_d.get(); }
35  uint32_t *rawIdArr() { return rawIdArr_d.get(); }
36 
37  uint16_t const *xx() const { return xx_d.get(); }
38  uint16_t const *yy() const { return yy_d.get(); }
39  uint16_t const *adc() const { return adc_d.get(); }
40  uint16_t const *moduleInd() const { return moduleInd_d.get(); }
41  int32_t const *clus() const { return clus_d.get(); }
42  uint32_t const *pdigi() const { return pdigi_d.get(); }
43  uint32_t const *rawIdArr() const { return rawIdArr_d.get(); }
44 
49 
51  public:
52  __device__ __forceinline__ uint16_t xx(int i) const { return __ldg(xx_ + i); }
53  __device__ __forceinline__ uint16_t yy(int i) const { return __ldg(yy_ + i); }
54  __device__ __forceinline__ uint16_t adc(int i) const { return __ldg(adc_ + i); }
55  __device__ __forceinline__ uint16_t moduleInd(int i) const { return __ldg(moduleInd_ + i); }
56  __device__ __forceinline__ int32_t clus(int i) const { return __ldg(clus_ + i); }
57 
58  uint16_t const *xx_;
59  uint16_t const *yy_;
60  uint16_t const *adc_;
61  uint16_t const *moduleInd_;
62  int32_t const *clus_;
63  };
64 
65  const DeviceConstView *view() const { return view_d.get(); }
66 
67 private:
68  // These are consumed by downstream device code
69  cms::cuda::device::unique_ptr<uint16_t[]> xx_d; // local coordinates of each pixel
73  cms::cuda::device::unique_ptr<int32_t[]> clus_d; // cluster id of each pixel
75 
76  // These are for CPU output; should we (eventually) place them to a
77  // separate product?
78  cms::cuda::device::unique_ptr<uint32_t[]> pdigi_d; // packed digi (row, col, adc) of each pixel
80 
81  uint32_t nModules_h = 0;
82  uint32_t nDigis_h = 0;
83 };
84 
85 #endif // CUDADataFormats_SiPixelDigi_interface_SiPixelDigisCUDA_h
uint32_t const * pdigi() const
uint16_t const * moduleInd() const
#define __forceinline__
Definition: cudaCompat.h:22
~SiPixelDigisCUDA()=default
cms::cuda::device::unique_ptr< uint16_t[]> xx_d
uint32_t const * rawIdArr() const
uint32_t * rawIdArr()
cms::cuda::device::unique_ptr< uint16_t[]> moduleInd_d
uint32_t nDigis() const
int32_t const * clus() const
uint32_t * pdigi()
cms::cuda::device::unique_ptr< int32_t[]> clus_d
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< uint16_t[]> yy_d
uint16_t * adc()
cms::cuda::host::unique_ptr< uint32_t[]> pdigiToHostAsync(cudaStream_t stream) const
uint16_t const * adc() const
uint32_t nModules() const
cms::cuda::device::unique_ptr< uint16_t[]> adc_d
uint16_t const * yy() const
const DeviceConstView * view() const
uint16_t const * xx() const
cms::cuda::host::unique_ptr< uint16_t[]> adcToHostAsync(cudaStream_t stream) const
cms::cuda::device::unique_ptr< uint32_t[]> rawIdArr_d
SiPixelDigisCUDA & operator=(const SiPixelDigisCUDA &)=delete
cms::cuda::host::unique_ptr< uint32_t[]> rawIdArrToHostAsync(cudaStream_t stream) const
SiPixelDigisCUDA()=default
uint16_t * moduleInd()
cms::cuda::device::unique_ptr< uint32_t[]> pdigi_d
T __ldg(T const *x)
Definition: cudaCompat.h:113
cms::cuda::host::unique_ptr< int32_t[]> clusToHostAsync(cudaStream_t stream) const
cms::cuda::device::unique_ptr< DeviceConstView > view_d
void setNModulesDigis(uint32_t nModules, uint32_t nDigis)
std::unique_ptr< T, impl::HostDeleter > unique_ptr
#define __device__