CMS 3D CMS Logo

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

Public Member Functions

 SiStripClusterizerFromRawGPU (const edm::ParameterSet &conf)
 
- 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 Member Functions

void acquire (edm::Event const &ev, edm::EventSetup const &es, edm::WaitingTaskWithArenaHolder waitingTaskHolder) override
 
void fill (uint32_t idet, const FEDRawDataCollection &rawColl, const SiStripClusterizerConditions &conditions)
 
void produce (edm::Event &ev, const edm::EventSetup &es) override
 
void run (const FEDRawDataCollection &rawColl, const SiStripClusterizerConditions &conditions)
 

Private Attributes

std::vector< std::unique_ptr< sistrip::FEDBuffer > > buffers_
 
edm::ESGetToken< stripgpu::SiStripClusterizerConditionsGPU, SiStripClusterizerConditionsRcdconditionsToken_
 
edm::ESGetToken< SiStripClusterizerConditions, SiStripClusterizerConditionsRcdcpuConditionsToken_
 
cms::cuda::ContextState ctxState_
 
stripgpu::SiStripRawToClusterGPUKernel gpuAlgo_
 
edm::EDGetTokenT< FEDRawDataCollectioninputToken_
 
edm::EDPutTokenT< cms::cuda::Product< SiStripClustersCUDADevice > > outputToken_
 
std::vector< const FEDRawData * > raw_
 

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 64 of file ClustersFromRawProducerGPU.cc.

Constructor & Destructor Documentation

◆ SiStripClusterizerFromRawGPU()

SiStripClusterizerFromRawGPU::SiStripClusterizerFromRawGPU ( const edm::ParameterSet conf)
inlineexplicit

Definition at line 66 of file ClustersFromRawProducerGPU.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

69  gpuAlgo_(conf.getParameter<edm::ParameterSet>("Clusterizer")),
70  inputToken_(consumes(conf.getParameter<edm::InputTag>("ProductLabel"))),
72  conditionsToken_(esConsumes(edm::ESInputTag{"", conf.getParameter<std::string>("ConditionsLabel")})),
73  cpuConditionsToken_(esConsumes(edm::ESInputTag{"", conf.getParameter<std::string>("ConditionsLabel")})) {}
std::vector< const FEDRawData * > raw_
edm::ESGetToken< stripgpu::SiStripClusterizerConditionsGPU, SiStripClusterizerConditionsRcd > conditionsToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< FEDRawDataCollection > inputToken_
std::vector< std::unique_ptr< sistrip::FEDBuffer > > buffers_
edm::EDPutTokenT< cms::cuda::Product< SiStripClustersCUDADevice > > outputToken_
stripgpu::SiStripRawToClusterGPUKernel gpuAlgo_
edm::ESGetToken< SiStripClusterizerConditions, SiStripClusterizerConditionsRcd > cpuConditionsToken_
static const uint16_t FED_ID_MAX

Member Function Documentation

◆ acquire()

void SiStripClusterizerFromRawGPU::acquire ( edm::Event const &  ev,
edm::EventSetup const &  es,
edm::WaitingTaskWithArenaHolder  waitingTaskHolder 
)
inlineoverrideprivate

Definition at line 78 of file ClustersFromRawProducerGPU.cc.

References buffers_, submitPVValidationJobs::conditions, conditionsToken_, cpuConditionsToken_, ctxState_, makeMEIFBenchmarkPlots::ev, edm::EventSetup::getData(), gpuAlgo_, inputToken_, stripgpu::SiStripRawToClusterGPUKernel::makeAsync(), eostools::move(), raw_, l1tstage2_dqm_sourceclient-live_cfg::rawData, and run().

80  {
81  const auto& conditions = es.getData(conditionsToken_); //these need to be GPU conditions
82  const auto& cpuConditions = es.getData(cpuConditionsToken_); //CPU conditions
83 
84  // Sets the current device and creates a CUDA stream
85  cms::cuda::ScopedContextAcquire ctx{ev.streamID(), std::move(waitingTaskHolder), ctxState_};
86 
87  // get raw data
88  auto const& rawData = ev.get(inputToken_);
89  run(rawData, cpuConditions);
90 
91  // Queues asynchronous data transfers and kernels to the CUDA stream
92  // returned by cms::cuda::ScopedContextAcquire::stream()
93  gpuAlgo_.makeAsync(raw_, buffers_, conditions, ctx.stream());
94 
95  // Destructor of ctx queues a callback to the CUDA stream notifying
96  // waitingTaskHolder when the queued asynchronous work has finished
97  }
std::vector< const FEDRawData * > raw_
edm::ESGetToken< stripgpu::SiStripClusterizerConditionsGPU, SiStripClusterizerConditionsRcd > conditionsToken_
edm::EDGetTokenT< FEDRawDataCollection > inputToken_
std::vector< std::unique_ptr< sistrip::FEDBuffer > > buffers_
void makeAsync(const std::vector< const FEDRawData *> &rawdata, const std::vector< std::unique_ptr< sistrip::FEDBuffer >> &buffers, const SiStripClusterizerConditionsGPU &conditions, cudaStream_t stream)
stripgpu::SiStripRawToClusterGPUKernel gpuAlgo_
edm::ESGetToken< SiStripClusterizerConditions, SiStripClusterizerConditionsRcd > cpuConditionsToken_
void run(const FEDRawDataCollection &rawColl, const SiStripClusterizerConditions &conditions)
def move(src, dest)
Definition: eostools.py:511

◆ fill()

void SiStripClusterizerFromRawGPU::fill ( uint32_t  idet,
const FEDRawDataCollection rawColl,
const SiStripClusterizerConditions conditions 
)
private

Definition at line 151 of file ClustersFromRawProducerGPU.cc.

References edmScanValgrind::buffer, buffers_, submitPVValidationJobs::conditions, getInfo::conn, FEDRawDataCollection::FEDData(), l1tstage2_dqm_sourceclient-live_cfg::fedId, raw_, l1tstage2_dqm_sourceclient-live_cfg::rawData, and UNLIKELY.

Referenced by run().

153  {
154  auto const& det = conditions.findDetId(idet);
155  if (!det.valid())
156  return;
157 
158  // Loop over apv-pairs of det
159  for (auto const conn : conditions.currentConnection(det)) {
160  if UNLIKELY (!conn)
161  continue;
162 
163  const uint16_t fedId = conn->fedId();
164 
165  // If fed id is null or connection is invalid continue
166  if UNLIKELY (!fedId || !conn->isConnected()) {
167  continue;
168  }
169 
170  // If Fed hasnt already been initialised, extract data and initialise
172  if (!buffer) {
173  const FEDRawData& rawData = rawColl.FEDData(fedId);
174  raw_[fedId] = &rawData;
175  buffers_[fedId] = fillBuffer(fedId, rawData);
176  }
177  } // end loop over conn
178 }
std::vector< const FEDRawData * > raw_
std::vector< std::unique_ptr< sistrip::FEDBuffer > > buffers_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
conn
Definition: getInfo.py:9
#define UNLIKELY(x)
Definition: Likely.h:21

◆ fillDescriptions()

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

◆ produce()

void SiStripClusterizerFromRawGPU::produce ( edm::Event ev,
const edm::EventSetup es 
)
inlineoverrideprivate

Definition at line 99 of file ClustersFromRawProducerGPU.cc.

References visDQMUpload::buf, buffers_, ctxState_, makeMEIFBenchmarkPlots::ev, stripgpu::SiStripRawToClusterGPUKernel::getResults(), gpuAlgo_, and outputToken_.

99  {
101 
102  // Now getResult() returns data in GPU memory that is passed to the
103  // constructor of OutputData. cms::cuda::ScopedContextProduce::emplace() wraps the
104  // OutputData to cms::cuda::Product<OutputData>. cms::cuda::Product<T> stores also
105  // the current device and the CUDA stream since those will be needed
106  // in the consumer side.
107  ctx.emplace(ev, outputToken_, gpuAlgo_.getResults(ctx.stream()));
108 
109  for (auto& buf : buffers_)
110  buf.reset(nullptr);
111  }
std::vector< std::unique_ptr< sistrip::FEDBuffer > > buffers_
edm::EDPutTokenT< cms::cuda::Product< SiStripClustersCUDADevice > > outputToken_
SiStripClustersCUDADevice getResults(cudaStream_t stream)
stripgpu::SiStripRawToClusterGPUKernel gpuAlgo_

◆ run()

void SiStripClusterizerFromRawGPU::run ( const FEDRawDataCollection rawColl,
const SiStripClusterizerConditions conditions 
)
private

Definition at line 143 of file ClustersFromRawProducerGPU.cc.

References submitPVValidationJobs::conditions, and fill().

Referenced by acquire().

144  {
145  // loop over good det in cabling
146  for (auto idet : conditions.allDetIds()) {
147  fill(idet, rawColl, conditions);
148  } // end loop over dets
149 }
void fill(uint32_t idet, const FEDRawDataCollection &rawColl, const SiStripClusterizerConditions &conditions)

Member Data Documentation

◆ buffers_

std::vector<std::unique_ptr<sistrip::FEDBuffer> > SiStripClusterizerFromRawGPU::buffers_
private

Definition at line 118 of file ClustersFromRawProducerGPU.cc.

Referenced by acquire(), fill(), and produce().

◆ conditionsToken_

edm::ESGetToken<stripgpu::SiStripClusterizerConditionsGPU, SiStripClusterizerConditionsRcd> SiStripClusterizerFromRawGPU::conditionsToken_
private

Definition at line 126 of file ClustersFromRawProducerGPU.cc.

Referenced by acquire().

◆ cpuConditionsToken_

edm::ESGetToken<SiStripClusterizerConditions, SiStripClusterizerConditionsRcd> SiStripClusterizerFromRawGPU::cpuConditionsToken_
private

Definition at line 127 of file ClustersFromRawProducerGPU.cc.

Referenced by acquire().

◆ ctxState_

cms::cuda::ContextState SiStripClusterizerFromRawGPU::ctxState_
private

Definition at line 120 of file ClustersFromRawProducerGPU.cc.

Referenced by acquire(), and produce().

◆ gpuAlgo_

stripgpu::SiStripRawToClusterGPUKernel SiStripClusterizerFromRawGPU::gpuAlgo_
private

Definition at line 122 of file ClustersFromRawProducerGPU.cc.

Referenced by acquire(), and produce().

◆ inputToken_

edm::EDGetTokenT<FEDRawDataCollection> SiStripClusterizerFromRawGPU::inputToken_
private

Definition at line 124 of file ClustersFromRawProducerGPU.cc.

Referenced by acquire().

◆ outputToken_

edm::EDPutTokenT<cms::cuda::Product<SiStripClustersCUDADevice> > SiStripClusterizerFromRawGPU::outputToken_
private

Definition at line 125 of file ClustersFromRawProducerGPU.cc.

Referenced by produce().

◆ raw_

std::vector<const FEDRawData*> SiStripClusterizerFromRawGPU::raw_
private

Definition at line 119 of file ClustersFromRawProducerGPU.cc.

Referenced by acquire(), and fill().