Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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