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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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

cms::cuda::host::unique_ptr< uint16_t[]> adc_
 
cms::cuda::host::unique_ptr< int32_t[]> clus_
 
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigisCUDA > > digiGetToken_
 
edm::EDPutTokenT< SiPixelDigisSoAdigiPutToken_
 
int nDigis_
 
cms::cuda::host::unique_ptr< uint32_t[]> pdigi_
 
cms::cuda::host::unique_ptr< uint32_t[]> rawIdArr_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::ExternalWork >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 38 of file SiPixelDigisSoAFromCUDA.cc.

40  digiPutToken_(produces<SiPixelDigisSoA>()) {}

◆ ~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 48 of file SiPixelDigisSoAFromCUDA.cc.

50  {
51  // Do the transfer in a CUDA stream parallel to the computation CUDA stream
52  cms::cuda::ScopedContextAcquire ctx{iEvent.streamID(), std::move(waitingTaskHolder)};
53 
54  const auto& gpuDigis = ctx.get(iEvent, digiGetToken_);
55 
56  nDigis_ = gpuDigis.nDigis();
57  pdigi_ = gpuDigis.pdigiToHostAsync(ctx.stream());
58  rawIdArr_ = gpuDigis.rawIdArrToHostAsync(ctx.stream());
59  adc_ = gpuDigis.adcToHostAsync(ctx.stream());
60  clus_ = gpuDigis.clusToHostAsync(ctx.stream());
61 }

References adc_, clus_, digiGetToken_, iEvent, eostools::move(), nDigis_, pdigi_, and rawIdArr_.

◆ fillDescriptions()

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

◆ produce()

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

Definition at line 63 of file SiPixelDigisSoAFromCUDA.cc.

63  {
64  // The following line copies the data from the pinned host memory to
65  // regular host memory. In principle that feels unnecessary (why not
66  // just use the pinned host memory?). There are a few arguments for
67  // doing it though
68  // - Now can release the pinned host memory back to the (caching) allocator
69  // * if we'd like to keep the pinned memory, we'd need to also
70  // keep the CUDA stream around as long as that, or allow pinned
71  // host memory to be allocated without a CUDA stream
72  // - What if a CPU algorithm would produce the same SoA? We can't
73  // use cudaMallocHost without a GPU...
74  iEvent.emplace(digiPutToken_, nDigis_, pdigi_.get(), rawIdArr_.get(), adc_.get(), clus_.get());
75 
76  pdigi_.reset();
77  rawIdArr_.reset();
78  adc_.reset();
79  clus_.reset();
80 }

References adc_, clus_, digiPutToken_, iEvent, nDigis_, pdigi_, and rawIdArr_.

Member Data Documentation

◆ adc_

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

Definition at line 32 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

◆ clus_

cms::cuda::host::unique_ptr<int32_t[]> SiPixelDigisSoAFromCUDA::clus_
private

Definition at line 33 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

◆ 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 35 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

◆ pdigi_

cms::cuda::host::unique_ptr<uint32_t[]> SiPixelDigisSoAFromCUDA::pdigi_
private

Definition at line 30 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

◆ rawIdArr_

cms::cuda::host::unique_ptr<uint32_t[]> SiPixelDigisSoAFromCUDA::rawIdArr_
private

Definition at line 31 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

SiPixelDigisSoAFromCUDA::adc_
cms::cuda::host::unique_ptr< uint16_t[]> adc_
Definition: SiPixelDigisSoAFromCUDA.cc:32
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SiPixelDigisSoAFromCUDA::pdigi_
cms::cuda::host::unique_ptr< uint32_t[]> pdigi_
Definition: SiPixelDigisSoAFromCUDA.cc:30
SiPixelDigisSoAFromCUDA::digiPutToken_
edm::EDPutTokenT< SiPixelDigisSoA > digiPutToken_
Definition: SiPixelDigisSoAFromCUDA.cc:28
SiPixelDigisSoAFromCUDA::clus_
cms::cuda::host::unique_ptr< int32_t[]> clus_
Definition: SiPixelDigisSoAFromCUDA.cc:33
iEvent
int iEvent
Definition: GenABIO.cc:224
cms::cuda::ScopedContextAcquire
Definition: ScopedContext.h:101
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
cms::cuda::Product
Definition: Product.h:34
SiPixelDigisSoAFromCUDA::rawIdArr_
cms::cuda::host::unique_ptr< uint32_t[]> rawIdArr_
Definition: SiPixelDigisSoAFromCUDA.cc:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiPixelDigisSoAFromCUDA::nDigis_
int nDigis_
Definition: SiPixelDigisSoAFromCUDA.cc:35
SiPixelDigisSoAFromCUDA::digiGetToken_
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigisCUDA > > digiGetToken_
Definition: SiPixelDigisSoAFromCUDA.cc:27
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87