Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CondFormats_HcalObjects_interface_HcalPedestalWidthsGPU_h
0002 #define CondFormats_HcalObjects_interface_HcalPedestalWidthsGPU_h
0003 
0004 #include "CondFormats/HcalObjects/interface/HcalPedestalWidths.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 HcalPedestalWidthsGPU {
0014 public:
0015   struct Product {
0016     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma00;
0017     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma01;
0018     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma02;
0019     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma03;
0020     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma10;
0021     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma11;
0022     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma12;
0023     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma13;
0024     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma20;
0025     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma21;
0026     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma22;
0027     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma23;
0028     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma30;
0029     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma31;
0030     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma32;
0031     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> sigma33;
0032   };
0033 
0034 #ifndef __CUDACC__
0035   // rearrange reco params
0036   HcalPedestalWidthsGPU(HcalPedestalWidths const&);
0037 
0038   // will trigger deallocation of Product thru ~Product
0039   ~HcalPedestalWidthsGPU() = default;
0040 
0041   // get device pointers
0042   Product const& getProduct(cudaStream_t) const;
0043 
0044   // as in cpu version
0045   bool unitIsADC() const { return unitIsADC_; }
0046 
0047 private:
0048   bool unitIsADC_;
0049   uint64_t totalChannels_;
0050   std::vector<float, cms::cuda::HostAllocator<float>> sigma00_;
0051   std::vector<float, cms::cuda::HostAllocator<float>> sigma01_;
0052   std::vector<float, cms::cuda::HostAllocator<float>> sigma02_;
0053   std::vector<float, cms::cuda::HostAllocator<float>> sigma03_;
0054   std::vector<float, cms::cuda::HostAllocator<float>> sigma10_;
0055   std::vector<float, cms::cuda::HostAllocator<float>> sigma11_;
0056   std::vector<float, cms::cuda::HostAllocator<float>> sigma12_;
0057   std::vector<float, cms::cuda::HostAllocator<float>> sigma13_;
0058   std::vector<float, cms::cuda::HostAllocator<float>> sigma20_;
0059   std::vector<float, cms::cuda::HostAllocator<float>> sigma21_;
0060   std::vector<float, cms::cuda::HostAllocator<float>> sigma22_;
0061   std::vector<float, cms::cuda::HostAllocator<float>> sigma23_;
0062   std::vector<float, cms::cuda::HostAllocator<float>> sigma30_;
0063   std::vector<float, cms::cuda::HostAllocator<float>> sigma31_;
0064   std::vector<float, cms::cuda::HostAllocator<float>> sigma32_;
0065   std::vector<float, cms::cuda::HostAllocator<float>> sigma33_;
0066 
0067   cms::cuda::ESProduct<Product> product_;
0068 #endif
0069 };
0070 
0071 #endif