CMS 3D CMS Logo

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

Public Member Functions

void analyze (edm::StreamID sid, edm::Event const &event, edm::EventSetup const &) const override
 
 TestAlpakaObjectAnalyzer (edm::ParameterSet const &config)
 
- 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

edm::EDGetTokenT< unsigned short > backendToken_
 
std::optional< cms::alpakatools::BackendexpectBackend_
 
const edm::InputTag source_
 
const edm::EDGetTokenT< portabletest::TestHostObjecttoken_
 

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 15 of file TestAlpakaObjectAnalyzer.cc.

Constructor & Destructor Documentation

◆ TestAlpakaObjectAnalyzer()

TestAlpakaObjectAnalyzer::TestAlpakaObjectAnalyzer ( edm::ParameterSet const &  config)
inline

Definition at line 17 of file TestAlpakaObjectAnalyzer.cc.

18  : source_{config.getParameter<edm::InputTag>("source")}, token_{consumes(source_)} {
19  if (std::string const& eb = config.getParameter<std::string>("expectBackend"); not eb.empty()) {
22  }
23  }
const edm::EDGetTokenT< portabletest::TestHostObject > token_
std::optional< cms::alpakatools::Backend > expectBackend_
Definition: config.py:1
std::string const & label() const
Definition: InputTag.h:36
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Backend toBackend(std::string_view name)
Definition: Backend.cc:13
edm::EDGetTokenT< unsigned short > backendToken_
std::string const & process() const
Definition: InputTag.h:40

Member Function Documentation

◆ analyze()

void TestAlpakaObjectAnalyzer::analyze ( edm::StreamID  sid,
edm::Event const &  event,
edm::EventSetup const &   
) const
inlineoverridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 25 of file TestAlpakaObjectAnalyzer.cc.

References cms::cuda::assert(), jetsAK4_CHS_cff::backend, backendToken_, PortableHostObject< T >::buffer(), PortableHostObject< T >::data(), edm::InputTag::encode(), Exception, expectBackend_, mps_check::msg, source_, token_, cms::alpakatools::toString(), and PortableHostObject< T >::value().

25  {
26  portabletest::TestHostObject const& product = event.get(token_);
27 
28  auto const& value = product.value();
29  {
30  edm::LogInfo msg("TestAlpakaObjectAnalyzer");
31  msg << source_.encode() << ".data() at " << product.data() << '\n';
32  msg << source_.encode() << ".buffer().data() at " << product.buffer().data() << '\n';
33  msg << source_.encode() << ".value() = {\n";
34  msg << " .x: " << value.x << '\n';
35  msg << " .y: " << value.y << '\n';
36  msg << " .z: " << value.z << '\n';
37  msg << " .id: " << value.id << '\n';
38  msg << "}\n";
39  }
40 
41  // check that the product data is held in the product buffer
42  assert(product.buffer().data() == product.data());
43 
44  // check that the product content is as expected
45  assert(value.x == 5.);
46  assert(value.y == 12.);
47  assert(value.z == 13.);
48  assert(value.id == 42);
49 
50  // check that the backend is as expected
51  if (expectBackend_) {
52  auto backend = static_cast<cms::alpakatools::Backend>(event.get(backendToken_));
53  if (expectBackend_ != backend) {
54  throw cms::Exception("Assert") << "Expected input backend " << cms::alpakatools::toString(*expectBackend_)
55  << ", got " << cms::alpakatools::toString(backend);
56  }
57  }
58  }
std::string encode() const
Definition: InputTag.cc:159
const edm::EDGetTokenT< portabletest::TestHostObject > token_
std::optional< cms::alpakatools::Backend > expectBackend_
assert(be >=bs)
std::string_view toString(Backend backend)
Definition: Backend.cc:24
Definition: value.py:1
tuple msg
Definition: mps_check.py:286
edm::EDGetTokenT< unsigned short > backendToken_

◆ fillDescriptions()

static void TestAlpakaObjectAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 60 of file TestAlpakaObjectAnalyzer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

60  {
62  desc.add<edm::InputTag>("source");
63  desc.add<std::string>("expectBackend", "")
64  ->setComment(
65  "Expected backend of the input collection. Empty value means to not perform the check. Default: empty "
66  "string");
67  descriptions.addWithDefaultLabel(desc);
68  }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ backendToken_

edm::EDGetTokenT<unsigned short> TestAlpakaObjectAnalyzer::backendToken_
private

Definition at line 73 of file TestAlpakaObjectAnalyzer.cc.

Referenced by analyze().

◆ expectBackend_

std::optional<cms::alpakatools::Backend> TestAlpakaObjectAnalyzer::expectBackend_
private

Definition at line 74 of file TestAlpakaObjectAnalyzer.cc.

Referenced by analyze().

◆ source_

const edm::InputTag TestAlpakaObjectAnalyzer::source_
private

◆ token_

const edm::EDGetTokenT<portabletest::TestHostObject> TestAlpakaObjectAnalyzer::token_
private

Definition at line 72 of file TestAlpakaObjectAnalyzer.cc.

Referenced by analyze().