Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRefGPU.h"
0002 
0003 #include "FWCore/Utilities/interface/typelookup.h"
0004 #include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h"
0005 
0006 EcalLaserAPDPNRatiosRefGPU::EcalLaserAPDPNRatiosRefGPU(EcalLaserAPDPNRatiosRef const& values) {
0007   values_.reserve(values.size());
0008   values_.insert(values_.end(), values.barrelItems().begin(), values.barrelItems().end());
0009   values_.insert(values_.end(), values.endcapItems().begin(), values.endcapItems().end());
0010   offset_ = values.barrelItems().size();
0011 }
0012 
0013 EcalLaserAPDPNRatiosRefGPU::Product const& EcalLaserAPDPNRatiosRefGPU::getProduct(cudaStream_t cudaStream) const {
0014   auto const& product = product_.dataForCurrentDeviceAsync(
0015       cudaStream, [this](EcalLaserAPDPNRatiosRefGPU::Product& product, cudaStream_t cudaStream) {
0016         // allocate
0017         product.values = cms::cuda::make_device_unique<float[]>(values_.size(), cudaStream);
0018         // transfer
0019         cms::cuda::copyAsync(product.values, values_, cudaStream);
0020       });
0021 
0022   return product;
0023 }
0024 
0025 TYPELOOKUP_DATA_REG(EcalLaserAPDPNRatiosRefGPU);