Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CondFormats_EcalObjects_interface_EcalPedestalsGPU_h
0002 #define CondFormats_EcalObjects_interface_EcalPedestalsGPU_h
0003 
0004 #include "CondFormats/EcalObjects/interface/EcalPedestals.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 EcalPedestalsGPU {
0014 public:
0015   struct Product {
0016     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> mean_x12;
0017     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> mean_x6;
0018     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> mean_x1;
0019     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> rms_x12;
0020     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> rms_x6;
0021     edm::propagate_const_array<cms::cuda::device::unique_ptr<float[]>> rms_x1;
0022   };
0023 
0024 #ifndef __CUDACC__
0025 
0026   // rearrange pedestals
0027   EcalPedestalsGPU(EcalPedestals const &);
0028 
0029   // will call dealloation for Product thru ~Product
0030   ~EcalPedestalsGPU() = default;
0031 
0032   // get device pointers
0033   Product const &getProduct(cudaStream_t) const;
0034 
0035   //
0036   static std::string name() { return std::string{"ecalPedestalsGPU"}; }
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>> mean_x12_;
0042   std::vector<float, cms::cuda::HostAllocator<float>> rms_x12_;
0043   std::vector<float, cms::cuda::HostAllocator<float>> mean_x6_;
0044   std::vector<float, cms::cuda::HostAllocator<float>> rms_x6_;
0045   std::vector<float, cms::cuda::HostAllocator<float>> mean_x1_;
0046   std::vector<float, cms::cuda::HostAllocator<float>> rms_x1_;
0047 
0048   cms::cuda::ESProduct<Product> product_;
0049 #endif  // __CUDACC__
0050 };
0051 
0052 #endif  // CondFormats_EcalObjects_interface_EcalPedestalsGPU_h