Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:15:03

0001 #ifndef EventFilter_HcalRawToDigi_plugins_ElectronicsMappingGPU_h
0002 #define EventFilter_HcalRawToDigi_plugins_ElectronicsMappingGPU_h
0003 
0004 #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
0005 
0006 #ifndef __CUDACC__
0007 #include "HeterogeneousCore/CUDACore/interface/ESProduct.h"
0008 #include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h"
0009 #endif
0010 
0011 namespace hcal {
0012   namespace raw {
0013 
0014     class ElectronicsMappingGPU {
0015     public:
0016       struct Product {
0017         ~Product();
0018         // trigger
0019         uint32_t *eid2tid;
0020         // detector
0021         uint32_t *eid2did;
0022       };
0023 
0024 #ifndef __CUDACC__
0025 
0026       // rearrange pedestals
0027       ElectronicsMappingGPU(HcalElectronicsMap const &);
0028 
0029       // will call dealloation for Product thru ~Product
0030       ~ElectronicsMappingGPU() = default;
0031 
0032       // get device pointers
0033       Product const &getProduct(cudaStream_t) const;
0034 
0035     private:
0036       // in the future, we need to arrange so to avoid this copy on the host
0037       // if possible
0038       std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t>> eid2tid_;
0039       std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t>> eid2did_;
0040 
0041       cms::cuda::ESProduct<Product> product_;
0042 #endif
0043     };
0044 
0045   }  // namespace raw
0046 }  // namespace hcal
0047 
0048 #endif  // EventFilter_HcalRawToDigi_plugins_ElectronicsMappingGPU_h