Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CondFormats_EcalObjects_interface_EcalLaserAPDPNRatiosGPU_h
0002 #define CondFormats_EcalObjects_interface_EcalLaserAPDPNRatiosGPU_h
0003 
0004 #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.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  // __CUDACC__
0012 
0013 class EcalLaserAPDPNRatiosGPU {
0014 public:
0015   struct Product {
0016     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> p1;
0017     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> p2;
0018     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> p3;
0019     edm::propagate_const_array<cms::cuda::device::unique_ptr<edm::TimeValue_t[]>> t1;
0020     edm::propagate_const_array<cms::cuda::device::unique_ptr<edm::TimeValue_t[]>> t2;
0021     edm::propagate_const_array<cms::cuda::device::unique_ptr<edm::TimeValue_t[]>> t3;
0022   };
0023 
0024 #ifndef __CUDACC__
0025 
0026   //
0027   EcalLaserAPDPNRatiosGPU(EcalLaserAPDPNRatios const &);
0028 
0029   // will call dealloation for Product thru ~Product
0030   ~EcalLaserAPDPNRatiosGPU() = default;
0031 
0032   // get device pointers
0033   Product const &getProduct(cudaStream_t) const;
0034 
0035   //
0036   static std::string name() { return std::string{"ecalLaserAPDPNRatiosGPU"}; }
0037 
0038 private:
0039   // in the future, we need to arrange so to avoid this copy on the host
0040   // store eb first then ee
0041   std::vector<float, cms::cuda::HostAllocator<float>> p1_;
0042   std::vector<float, cms::cuda::HostAllocator<float>> p2_;
0043   std::vector<float, cms::cuda::HostAllocator<float>> p3_;
0044 
0045   std::vector<edm::TimeValue_t, cms::cuda::HostAllocator<edm::TimeValue_t>> t1_;
0046   std::vector<edm::TimeValue_t, cms::cuda::HostAllocator<edm::TimeValue_t>> t2_;
0047   std::vector<edm::TimeValue_t, cms::cuda::HostAllocator<edm::TimeValue_t>> t3_;
0048 
0049   cms::cuda::ESProduct<Product> product_;
0050 
0051 #endif  // __CUDACC__
0052 };
0053 
0054 #endif  // CondFormats_EcalObjects_interface_EcalLaserAPDPNRatiosGPU_h