Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-25 10:54:40

0001 #ifndef CondFormats_EcalObjects_interface_ElectronicsMappingGPU_h
0002 #define CondFormats_EcalObjects_interface_ElectronicsMappingGPU_h
0003 
0004 #include "CondFormats/EcalObjects/interface/EcalMappingElectronics.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 namespace ecal {
0014   namespace raw {
0015 
0016     class ElectronicsMappingGPU {
0017     public:
0018       struct Product {
0019         edm::propagate_const_array<cms::cuda::device::unique_ptr<uint32_t[]>> eid2did;
0020       };
0021 
0022 #ifndef __CUDACC__
0023 
0024       // rearrange pedestals
0025       ElectronicsMappingGPU(EcalMappingElectronics const&);
0026 
0027       // will call dealloation for Product thru ~Product
0028       ~ElectronicsMappingGPU() = default;
0029 
0030       // get device pointers
0031       Product const& getProduct(cudaStream_t) const;
0032 
0033       //
0034       static std::string name() { return std::string{"ecalElectronicsMappingGPU"}; }
0035 
0036     private:
0037       // in the future, we need to arrange so to avoid this copy on the host
0038       // store eb first then ee
0039       std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t>> eid2did_;
0040 
0041       cms::cuda::ESProduct<Product> product_;
0042 #endif  // __CUDACC__
0043     };
0044 
0045   }  // namespace raw
0046 }  // namespace ecal
0047 
0048 #endif  // CondFormats_EcalObjects_interface_ElectronicsMappingGPU_h