CMS 3D CMS Logo

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

Public Member Functions

 SiPixelDigisSoAFromCUDA (const edm::ParameterSet &iConfig)
 
 ~SiPixelDigisSoAFromCUDA () 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 Member Functions

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

Private Attributes

edm::EDGetTokenT< cms::cuda::Product< SiPixelDigisCUDA > > digiGetToken_
 
edm::EDPutTokenT< SiPixelDigisSoAdigiPutToken_
 
int nDigis_
 
cms::cuda::host::unique_ptr< uint16_t[]> store_
 

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

Constructor & Destructor Documentation

◆ SiPixelDigisSoAFromCUDA()

SiPixelDigisSoAFromCUDA::SiPixelDigisSoAFromCUDA ( const edm::ParameterSet iConfig)
explicit

Definition at line 35 of file SiPixelDigisSoAFromCUDA.cc.

37  digiPutToken_(produces<SiPixelDigisSoA>()) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDPutTokenT< SiPixelDigisSoA > digiPutToken_
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigisCUDA > > digiGetToken_

◆ ~SiPixelDigisSoAFromCUDA()

SiPixelDigisSoAFromCUDA::~SiPixelDigisSoAFromCUDA ( )
overridedefault

Member Function Documentation

◆ acquire()

void SiPixelDigisSoAFromCUDA::acquire ( const edm::Event iEvent,
const edm::EventSetup iSetup,
edm::WaitingTaskWithArenaHolder  waitingTaskHolder 
)
overrideprivate

Definition at line 45 of file SiPixelDigisSoAFromCUDA.cc.

References digiGetToken_, iEvent, eostools::move(), nDigis_, and store_.

47  {
48  // Do the transfer in a CUDA stream parallel to the computation CUDA stream
49  cms::cuda::ScopedContextAcquire ctx{iEvent.streamID(), std::move(waitingTaskHolder)};
50 
51  const auto& gpuDigis = ctx.get(iEvent, digiGetToken_);
52 
53  nDigis_ = gpuDigis.nDigis();
54  store_ = gpuDigis.copyAllToHostAsync(ctx.stream());
55 }
int iEvent
Definition: GenABIO.cc:224
cms::cuda::host::unique_ptr< uint16_t[]> store_
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigisCUDA > > digiGetToken_
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

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

◆ produce()

void SiPixelDigisSoAFromCUDA::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 57 of file SiPixelDigisSoAFromCUDA.cc.

References digiPutToken_, iEvent, SiPixelDigisCUDASOAView::kMAX, nDigis_, and store_.

57  {
58  // The following line copies the data from the pinned host memory to
59  // regular host memory. In principle that feels unnecessary (why not
60  // just use the pinned host memory?). There are a few arguments for
61  // doing it though
62  // - Now can release the pinned host memory back to the (caching) allocator
63  // * if we'd like to keep the pinned memory, we'd need to also
64  // keep the CUDA stream around as long as that, or allow pinned
65  // host memory to be allocated without a CUDA stream
66  // - What if a CPU algorithm would produce the same SoA? We can't
67  // use cudaMallocHost without a GPU...
68 
70 
71  iEvent.emplace(digiPutToken_, nDigis_, tmp_view.pdigi(), tmp_view.rawIdArr(), tmp_view.adc(), tmp_view.clus());
72 
73  store_.reset();
74 }
edm::EDPutTokenT< SiPixelDigisSoA > digiPutToken_
int iEvent
Definition: GenABIO.cc:224
cms::cuda::host::unique_ptr< uint16_t[]> store_

Member Data Documentation

◆ digiGetToken_

edm::EDGetTokenT<cms::cuda::Product<SiPixelDigisCUDA> > SiPixelDigisSoAFromCUDA::digiGetToken_
private

Definition at line 27 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire().

◆ digiPutToken_

edm::EDPutTokenT<SiPixelDigisSoA> SiPixelDigisSoAFromCUDA::digiPutToken_
private

Definition at line 28 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by produce().

◆ nDigis_

int SiPixelDigisSoAFromCUDA::nDigis_
private

Definition at line 32 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

◆ store_

cms::cuda::host::unique_ptr<uint16_t[]> SiPixelDigisSoAFromCUDA::store_
private

Definition at line 30 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().