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
 
- 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.

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 }

References edm::ParameterSet::getParameter().

◆ ~EcalRawToDigiGPU()

EcalRawToDigiGPU::~EcalRawToDigiGPU ( )
override

Definition at line 70 of file EcalRawToDigiGPU.cc.

70 {}

Member Function Documentation

◆ acquire()

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

Definition at line 72 of file EcalRawToDigiGPU.cc.

74  {
75  // raii
76  cms::cuda::ScopedContextAcquire ctx{event.streamID(), std::move(holder), cudaState_};
77 
78  // conditions
80  auto const& eMappingProduct = eMappingHandle->getProduct(ctx.stream());
81 
82  // bundle up conditions
84 
85  // event data
87  event.getByToken(rawDataToken_, rawDataHandle);
88 
89  // scratch
90  ecal::raw::ScratchDataGPU scratchGPU = {cms::cuda::make_device_unique<uint32_t[]>(2, ctx.stream())};
91 
92  // input cpu data
93  ecal::raw::InputDataCPU inputCPU = {
94  cms::cuda::make_host_unique<unsigned char[]>(ecal::raw::nfeds_max * ecal::raw::nbytes_per_fed_max, ctx.stream()),
95  cms::cuda::make_host_unique<uint32_t[]>(ecal::raw::nfeds_max, ctx.stream()),
97 
98  // input data gpu
99  ecal::raw::InputDataGPU inputGPU = {cms::cuda::make_device_unique<unsigned char[]>(
101  cms::cuda::make_device_unique<uint32_t[]>(ecal::raw::nfeds_max, ctx.stream()),
103 
104  // output cpu
105  outputCPU_ = {cms::cuda::make_host_unique<uint32_t[]>(2, ctx.stream())};
106  // initialize the number of channels
107  outputCPU_.nchannels[0] = 0;
108  outputCPU_.nchannels[1] = 0;
109 
110  // output gpu
111  outputGPU_.allocate(config_, ctx.stream());
112 
113  // iterate over feds
114  // TODO: another idea
115  // - loop over all feds to unpack and enqueue cuda memcpy
116  // - accumulate the sizes
117  // - after the loop launch cuda memcpy for sizes
118  // - enqueue the kernel
119  uint32_t currentCummOffset = 0;
120  uint32_t counter = 0;
121  for (auto const& fed : fedsToUnpack_) {
122  auto const& data = rawDataHandle->FEDData(fed);
123  auto const nbytes = data.size();
124 
125  // skip empty feds
126  if (nbytes < ecal::raw::empty_event_size)
127  continue;
128 
129  // copy raw data into plain buffer
130  std::memcpy(inputCPU.data.get() + currentCummOffset, data.data(), nbytes);
131  // set the offset in bytes from the start
132  inputCPU.offsets[counter] = currentCummOffset;
133  inputCPU.feds[counter] = fed;
134 
135  // this is the current offset into the vector
136  currentCummOffset += nbytes;
137  ++counter;
138  }
139 
140  // unpack if at least one FED has data
141  if (counter > 0) {
143  inputCPU, inputGPU, outputGPU_, scratchGPU, outputCPU_, conditions, ctx.stream(), counter, currentCummOffset);
144  }
145 }

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

◆ fillDescriptions()

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

Definition at line 43 of file EcalRawToDigiGPU.cc.

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 }

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

◆ produce()

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

Definition at line 147 of file EcalRawToDigiGPU.cc.

147  {
149 
150  // get the number of channels
153 
156 
157  // reset ptrs that are carried as members
158  outputCPU_.nchannels.reset();
159 }

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

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().

l1tstage2emulator_dqm_sourceclient-live_cfg.feds
feds
Definition: l1tstage2emulator_dqm_sourceclient-live_cfg.py:153
counter
Definition: counter.py:1
EcalRawToDigiGPU::digisEBToken_
edm::EDPutTokenT< OutputProduct > digisEBToken_
Definition: EcalRawToDigiGPU.cc:31
mps_fire.i
i
Definition: mps_fire.py:428
EcalRawToDigiGPU::rawDataToken_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
Definition: EcalRawToDigiGPU.cc:29
cms::cuda::ScopedContextProduce
Definition: ScopedContext.h:149
cms::cuda::make_device_unique
device::impl::make_device_unique_selector< T >::non_array make_device_unique(cudaStream_t stream)
Definition: device_unique_ptr.h:52
ecal::raw::nbytes_per_fed_max
constexpr uint32_t nbytes_per_fed_max
Definition: DeclsForKernels.h:20
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EcalRawToDigiGPU::digisEEToken_
edm::EDPutTokenT< OutputProduct > digisEEToken_
Definition: EcalRawToDigiGPU.cc:31
EcalRawToDigiGPU::fedsToUnpack_
std::vector< int > fedsToUnpack_
Definition: EcalRawToDigiGPU.cc:36
ecal::raw::ElectronicsMappingGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: ElectronicsMappingGPU.cc:32
edm::Handle< FEDRawDataCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
ecal::raw::ConfigurationParameters::maxChannelsEB
uint32_t maxChannelsEB
Definition: DeclsForKernels.h:30
ecal::raw::entryPoint
void entryPoint(InputDataCPU const &, InputDataGPU &, OutputDataGPU &, ScratchDataGPU &, OutputDataCPU &, ConditionsProducts const &, cudaStream_t, uint32_t const, uint32_t const)
edm::ESHandle
Definition: DTSurvey.h:22
EcalRawToDigiGPU::eMappingToken_
edm::ESGetToken< ecal::raw::ElectronicsMappingGPU, EcalMappingElectronicsRcd > eMappingToken_
Definition: EcalRawToDigiGPU.cc:32
EcalRawToDigiGPU::config_
ecal::raw::ConfigurationParameters config_
Definition: EcalRawToDigiGPU.cc:38
ecal::raw::ScratchDataGPU
Definition: DeclsForKernels.h:51
ecal::raw::nfeds_max
constexpr uint32_t nfeds_max
Definition: DeclsForKernels.h:19
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
ecal::raw::OutputDataGPU::digisEE
DigisCollection<::calo::common::DevStoragePolicy > digisEE
Definition: DeclsForKernels.h:39
ecal::raw::InputDataCPU::feds
cms::cuda::host::unique_ptr< int[]> feds
Definition: DeclsForKernels.h:25
ecal::raw::InputDataCPU::offsets
cms::cuda::host::unique_ptr< uint32_t[]> offsets
Definition: DeclsForKernels.h:24
ecal::raw::ConfigurationParameters::maxChannelsEE
uint32_t maxChannelsEE
Definition: DeclsForKernels.h:29
EcalRawToDigiGPU::outputGPU_
ecal::raw::OutputDataGPU outputGPU_
Definition: EcalRawToDigiGPU.cc:39
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:18
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::cuda::ScopedContextAcquire
Definition: ScopedContext.h:101
ecal::raw::InputDataCPU
Definition: DeclsForKernels.h:22
ecal::raw::InputDataGPU
Definition: DeclsForKernels.h:57
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
eostools.move
def move(src, dest)
Definition: eostools.py:511
ecal::raw::OutputDataGPU::digisEB
DigisCollection<::calo::common::DevStoragePolicy > digisEB
Definition: DeclsForKernels.h:39
ecal::raw::OutputDataCPU::nchannels
cms::cuda::host::unique_ptr< uint32_t[]> nchannels
Definition: DeclsForKernels.h:35
EcalRawToDigiGPU::outputCPU_
ecal::raw::OutputDataCPU outputCPU_
Definition: EcalRawToDigiGPU.cc:40
ecal::raw::OutputDataGPU::allocate
void allocate(ConfigurationParameters const &config, cudaStream_t cudaStream)
Definition: DeclsForKernels.h:41
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
ecal::raw::ConditionsProducts
Definition: DeclsForKernels.h:63
ecal::raw::empty_event_size
constexpr auto empty_event_size
Definition: DeclsForKernels.h:18
cms::cuda::make_host_unique
host::impl::make_host_unique_selector< T >::non_array make_host_unique(cudaStream_t stream)
Definition: host_unique_ptr.h:41
ecal::raw::InputDataCPU::data
cms::cuda::host::unique_ptr< unsigned char[]> data
Definition: DeclsForKernels.h:23
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
EcalRawToDigiGPU::cudaState_
cms::cuda::ContextState cudaState_
Definition: EcalRawToDigiGPU.cc:34