Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:14

0001 #ifndef CondFormats_HcalObjects_interface_HcalSiPMCharacteristicsGPU_h
0002 #define CondFormats_HcalObjects_interface_HcalSiPMCharacteristicsGPU_h
0003 
0004 #include "CondFormats/HcalObjects/interface/HcalSiPMCharacteristics.h"
0005 #include "FWCore/Utilities/interface/propagate_const_array.h"
0006 #include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h"
0007 
0008 #ifndef __CUDACC__
0009 #include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h"
0010 #include "HeterogeneousCore/CUDACore/interface/ESProduct.h"
0011 #endif
0012 
0013 class HcalSiPMCharacteristicsGPU {
0014 public:
0015   struct Product {
0016     edm::propagate_const_array<cms::cuda::device::unique_ptr<int[]>> pixels;
0017     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> parLin1;
0018     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> parLin2;
0019     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> parLin3;
0020     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> crossTalk;
0021     edm::propagate_const_array<cms::cuda::device::unique_ptr<int[]>> auxi1;
0022     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> auxi2;
0023   };
0024 
0025 #ifndef __CUDACC__
0026   // rearrange reco params
0027   HcalSiPMCharacteristicsGPU(HcalSiPMCharacteristics const &);
0028 
0029   // will trigger deallocation of Product thru ~Product
0030   ~HcalSiPMCharacteristicsGPU() = default;
0031 
0032   // get device pointers
0033   Product const &getProduct(cudaStream_t) const;
0034 
0035 private:
0036   std::vector<int, cms::cuda::HostAllocator<int>> pixels_, auxi1_;
0037   std::vector<float, cms::cuda::HostAllocator<float>> parLin1_, parLin2_, parLin3_, crossTalk_, auxi2_;
0038 
0039   cms::cuda::ESProduct<Product> product_;
0040 #endif
0041 };
0042 
0043 #endif