Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:46:59

0001 #ifndef CondFormats_HcalObjects_interface_HcalPedestalsGPU_h
0002 #define CondFormats_HcalObjects_interface_HcalPedestalsGPU_h
0003 
0004 #include "CondFormats/HcalObjects/interface/HcalPedestals.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 HcalPedestalsGPU {
0014 public:
0015   struct Product {
0016     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> values;
0017     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> widths;
0018   };
0019 
0020 #ifndef __CUDACC__
0021   // rearrange reco params
0022   HcalPedestalsGPU(HcalPedestals const &);
0023 
0024   // will trigger deallocation of Product thru ~Product
0025   ~HcalPedestalsGPU() = default;
0026 
0027   // get device pointers
0028   Product const &getProduct(cudaStream_t) const;
0029 
0030   // as in cpu version
0031   bool unitIsADC() const { return unitIsADC_; }
0032 
0033   uint32_t offsetForHashes() const { return offsetForHashes_; }
0034 
0035 private:
0036   bool unitIsADC_;
0037   uint64_t totalChannels_;
0038   uint32_t offsetForHashes_;
0039   std::vector<float, cms::cuda::HostAllocator<float>> values_;
0040   std::vector<float, cms::cuda::HostAllocator<float>> widths_;
0041 
0042   cms::cuda::ESProduct<Product> product_;
0043 #endif
0044 };
0045 
0046 #endif