CMS 3D CMS Logo

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

Public Member Functions

 SiPixelDigiErrorsSoAFromCUDA (const edm::ParameterSet &iConfig)
 
 ~SiPixelDigiErrorsSoAFromCUDA () 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< SiPixelErrorCompact[]> data_
 
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigiErrorsCUDA > > digiErrorGetToken_
 
edm::EDPutTokenT< SiPixelErrorsSoAdigiErrorPutToken_
 
cms::cuda::SimpleVector< SiPixelErrorCompacterror_ = cms::cuda::make_SimpleVector<SiPixelErrorCompact>(0, nullptr)
 
const SiPixelFormatterErrorsformatterErrors_ = nullptr
 

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

Constructor & Destructor Documentation

◆ SiPixelDigiErrorsSoAFromCUDA()

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

Definition at line 35 of file SiPixelDigiErrorsSoAFromCUDA.cc.

38  digiErrorPutToken_(produces<SiPixelErrorsSoA>()) {}
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigiErrorsCUDA > > digiErrorGetToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDPutTokenT< SiPixelErrorsSoA > digiErrorPutToken_

◆ ~SiPixelDigiErrorsSoAFromCUDA()

SiPixelDigiErrorsSoAFromCUDA::~SiPixelDigiErrorsSoAFromCUDA ( )
overridedefault

Member Function Documentation

◆ acquire()

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

Definition at line 46 of file SiPixelDigiErrorsSoAFromCUDA.cc.

References data_, digiErrorGetToken_, error_, formatterErrors_, iEvent, eostools::move(), and createJobs::tmp.

48  {
49  // Do the transfer in a CUDA stream parallel to the computation CUDA stream
50  cms::cuda::ScopedContextAcquire ctx{iEvent.streamID(), std::move(waitingTaskHolder)};
51  const auto& gpuDigiErrors = ctx.get(iEvent, digiErrorGetToken_);
52  formatterErrors_ = &(gpuDigiErrors.formatterErrors());
53 
54  if (gpuDigiErrors.nErrorWords() == 0)
55  return;
56 
57  auto tmp = gpuDigiErrors.dataErrorToHostAsync(ctx.stream());
58  error_ = tmp.first;
59  data_ = std::move(tmp.second);
60 }
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigiErrorsCUDA > > digiErrorGetToken_
int iEvent
Definition: GenABIO.cc:224
cms::cuda::SimpleVector< SiPixelErrorCompact > error_
const SiPixelFormatterErrors * formatterErrors_
tmp
align.sh
Definition: createJobs.py:716
def move(src, dest)
Definition: eostools.py:511
cms::cuda::host::unique_ptr< SiPixelErrorCompact[]> data_

◆ fillDescriptions()

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

◆ produce()

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

Definition at line 62 of file SiPixelDigiErrorsSoAFromCUDA.cc.

References cms::cuda::SimpleVector< T >::data(), data_, digiErrorPutToken_, error_, formatterErrors_, iEvent, and cms::cuda::SimpleVector< T >::size().

62  {
63  // The following line copies the data from the pinned host memory to
64  // regular host memory. In principle that feels unnecessary (why not
65  // just use the pinned host memory?). There are a few arguments for
66  // doing it though
67  // - Now can release the pinned host memory back to the (caching) allocator
68  // * if we'd like to keep the pinned memory, we'd need to also
69  // keep the CUDA stream around as long as that, or allow pinned
70  // host memory to be allocated without a CUDA stream
71  // - What if a CPU algorithm would produce the same SoA? We can't
72  // use cudaMallocHost without a GPU...
74  error_ = cms::cuda::make_SimpleVector<SiPixelErrorCompact>(0, nullptr);
75  data_.reset();
76  formatterErrors_ = nullptr;
77 }
edm::EDPutTokenT< SiPixelErrorsSoA > digiErrorPutToken_
constexpr T const * data() const
Definition: SimpleVector.h:111
int iEvent
Definition: GenABIO.cc:224
constexpr int size() const
Definition: SimpleVector.h:109
cms::cuda::SimpleVector< SiPixelErrorCompact > error_
const SiPixelFormatterErrors * formatterErrors_
cms::cuda::host::unique_ptr< SiPixelErrorCompact[]> data_

Member Data Documentation

◆ data_

cms::cuda::host::unique_ptr<SiPixelErrorCompact[]> SiPixelDigiErrorsSoAFromCUDA::data_
private

Definition at line 30 of file SiPixelDigiErrorsSoAFromCUDA.cc.

Referenced by acquire(), and produce().

◆ digiErrorGetToken_

edm::EDGetTokenT<cms::cuda::Product<SiPixelDigiErrorsCUDA> > SiPixelDigiErrorsSoAFromCUDA::digiErrorGetToken_
private

Definition at line 27 of file SiPixelDigiErrorsSoAFromCUDA.cc.

Referenced by acquire().

◆ digiErrorPutToken_

edm::EDPutTokenT<SiPixelErrorsSoA> SiPixelDigiErrorsSoAFromCUDA::digiErrorPutToken_
private

Definition at line 28 of file SiPixelDigiErrorsSoAFromCUDA.cc.

Referenced by produce().

◆ error_

cms::cuda::SimpleVector<SiPixelErrorCompact> SiPixelDigiErrorsSoAFromCUDA::error_ = cms::cuda::make_SimpleVector<SiPixelErrorCompact>(0, nullptr)
private

Definition at line 31 of file SiPixelDigiErrorsSoAFromCUDA.cc.

Referenced by acquire(), and produce().

◆ formatterErrors_

const SiPixelFormatterErrors* SiPixelDigiErrorsSoAFromCUDA::formatterErrors_ = nullptr
private

Definition at line 32 of file SiPixelDigiErrorsSoAFromCUDA.cc.

Referenced by acquire(), and produce().