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
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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_
 
const std::string label_
 
const double maxValue_
 
const double minValue_
 
const edm::EDGetTokenT< cms::cuda::Product< cms::cudatest::Thing > > 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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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.

37  : label_(iConfig.getParameter<std::string>("@module_label")),
39  minValue_(iConfig.getParameter<double>("minValue")),
40  maxValue_(iConfig.getParameter<double>("maxValue")) {
42  if (cs->enabled()) {
43  auto streamPtr = cms::cuda::getStreamCache().get();
44  gpuAlgo_ = std::make_unique<TestCUDAAnalyzerGPUKernel>(streamPtr.get());
45  }
46 }

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

◆ ~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.

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 }

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

◆ endJob()

void TestCUDAAnalyzerGPU::endJob ( void  )
overridevirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 70 of file TestCUDAAnalyzerGPU.cc.

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 }

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

◆ fillDescriptions()

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

Definition at line 48 of file TestCUDAAnalyzerGPU.cc.

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 }

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addWithDefaultLabel(), HLT_2018_cff::InputTag, and edm::ConfigurationDescriptions::setComment().

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_

const std::string TestCUDAAnalyzerGPU::label_
private

◆ maxValue_

const double TestCUDAAnalyzerGPU::maxValue_
private

Definition at line 31 of file TestCUDAAnalyzerGPU.cc.

Referenced by endJob().

◆ minValue_

const double TestCUDAAnalyzerGPU::minValue_
private

Definition at line 30 of file TestCUDAAnalyzerGPU.cc.

Referenced by endJob().

◆ srcToken_

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

Definition at line 29 of file TestCUDAAnalyzerGPU.cc.

Referenced by analyze().

edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
input
static const std::string input
Definition: EdmProvDump.cc:48
TestCUDAAnalyzerGPU::label_
const std::string label_
Definition: TestCUDAAnalyzerGPU.cc:28
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:45
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::cuda::ScopedContextAnalyze
Definition: ScopedContext.h:222
cms::cuda::assert
assert(be >=bs)
TestCUDAAnalyzerGPU::maxValue_
const double maxValue_
Definition: TestCUDAAnalyzerGPU.cc:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::cuda::getStreamCache
StreamCache & getStreamCache()
Definition: StreamCache.cc:39
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition: ConfigurationDescriptions.cc:48
recoMuon::in
Definition: RecoMuonEnumerators.h:6
TestCUDAAnalyzerGPU::gpuAlgo_
std::unique_ptr< TestCUDAAnalyzerGPUKernel > gpuAlgo_
Definition: TestCUDAAnalyzerGPU.cc:33
cms::cudatest::Thing
Definition: Thing.h:8
cms::cuda::StreamCache::get
SharedStreamPtr get()
Definition: StreamCache.cc:20
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
edm::LogVerbatim
Definition: MessageLogger.h:297
relativeConstraints.value
value
Definition: relativeConstraints.py:53
cms::cuda::Product
Definition: Product.h:34
TestCUDAAnalyzerGPU::srcToken_
const edm::EDGetTokenT< cms::cuda::Product< cms::cudatest::Thing > > srcToken_
Definition: TestCUDAAnalyzerGPU.cc:29
TestCUDAAnalyzerGPU::minValue_
const double minValue_
Definition: TestCUDAAnalyzerGPU.cc:30
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87