CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
TestCUDAAnalyzerGPU Class Reference
Inheritance diagram for TestCUDAAnalyzerGPU:
edm::global::EDAnalyzer<> edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::StreamID, edm::Event const &iEvent, edm::EventSetup const &iSetup) const override
 
void endJob () override
 
 TestCUDAAnalyzerGPU (edm::ParameterSet const &iConfig)
 
 ~TestCUDAAnalyzerGPU () override=default
 
- Public Member Functions inherited from edm::global::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::unique_ptr< TestCUDAAnalyzerGPUKernelgpuAlgo_
 
std::string const label_
 
double const maxValue_
 
double const minValue_
 
edm::EDGetTokenT< cms::cuda::Product< cms::cudatest::Thing > > const srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 17 of file TestCUDAAnalyzerGPU.cc.

Constructor & Destructor Documentation

◆ TestCUDAAnalyzerGPU()

TestCUDAAnalyzerGPU::TestCUDAAnalyzerGPU ( edm::ParameterSet const &  iConfig)
explicit

Definition at line 36 of file TestCUDAAnalyzerGPU.cc.

References ecalDigis_cff::cuda, cms::cuda::StreamCache::get(), cms::cuda::getStreamCache(), and gpuAlgo_.

37  : label_(iConfig.getParameter<std::string>("@module_label")),
39  minValue_(iConfig.getParameter<double>("minValue")),
40  maxValue_(iConfig.getParameter<double>("maxValue")) {
42  if (cuda and cuda->enabled()) {
43  auto streamPtr = cms::cuda::getStreamCache().get();
44  gpuAlgo_ = std::make_unique<TestCUDAAnalyzerGPUKernel>(streamPtr.get());
45  }
46 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
SharedStreamPtr get()
Definition: StreamCache.cc:20
edm::EDGetTokenT< cms::cuda::Product< cms::cudatest::Thing > > const srcToken_
StreamCache & getStreamCache()
Definition: StreamCache.cc:39
std::unique_ptr< TestCUDAAnalyzerGPUKernel > gpuAlgo_
std::string const label_

◆ ~TestCUDAAnalyzerGPU()

TestCUDAAnalyzerGPU::~TestCUDAAnalyzerGPU ( )
overridedefault

Member Function Documentation

◆ analyze()

void TestCUDAAnalyzerGPU::analyze ( edm::StreamID  ,
edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
) const
overridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 57 of file TestCUDAAnalyzerGPU.cc.

References gpuAlgo_, iEvent, recoMuon::in, input, label_, and srcToken_.

57  {
58  edm::LogVerbatim("TestCUDAAnalyzerGPU") << label_ << " TestCUDAAnalyzerGPU::analyze begin event "
59  << iEvent.id().event() << " stream " << iEvent.streamID();
60 
61  auto const& in = iEvent.get(srcToken_);
63  cms::cudatest::Thing const& input = ctx.get(in);
64  gpuAlgo_->analyzeAsync(input.get(), ctx.stream());
65 
66  edm::LogVerbatim("TestCUDAAnalyzerGPU")
67  << label_ << " TestCUDAAnalyzerGPU::analyze end event " << iEvent.id().event() << " stream " << iEvent.streamID();
68 }
Log< level::Info, true > LogVerbatim
static std::string const input
Definition: EdmProvDump.cc:50
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< cms::cuda::Product< cms::cudatest::Thing > > const srcToken_
std::unique_ptr< TestCUDAAnalyzerGPUKernel > gpuAlgo_
std::string const label_

◆ endJob()

void TestCUDAAnalyzerGPU::endJob ( void  )
overridevirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 70 of file TestCUDAAnalyzerGPU.cc.

References cms::cuda::assert(), cms::cuda::StreamCache::get(), cms::cuda::getStreamCache(), gpuAlgo_, label_, maxValue_, minValue_, and relativeConstraints::value.

70  {
71  edm::LogVerbatim("TestCUDAAnalyzerGPU") << label_ << " TestCUDAAnalyzerGPU::endJob begin";
72 
73  auto streamPtr = cms::cuda::getStreamCache().get();
74  auto value = gpuAlgo_->value(streamPtr.get());
75  edm::LogVerbatim("TestCUDAAnalyzerGPU") << label_ << " accumulated value " << value;
77 
78  edm::LogVerbatim("TestCUDAAnalyzerGPU") << label_ << " TestCUDAAnalyzerGPU::endJob end";
79 }
Log< level::Info, true > LogVerbatim
assert(be >=bs)
SharedStreamPtr get()
Definition: StreamCache.cc:20
Definition: value.py:1
StreamCache & getStreamCache()
Definition: StreamCache.cc:39
std::unique_ptr< TestCUDAAnalyzerGPUKernel > gpuAlgo_
std::string const label_

◆ fillDescriptions()

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

Definition at line 48 of file TestCUDAAnalyzerGPU.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and edm::ConfigurationDescriptions::setComment().

48  {
50  desc.add<edm::InputTag>("src", edm::InputTag())->setComment("Source of cms::cuda::Product<cms::cudatest::Thing>.");
51  desc.add<double>("minValue", -1e308);
52  desc.add<double>("maxValue", 1e308);
53  descriptions.addWithDefaultLabel(desc);
54  descriptions.setComment("This EDAnalyzer is part of the TestCUDAProducer* family. It models a GPU analyzer.");
55 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void setComment(std::string const &value)

Member Data Documentation

◆ gpuAlgo_

std::unique_ptr<TestCUDAAnalyzerGPUKernel> TestCUDAAnalyzerGPU::gpuAlgo_
mutableprivate

Definition at line 33 of file TestCUDAAnalyzerGPU.cc.

Referenced by analyze(), endJob(), and TestCUDAAnalyzerGPU().

◆ label_

std::string const TestCUDAAnalyzerGPU::label_
private

◆ maxValue_

double const TestCUDAAnalyzerGPU::maxValue_
private

Definition at line 31 of file TestCUDAAnalyzerGPU.cc.

Referenced by endJob().

◆ minValue_

double const TestCUDAAnalyzerGPU::minValue_
private

Definition at line 30 of file TestCUDAAnalyzerGPU.cc.

Referenced by endJob().

◆ srcToken_

edm::EDGetTokenT<cms::cuda::Product<cms::cudatest::Thing> > const TestCUDAAnalyzerGPU::srcToken_
private

Definition at line 29 of file TestCUDAAnalyzerGPU.cc.

Referenced by analyze().