CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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 >
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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 38 of file SiPixelDigisSoAFromCUDA.cc.

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

Member Function Documentation

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

Definition at line 48 of file SiPixelDigisSoAFromCUDA.cc.

References adc_, clus_, digiGetToken_, eostools::move(), nDigis_, pdigi_, rawIdArr_, and edm::Event::streamID().

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 }
cms::cuda::host::unique_ptr< uint32_t[]> pdigi_
cms::cuda::host::unique_ptr< int32_t[]> clus_
def move
Definition: eostools.py:511
cms::cuda::host::unique_ptr< uint32_t[]> rawIdArr_
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigisCUDA > > digiGetToken_
StreamID streamID() const
Definition: Event.h:98
cms::cuda::host::unique_ptr< uint16_t[]> adc_
void SiPixelDigisSoAFromCUDA::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 42 of file SiPixelDigisSoAFromCUDA.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

42  {
44  desc.add<edm::InputTag>("src", edm::InputTag("siPixelClustersCUDA"));
45  descriptions.addWithDefaultLabel(desc);
46 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void SiPixelDigisSoAFromCUDA::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 63 of file SiPixelDigisSoAFromCUDA.cc.

References adc_, clus_, digiPutToken_, edm::Event::emplace(), nDigis_, pdigi_, and rawIdArr_.

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 }
cms::cuda::host::unique_ptr< uint32_t[]> pdigi_
cms::cuda::host::unique_ptr< int32_t[]> clus_
edm::EDPutTokenT< SiPixelDigisSoA > digiPutToken_
cms::cuda::host::unique_ptr< uint32_t[]> rawIdArr_
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
cms::cuda::host::unique_ptr< uint16_t[]> adc_

Member Data Documentation

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

Definition at line 32 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

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

Definition at line 33 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

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

Definition at line 27 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire().

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

Definition at line 28 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by produce().

int SiPixelDigisSoAFromCUDA::nDigis_
private

Definition at line 35 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

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

Definition at line 30 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().

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

Definition at line 31 of file SiPixelDigisSoAFromCUDA.cc.

Referenced by acquire(), and produce().