Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:47

0001 #ifndef RecoLocalCalo_HcalRecAlgos_interface_HcalRecoParamsWithPulseShapesGPU_h
0002 #define RecoLocalCalo_HcalRecAlgos_interface_HcalRecoParamsWithPulseShapesGPU_h
0003 
0004 #ifndef __CUDACC__
0005 #include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h"
0006 #include "HeterogeneousCore/CUDACore/interface/ESProduct.h"
0007 #endif
0008 
0009 class HcalRecoParams;
0010 
0011 //
0012 // TODO: HcalPulseShapes will need to be used via ESSource
0013 // This is a workaround: precompute/store/transfer what's needed only
0014 //
0015 class HcalRecoParamsWithPulseShapesGPU {
0016 public:
0017   struct Product {
0018     ~Product();
0019     uint32_t *param1 = nullptr, *param2 = nullptr;
0020     uint32_t *ids = nullptr;
0021 
0022     // These guys come directly from PulseShapeFunctor class
0023     float *acc25nsVec = nullptr, *diff25nsItvlVec = nullptr, *accVarLenIdxMinusOneVec = nullptr,
0024           *diffVarItvlIdxMinusOneVec = nullptr, *accVarLenIdxZEROVec = nullptr, *diffVarItvlIdxZEROVec = nullptr;
0025   };
0026 
0027 #ifndef __CUDACC__
0028   // rearrange reco params
0029   HcalRecoParamsWithPulseShapesGPU(HcalRecoParams const &);
0030 
0031   // will trigger deallocation of Product thru ~Product
0032   ~HcalRecoParamsWithPulseShapesGPU() = default;
0033 
0034   // get device pointers
0035   Product const &getProduct(cudaStream_t) const;
0036 
0037 private:
0038   uint64_t totalChannels_;  // hb + he
0039   std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t>> param1_;
0040   std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t>> param2_;
0041   std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t>> ids_;
0042 
0043   std::vector<float, cms::cuda::HostAllocator<float>> acc25nsVec_;                 // 256
0044   std::vector<float, cms::cuda::HostAllocator<float>> diff25nsItvlVec_;            // 256
0045   std::vector<float, cms::cuda::HostAllocator<float>> accVarLenIdxMinusOneVec_;    // 25
0046   std::vector<float, cms::cuda::HostAllocator<float>> diffVarItvlIdxMinusOneVec_;  // 25
0047   std::vector<float, cms::cuda::HostAllocator<float>> accVarLenIdxZEROVec_;        // 25
0048   std::vector<float, cms::cuda::HostAllocator<float>> diffVarItvlIdxZEROVec_;      // 25
0049 
0050   cms::cuda::ESProduct<Product> product_;
0051 #endif
0052 };
0053 
0054 #endif