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< edm::ExternalWork >

Public Member Functions

void acquire (edm::Event const &event, edm::EventSetup const &setup, edm::WaitingTaskWithArenaHolder holder) override
 
 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< edm::ExternalWork >
 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

cms::cuda::ContextState cudaState_
 
const edm::EDGetTokenT< EBDigiCollectionPh2digiCollectionToken_
 
ecal::DigisCollection<::calo::common::DevStoragePolicydigis_
 
const edm::EDPutTokenT< cms::cuda::Product< ecal::DigisCollection< calo::common::DevStoragePolicy > > > digisCollectionToken_
 
uint32_t size_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::ExternalWork >
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 44 of file EcalPhase2DigiToGPUProducer.cc.

45  : digiCollectionToken_(consumes<EBDigiCollectionPh2>(ps.getParameter<edm::InputTag>("BarrelDigis"))),
47  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

◆ acquire()

void EcalPhase2DigiToGPUProducer::acquire ( edm::Event const &  event,
edm::EventSetup const &  setup,
edm::WaitingTaskWithArenaHolder  holder 
)
override

Definition at line 49 of file EcalPhase2DigiToGPUProducer.cc.

References cudaCheck, cudaState_, digiCollectionToken_, digis_, mps_fire::i, EcalDataFrame_Ph2::MAXSAMPLES, eostools::move(), PresampleTask_cfi::nSamples, Digi_cff::pdigi, EcalLiteDTUSample::raw(), ecalGpuTask_cfi::sample, and size_.

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

◆ fillDescriptions()

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

◆ produce()

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

Definition at line 95 of file EcalPhase2DigiToGPUProducer.cc.

References cudaState_, digis_, digisCollectionToken_, and eostools::move().

95  {
96  //get cuda context state for producer
98 
99  //emplace output in the context
101 }
const edm::EDPutTokenT< cms::cuda::Product< ecal::DigisCollection< calo::common::DevStoragePolicy > > > digisCollectionToken_
ecal::DigisCollection<::calo::common::DevStoragePolicy > digis_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ cudaState_

cms::cuda::ContextState EcalPhase2DigiToGPUProducer::cudaState_
private

Definition at line 32 of file EcalPhase2DigiToGPUProducer.cc.

Referenced by acquire(), and produce().

◆ digiCollectionToken_

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

Definition at line 25 of file EcalPhase2DigiToGPUProducer.cc.

Referenced by acquire().

◆ digis_

ecal::DigisCollection<::calo::common::DevStoragePolicy> EcalPhase2DigiToGPUProducer::digis_
private

Definition at line 30 of file EcalPhase2DigiToGPUProducer.cc.

Referenced by acquire(), and produce().

◆ digisCollectionToken_

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

Definition at line 27 of file EcalPhase2DigiToGPUProducer.cc.

Referenced by produce().

◆ size_

uint32_t EcalPhase2DigiToGPUProducer::size_
private

Definition at line 28 of file EcalPhase2DigiToGPUProducer.cc.

Referenced by acquire().