Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-28 23:48:15

0001 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
0002 #include "CondFormats/HcalObjects/interface/HcalChannelQualityGPU.h"
0003 #include "FWCore/Utilities/interface/typelookup.h"
0004 #include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h"
0005 
0006 // FIXME: add proper getters to conditions
0007 HcalChannelQualityGPU::HcalChannelQualityGPU(HcalChannelQuality const& quality)
0008     : totalChannels_{quality.getAllContainers()[0].second.size() + quality.getAllContainers()[1].second.size()},
0009       status_(totalChannels_) {
0010   auto const containers = quality.getAllContainers();
0011 
0012   // fill in eb
0013   auto const& barrelValues = containers[0].second;
0014   for (uint64_t i = 0; i < barrelValues.size(); ++i) {
0015     status_[i] = barrelValues[i].getValue();
0016   }
0017 
0018   // fill in ee
0019   auto const& endcapValues = containers[1].second;
0020   auto const offset = barrelValues.size();
0021   for (uint64_t i = 0; i < endcapValues.size(); ++i) {
0022     status_[i + offset] = endcapValues[i].getValue();
0023   }
0024 }
0025 
0026 HcalChannelQualityGPU::Product const& HcalChannelQualityGPU::getProduct(cudaStream_t stream) const {
0027   auto const& product =
0028       product_.dataForCurrentDeviceAsync(stream, [this](HcalChannelQualityGPU::Product& product, cudaStream_t stream) {
0029         // allocate
0030         product.status = cms::cuda::make_device_unique<uint32_t[]>(status_.size(), stream);
0031 
0032         // transfer
0033         cms::cuda::copyAsync(product.status, status_, stream);
0034       });
0035 
0036   return product;
0037 }
0038 
0039 TYPELOOKUP_DATA_REG(HcalChannelQualityGPU);