Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondFormats/EcalObjects/interface/EcalRechitChannelStatusGPU.h"
0002 
0003 #include "FWCore/Utilities/interface/typelookup.h"
0004 #include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h"
0005 
0006 EcalRechitChannelStatusGPU::EcalRechitChannelStatusGPU(EcalChannelStatus const& values) : status_(values.size()) {
0007   // fill in eb
0008   auto const& barrelValues = values.barrelItems();
0009   for (unsigned int i = 0; i < barrelValues.size(); i++) {
0010     status_[i] = barrelValues[i].getEncodedStatusCode();
0011   }
0012 
0013   // fill in ee
0014   auto const& endcapValues = values.endcapItems();
0015   auto const offset = barrelValues.size();
0016   for (unsigned int i = 0; i < endcapValues.size(); i++) {
0017     status_[offset + i] = endcapValues[i].getEncodedStatusCode();
0018   }
0019 }
0020 
0021 EcalRechitChannelStatusGPU::Product const& EcalRechitChannelStatusGPU::getProduct(cudaStream_t cudaStream) const {
0022   auto const& product = product_.dataForCurrentDeviceAsync(
0023       cudaStream, [this](EcalRechitChannelStatusGPU::Product& product, cudaStream_t cudaStream) {
0024         // allocate
0025         product.status = cms::cuda::make_device_unique<uint16_t[]>(status_.size(), cudaStream);
0026         // transfer
0027         cms::cuda::copyAsync(product.status, status_, cudaStream);
0028       });
0029 
0030   return product;
0031 }
0032 
0033 TYPELOOKUP_DATA_REG(EcalRechitChannelStatusGPU);