CMS 3D CMS Logo

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

Public Member Functions

 EcalRawToDigiGPU (edm::ParameterSet const &ps)
 
 ~EcalRawToDigiGPU () 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 &)
 

Private Types

using OutputProduct = cms::cuda::Product< ecal::DigisCollection< calo::common::DevStoragePolicy > >
 

Private Member Functions

void acquire (edm::Event const &, edm::EventSetup const &, edm::WaitingTaskWithArenaHolder) override
 
void produce (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

ecal::raw::ConfigurationParameters config_
 
cms::cuda::ContextState cudaState_
 
edm::EDPutTokenT< OutputProductdigisEBToken_
 
edm::EDPutTokenT< OutputProductdigisEEToken_
 
edm::ESGetToken< ecal::raw::ElectronicsMappingGPU, EcalMappingElectronicsRcdeMappingToken_
 
std::vector< int > fedsToUnpack_
 
ecal::raw::OutputDataCPU outputCPU_
 
ecal::raw::OutputDataGPU outputGPU_
 
edm::EDGetTokenT< FEDRawDataCollectionrawDataToken_
 

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 18 of file EcalRawToDigiGPU.cc.

Member Typedef Documentation

◆ OutputProduct

Definition at line 30 of file EcalRawToDigiGPU.cc.

Constructor & Destructor Documentation

◆ EcalRawToDigiGPU()

EcalRawToDigiGPU::EcalRawToDigiGPU ( edm::ParameterSet const &  ps)
explicit

Definition at line 60 of file EcalRawToDigiGPU.cc.

References edm::ParameterSet::getParameter().

61  : rawDataToken_{consumes<FEDRawDataCollection>(ps.getParameter<edm::InputTag>("InputLabel"))},
62  digisEBToken_{produces<OutputProduct>(ps.getParameter<std::string>("digisLabelEB"))},
63  digisEEToken_{produces<OutputProduct>(ps.getParameter<std::string>("digisLabelEE"))},
64  eMappingToken_{esConsumes<ecal::raw::ElectronicsMappingGPU, EcalMappingElectronicsRcd>()},
65  fedsToUnpack_{ps.getParameter<std::vector<int>>("FEDs")} {
66  config_.maxChannelsEB = ps.getParameter<uint32_t>("maxChannelsEB");
67  config_.maxChannelsEE = ps.getParameter<uint32_t>("maxChannelsEE");
68 }
edm::ESGetToken< ecal::raw::ElectronicsMappingGPU, EcalMappingElectronicsRcd > eMappingToken_
std::vector< int > fedsToUnpack_
edm::EDPutTokenT< OutputProduct > digisEEToken_
ecal::raw::ConfigurationParameters config_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
edm::EDPutTokenT< OutputProduct > digisEBToken_

◆ ~EcalRawToDigiGPU()

EcalRawToDigiGPU::~EcalRawToDigiGPU ( )
overridedefault

Member Function Documentation

◆ acquire()

void EcalRawToDigiGPU::acquire ( edm::Event const &  event,
edm::EventSetup const &  setup,
edm::WaitingTaskWithArenaHolder  holder 
)
overrideprivate

Definition at line 70 of file EcalRawToDigiGPU.cc.

References ecal::raw::OutputDataGPU::allocate(), cms::cuda::assert(), submitPVValidationJobs::conditions, config_, counter, cudaState_, ecal::raw::InputDataCPU::data, data, eMappingToken_, EMPTYEVENTSIZE, ecal::raw::entryPoint(), FEDRawDataCollection::FEDData(), ecal::raw::InputDataCPU::feds, l1tstage2emulator_dqm_sourceclient-live_cfg::feds, fedsToUnpack_, ecal::raw::ElectronicsMappingGPU::getProduct(), cms::cuda::make_device_unique(), cms::cuda::make_host_unique(), eostools::move(), ecal::raw::OutputDataCPU::nchannels, ecal::raw::InputDataCPU::offsets, outputCPU_, outputGPU_, rawDataToken_, singleTopDQM_cfi::setup, and findQualityFiles::size.

72  {
73  // raii
74  cms::cuda::ScopedContextAcquire ctx{event.streamID(), std::move(holder), cudaState_};
75 
76  // conditions
78  auto const& eMappingProduct = eMappingHandle->getProduct(ctx.stream());
79 
80  // bundle up conditions
82 
83  // event data
85  event.getByToken(rawDataToken_, rawDataHandle);
86 
87  // scratch
88  ecal::raw::ScratchDataGPU scratchGPU = {cms::cuda::make_device_unique<uint32_t[]>(2, ctx.stream())};
89 
90  // make a first iteration over the FEDs to compute the total buffer size
91  uint32_t size = 0;
92  uint32_t feds = 0;
93  for (auto const& fed : fedsToUnpack_) {
94  auto const& data = rawDataHandle->FEDData(fed);
95  auto const nbytes = data.size();
96 
97  // skip empty FEDs
98  if (nbytes < globalFieds::EMPTYEVENTSIZE)
99  continue;
100 
101  size += nbytes;
102  ++feds;
103  }
104 
105  // input cpu data
106  ecal::raw::InputDataCPU inputCPU = {cms::cuda::make_host_unique<unsigned char[]>(size, ctx.stream()),
107  cms::cuda::make_host_unique<uint32_t[]>(feds, ctx.stream()),
108  cms::cuda::make_host_unique<int[]>(feds, ctx.stream())};
109 
110  // input data gpu
111  ecal::raw::InputDataGPU inputGPU = {cms::cuda::make_device_unique<unsigned char[]>(size, ctx.stream()),
112  cms::cuda::make_device_unique<uint32_t[]>(feds, ctx.stream()),
113  cms::cuda::make_device_unique<int[]>(feds, ctx.stream())};
114 
115  // output cpu
116  outputCPU_ = {cms::cuda::make_host_unique<uint32_t[]>(2, ctx.stream())};
117  // initialize the number of channels
118  outputCPU_.nchannels[0] = 0;
119  outputCPU_.nchannels[1] = 0;
120 
121  // output gpu
122  outputGPU_.allocate(config_, ctx.stream());
123 
124  // iterate over FEDs to fill the cpu buffer
125  uint32_t currentCummOffset = 0;
126  uint32_t counter = 0;
127  for (auto const& fed : fedsToUnpack_) {
128  auto const& data = rawDataHandle->FEDData(fed);
129  auto const nbytes = data.size();
130 
131  // skip empty FEDs
132  if (nbytes < globalFieds::EMPTYEVENTSIZE)
133  continue;
134 
135  // copy raw data into plain buffer
136  std::memcpy(inputCPU.data.get() + currentCummOffset, data.data(), nbytes);
137  // set the offset in bytes from the start
138  inputCPU.offsets[counter] = currentCummOffset;
139  inputCPU.feds[counter] = fed;
140 
141  // this is the current offset into the vector
142  currentCummOffset += nbytes;
143  ++counter;
144  }
145  assert(currentCummOffset == size);
146  assert(counter == feds);
147 
148  // unpack if at least one FED has data
149  if (counter > 0) {
151  inputCPU, inputGPU, outputGPU_, scratchGPU, outputCPU_, conditions, ctx.stream(), counter, currentCummOffset);
152  }
153 }
size
Write out results.
void entryPoint(InputDataCPU const &, InputDataGPU &, OutputDataGPU &, ScratchDataGPU &, OutputDataCPU &, ConditionsProducts const &, cudaStream_t, uint32_t const, uint32_t const)
edm::ESGetToken< ecal::raw::ElectronicsMappingGPU, EcalMappingElectronicsRcd > eMappingToken_
host::impl::make_host_unique_selector< T >::non_array make_host_unique()
std::vector< int > fedsToUnpack_
cms::cuda::host::unique_ptr< unsigned char[]> data
assert(be >=bs)
ecal::raw::OutputDataGPU outputGPU_
ecal::raw::ConfigurationParameters config_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
cms::cuda::ContextState cudaState_
ecal::raw::OutputDataCPU outputCPU_
cms::cuda::host::unique_ptr< uint32_t[]> offsets
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static std::atomic< unsigned int > counter
cms::cuda::host::unique_ptr< int[]> feds
cms::cuda::host::unique_ptr< uint32_t[]> nchannels
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
device::impl::make_device_unique_selector< T >::non_array make_device_unique(cudaStream_t stream)
void allocate(ConfigurationParameters const &config, cudaStream_t cudaStream)
Product const & getProduct(cudaStream_t) const
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

void EcalRawToDigiGPU::fillDescriptions ( edm::ConfigurationDescriptions confDesc)
static

Definition at line 43 of file EcalRawToDigiGPU.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, l1tstage2emulator_dqm_sourceclient-live_cfg::feds, mps_fire::i, HLT_2022v15_cff::InputTag, label, and AlCaHLTBitMon_QueryRunRegistry::string.

43  {
45 
46  desc.add<edm::InputTag>("InputLabel", edm::InputTag("rawDataCollector"));
47  std::vector<int> feds(54);
48  for (uint32_t i = 0; i < 54; ++i)
49  feds[i] = i + 601;
50  desc.add<std::vector<int>>("FEDs", feds);
51  desc.add<uint32_t>("maxChannelsEB", 61200);
52  desc.add<uint32_t>("maxChannelsEE", 14648);
53  desc.add<std::string>("digisLabelEB", "ebDigis");
54  desc.add<std::string>("digisLabelEE", "eeDigis");
55 
56  std::string label = "ecalRawToDigiGPU";
57  confDesc.add(label, desc);
58 }
char const * label
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void EcalRawToDigiGPU::produce ( edm::Event event,
edm::EventSetup const &  setup 
)
overrideprivate

Definition at line 155 of file EcalRawToDigiGPU.cc.

References cudaState_, ecal::raw::OutputDataGPU::digisEB, digisEBToken_, ecal::raw::OutputDataGPU::digisEE, digisEEToken_, eostools::move(), ecal::raw::OutputDataCPU::nchannels, outputCPU_, and outputGPU_.

155  {
157 
158  // get the number of channels
161 
164 
165  // reset ptrs that are carried as members
166  outputCPU_.nchannels.reset();
167 }
edm::EDPutTokenT< OutputProduct > digisEEToken_
ecal::raw::OutputDataGPU outputGPU_
cms::cuda::ContextState cudaState_
ecal::raw::OutputDataCPU outputCPU_
DigisCollection<::calo::common::DevStoragePolicy > digisEE
DigisCollection<::calo::common::DevStoragePolicy > digisEB
cms::cuda::host::unique_ptr< uint32_t[]> nchannels
edm::EDPutTokenT< OutputProduct > digisEBToken_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ config_

ecal::raw::ConfigurationParameters EcalRawToDigiGPU::config_
private

Definition at line 38 of file EcalRawToDigiGPU.cc.

Referenced by acquire().

◆ cudaState_

cms::cuda::ContextState EcalRawToDigiGPU::cudaState_
private

Definition at line 34 of file EcalRawToDigiGPU.cc.

Referenced by acquire(), and produce().

◆ digisEBToken_

edm::EDPutTokenT<OutputProduct> EcalRawToDigiGPU::digisEBToken_
private

Definition at line 31 of file EcalRawToDigiGPU.cc.

Referenced by produce().

◆ digisEEToken_

edm::EDPutTokenT<OutputProduct> EcalRawToDigiGPU::digisEEToken_
private

Definition at line 31 of file EcalRawToDigiGPU.cc.

Referenced by produce().

◆ eMappingToken_

Definition at line 32 of file EcalRawToDigiGPU.cc.

Referenced by acquire().

◆ fedsToUnpack_

std::vector<int> EcalRawToDigiGPU::fedsToUnpack_
private

Definition at line 36 of file EcalRawToDigiGPU.cc.

Referenced by acquire().

◆ outputCPU_

ecal::raw::OutputDataCPU EcalRawToDigiGPU::outputCPU_
private

Definition at line 40 of file EcalRawToDigiGPU.cc.

Referenced by acquire(), and produce().

◆ outputGPU_

ecal::raw::OutputDataGPU EcalRawToDigiGPU::outputGPU_
private

Definition at line 39 of file EcalRawToDigiGPU.cc.

Referenced by acquire(), and produce().

◆ rawDataToken_

edm::EDGetTokenT<FEDRawDataCollection> EcalRawToDigiGPU::rawDataToken_
private

Definition at line 29 of file EcalRawToDigiGPU.cc.

Referenced by acquire().