CMS 3D CMS Logo

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

Public Member Functions

 EcalUncalibRecHitPhase2WeightsProducerGPU (edm::ParameterSet const &ps)
 
 ~EcalUncalibRecHitPhase2WeightsProducerGPU () 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 InputProduct = cms::cuda::Product< ecal::DigisCollection< calo::common::DevStoragePolicy > >
 
using OutputProduct = cms::cuda::Product< ecal::UncalibratedRecHit< 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

cms::cuda::ContextState cudaState_
 
const edm::EDGetTokenT< InputProductdigisToken_
 
ecal::weights::EventOutputDataGPU eventOutputDataGPU_
 
const edm::EDPutTokenT< OutputProductrecHitsToken_
 
uint32_t size_
 
const std::vector< double, cms::cuda::HostAllocator< double > > weights_
 

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 14 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

Member Typedef Documentation

◆ InputProduct

Definition at line 27 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

◆ OutputProduct

Definition at line 29 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

Constructor & Destructor Documentation

◆ EcalUncalibRecHitPhase2WeightsProducerGPU()

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

Definition at line 41 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

References createJobs::tmp.

42  : // use lambda to initialise the vector with CUDA::HostAllocator from a normal vector
43  weights_([tmp = ps.getParameter<std::vector<double>>("weights")] {
44  return std::vector<double, cms::cuda::HostAllocator<double>>(tmp.begin(), tmp.end());
45  }()),
46  digisToken_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("digisLabelEB"))},
47  recHitsToken_{produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEB"))} {}
const std::vector< double, cms::cuda::HostAllocator< double > > weights_
tmp
align.sh
Definition: createJobs.py:716

◆ ~EcalUncalibRecHitPhase2WeightsProducerGPU()

EcalUncalibRecHitPhase2WeightsProducerGPU::~EcalUncalibRecHitPhase2WeightsProducerGPU ( )
overridedefault

Member Function Documentation

◆ acquire()

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

Definition at line 78 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

References ecal::weights::EventOutputDataGPU::allocate(), cudaCheck, cudaState_, digisToken_, eventOutputDataGPU_, EcalDataFrame_Ph2::MAXSAMPLES, eostools::move(), ecal::weights::phase2Weights(), size_, and weights_.

80  {
81  // cuda products
82  auto const &digisProduct = event.get(digisToken_);
83  // raii
84  cms::cuda::ScopedContextAcquire ctx{digisProduct, std::move(holder), cudaState_};
85 
86  // get actual obj
87  auto const &digis = ctx.get(digisProduct);
88 
89  size_ = digis.size;
90 
91  // if no digis stop here
92  if (size_ == 0)
93  return;
94 
95  auto weights_d = cms::cuda::make_device_unique<double[]>(EcalDataFrame_Ph2::MAXSAMPLES, ctx.stream());
96 
97  cudaCheck(cudaMemcpyAsync(weights_d.get(),
98  weights_.data(),
99  EcalDataFrame_Ph2::MAXSAMPLES * sizeof(double),
100  cudaMemcpyHostToDevice,
101  ctx.stream()));
102 
103  // output on GPU
104  eventOutputDataGPU_.allocate(size_, ctx.stream());
105 
106  ecal::weights::phase2Weights(digis, eventOutputDataGPU_, weights_d, ctx.stream());
107 }
const std::vector< double, cms::cuda::HostAllocator< double > > weights_
void phase2Weights(ecal::DigisCollection< calo::common::DevStoragePolicy > const &, EventOutputDataGPU &, cms::cuda::device::unique_ptr< double[]> &, cudaStream_t)
static constexpr int MAXSAMPLES
void allocate(uint32_t digi_size, cudaStream_t cudaStream)
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

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

Definition at line 49 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, HLT_2022v14_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

49  {
51 
52  desc.add<std::string>("recHitsLabelEB", "EcalUncalibRecHitsEB");
53  //The below weights values should be kept up to date with those on the CPU version of this module
54  desc.add<std::vector<double>>("weights",
55  {-0.121016,
56  -0.119899,
57  -0.120923,
58  -0.0848959,
59  0.261041,
60  0.509881,
61  0.373591,
62  0.134899,
63  -0.0233605,
64  -0.0913195,
65  -0.112452,
66  -0.118596,
67  -0.121737,
68  -0.121737,
69  -0.121737,
70  -0.121737});
71 
72  desc.add<edm::InputTag>("digisLabelEB", edm::InputTag("simEcalUnsuppressedDigis", ""));
73 
74  descriptions.addWithDefaultLabel(desc);
75 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Member Data Documentation

◆ cudaState_

cms::cuda::ContextState EcalUncalibRecHitPhase2WeightsProducerGPU::cudaState_
private

Definition at line 35 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

Referenced by acquire(), and produce().

◆ digisToken_

const edm::EDGetTokenT<InputProduct> EcalUncalibRecHitPhase2WeightsProducerGPU::digisToken_
private

Definition at line 28 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

Referenced by acquire().

◆ eventOutputDataGPU_

ecal::weights::EventOutputDataGPU EcalUncalibRecHitPhase2WeightsProducerGPU::eventOutputDataGPU_
private

Definition at line 33 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

Referenced by acquire(), and produce().

◆ recHitsToken_

const edm::EDPutTokenT<OutputProduct> EcalUncalibRecHitPhase2WeightsProducerGPU::recHitsToken_
private

Definition at line 30 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

Referenced by produce().

◆ size_

uint32_t EcalUncalibRecHitPhase2WeightsProducerGPU::size_
private

Definition at line 37 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

Referenced by acquire(), and produce().

◆ weights_

const std::vector<double, cms::cuda::HostAllocator<double> > EcalUncalibRecHitPhase2WeightsProducerGPU::weights_
private

Definition at line 25 of file EcalUncalibRecHitPhase2WeightsProducerGPU.cc.

Referenced by acquire().