Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondFormats/EcalObjects/interface/EcalRechitADCToGeVConstantGPU.h"
0002 
0003 #include "FWCore/Utilities/interface/typelookup.h"
0004 #include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h"
0005 
0006 EcalRechitADCToGeVConstantGPU::EcalRechitADCToGeVConstantGPU(EcalADCToGeVConstant const& values)
0007     : adc2gev_(2)  // size is 2, one form EB and one for EE
0008 {
0009   adc2gev_[0] = values.getEBValue();
0010   adc2gev_[1] = values.getEEValue();
0011 }
0012 
0013 EcalRechitADCToGeVConstantGPU::Product const& EcalRechitADCToGeVConstantGPU::getProduct(cudaStream_t cudaStream) const {
0014   auto const& product = product_.dataForCurrentDeviceAsync(
0015       cudaStream, [this](EcalRechitADCToGeVConstantGPU::Product& product, cudaStream_t cudaStream) {
0016         // allocate
0017         product.adc2gev = cms::cuda::make_device_unique<float[]>(adc2gev_.size(), cudaStream);
0018         // transfer
0019         cms::cuda::copyAsync(product.adc2gev, adc2gev_, cudaStream);
0020       });
0021 
0022   return product;
0023 }
0024 
0025 TYPELOOKUP_DATA_REG(EcalRechitADCToGeVConstantGPU);