CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
EcalPhase2DigiToGPUProducer Class Reference
Inheritance diagram for EcalPhase2DigiToGPUProducer:
edm::stream::EDProducer<>

Public Member Functions

 EcalPhase2DigiToGPUProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, edm::EventSetup const &setup) override
 
 ~EcalPhase2DigiToGPUProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const edm::EDGetTokenT< EBDigiCollectionPh2digiCollectionToken_
 
const edm::EDPutTokenT< cms::cuda::Product< ecal::DigisCollection< calo::common::DevStoragePolicy > > > digisCollectionToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 15 of file EcalPhase2DigiToGPUProducer.cc.

Constructor & Destructor Documentation

◆ EcalPhase2DigiToGPUProducer()

EcalPhase2DigiToGPUProducer::EcalPhase2DigiToGPUProducer ( const edm::ParameterSet ps)
explicit

Definition at line 38 of file EcalPhase2DigiToGPUProducer.cc.

39  : digiCollectionToken_(consumes<EBDigiCollectionPh2>(ps.getParameter<edm::InputTag>("BarrelDigis"))),
41  ps.getParameter<std::string>("digisLabelEB"))) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDPutTokenT< cms::cuda::Product< ecal::DigisCollection< calo::common::DevStoragePolicy > > > digisCollectionToken_
const edm::EDGetTokenT< EBDigiCollectionPh2 > digiCollectionToken_

◆ ~EcalPhase2DigiToGPUProducer()

EcalPhase2DigiToGPUProducer::~EcalPhase2DigiToGPUProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void EcalPhase2DigiToGPUProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

◆ produce()

void EcalPhase2DigiToGPUProducer::produce ( edm::Event evt,
edm::EventSetup const &  setup 
)
override

Definition at line 43 of file EcalPhase2DigiToGPUProducer.cc.

References cudaCheck, ecal::DigisCollection< StoragePolicy >::data, digiCollectionToken_, digisCollectionToken_, cms::cuda::impl::ScopedContextGetterBase::get(), mps_fire::i, ecal::DigisCollection< StoragePolicy >::ids, EcalDataFrame_Ph2::MAXSAMPLES, eostools::move(), PresampleTask_cfi::nSamples, Digi_cff::pdigi, EcalLiteDTUSample::raw(), ecalGpuTask_cfi::sample, and findQualityFiles::size.

43  {
44  cms::cuda::ScopedContextProduce ctx{event.streamID()};
45 
46  //input data from event
47  const auto& pdigis = event.get(digiCollectionToken_);
48 
49  const uint32_t size = pdigis.size();
50 
52  digis.size = size;
53 
54  //allocate device pointers for output
55  digis.ids = cms::cuda::make_device_unique<uint32_t[]>(size, ctx.stream());
56  digis.data = cms::cuda::make_device_unique<uint16_t[]>(size * EcalDataFrame_Ph2::MAXSAMPLES, ctx.stream());
57 
58  //allocate host pointers for holding product data and id vectors
59  auto idstmp = cms::cuda::make_host_unique<uint32_t[]>(size, ctx.stream());
60  auto datatmp = cms::cuda::make_host_unique<uint16_t[]>(size * EcalDataFrame_Ph2::MAXSAMPLES, ctx.stream());
61 
62  //iterate over digis
63  uint32_t i = 0;
64  for (const auto& pdigi : pdigis) {
65  const int nSamples = pdigi.size();
66  //assign id to output vector
67  idstmp.get()[i] = pdigi.id();
68  //iterate over sample in digi
69  for (int sample = 0; sample < nSamples; ++sample) {
70  //get samples from input digi
71  EcalLiteDTUSample thisSample = pdigi[sample];
72  //assign adc data to output
73  datatmp.get()[i * nSamples + sample] = thisSample.raw();
74  }
75  ++i;
76  }
77 
78  //copy output vectors into member variable device pointers for the output struct
79  cudaCheck(
80  cudaMemcpyAsync(digis.ids.get(), idstmp.get(), size * sizeof(uint32_t), cudaMemcpyHostToDevice, ctx.stream()));
81  cudaCheck(cudaMemcpyAsync(digis.data.get(),
82  datatmp.get(),
83  size * EcalDataFrame_Ph2::MAXSAMPLES * sizeof(uint16_t),
84  cudaMemcpyHostToDevice,
85  ctx.stream()));
86 
87  //emplace output in the context
88  ctx.emplace(event, digisCollectionToken_, std::move(digis));
89 }
size
Write out results.
StoragePolicy::template StorageSelector< uint16_t >::type data
uint16_t raw() const
get the raw word
StoragePolicy::template StorageSelector< uint32_t >::type ids
const edm::EDPutTokenT< cms::cuda::Product< ecal::DigisCollection< calo::common::DevStoragePolicy > > > digisCollectionToken_
const edm::EDGetTokenT< EBDigiCollectionPh2 > digiCollectionToken_
static constexpr int MAXSAMPLES
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
const T & get(const Product< T > &data)
Definition: ScopedContext.h:58
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ digiCollectionToken_

const edm::EDGetTokenT<EBDigiCollectionPh2> EcalPhase2DigiToGPUProducer::digiCollectionToken_
private

Definition at line 24 of file EcalPhase2DigiToGPUProducer.cc.

Referenced by produce().

◆ digisCollectionToken_

const edm::EDPutTokenT<cms::cuda::Product<ecal::DigisCollection<calo::common::DevStoragePolicy> > > EcalPhase2DigiToGPUProducer::digisCollectionToken_
private

Definition at line 26 of file EcalPhase2DigiToGPUProducer.cc.

Referenced by produce().