CMS 3D CMS Logo

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

Public Member Functions

void analyze (edm::StreamID iStream, edm::Event const &iEvent, edm::EventSetup const &iSetup) const override
 
 TestAlpakaHostDeviceCompare (edm::ParameterSet const &iConfig)
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
template<typename T >
static void require (T const &host, T const &device, T const &expectedDiff, std::string_view name)
 
- 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< portabletest::TestHostCollection > const deviceToken_
 
double const expectedXdiff_
 
edm::EDGetTokenT< portabletest::TestHostCollection > const hostToken_
 

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 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)
 
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 TestAlpakaHostDeviceCompare.cc.

Constructor & Destructor Documentation

◆ TestAlpakaHostDeviceCompare()

TestAlpakaHostDeviceCompare::TestAlpakaHostDeviceCompare ( edm::ParameterSet const &  iConfig)
inline

Definition at line 17 of file TestAlpakaHostDeviceCompare.cc.

References edm::EDConsumerBase::consumes(), and edm::ParameterSet::getUntrackedParameter().

18  : hostToken_{consumes(iConfig.getUntrackedParameter<edm::InputTag>("srcHost"))},
19  deviceToken_{consumes(iConfig.getUntrackedParameter<edm::InputTag>("srcDevice"))},
20  expectedXdiff_{iConfig.getUntrackedParameter<double>("expectedXdiff")} {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< portabletest::TestHostCollection > const hostToken_
edm::EDGetTokenT< portabletest::TestHostCollection > const deviceToken_

Member Function Documentation

◆ analyze()

void TestAlpakaHostDeviceCompare::analyze ( edm::StreamID  iStream,
edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
) const
inlineoverridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 39 of file TestAlpakaHostDeviceCompare.cc.

References deviceToken_, expectedXdiff_, dqm-mbProfile::format, hostToken_, mps_fire::i, iEvent, require(), and x.

39  {
40  auto const& hostData = iEvent.get(hostToken_);
41  auto const& deviceData = iEvent.get(deviceToken_);
42 
43  require(hostData->metadata().size(), deviceData->metadata().size(), 0, "metadata().size()");
44  auto const hostView = hostData.view();
45  auto const deviceView = deviceData.view();
46  for (int i = 0; i < hostData->metadata().size(); ++i) {
47  require(hostView[i].x(), deviceView[i].x(), expectedXdiff_, fmt::format("view[{}].x()", i));
48  }
49  }
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< portabletest::TestHostCollection > const hostToken_
edm::EDGetTokenT< portabletest::TestHostCollection > const deviceToken_
static void require(T const &host, T const &device, T const &expectedDiff, std::string_view name)

◆ fillDescriptions()

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

Definition at line 22 of file TestAlpakaHostDeviceCompare.cc.

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

22  {
24  desc.addUntracked<edm::InputTag>("srcHost");
25  desc.addUntracked<edm::InputTag>("srcDevice");
26  desc.addUntracked<double>("expectedXdiff", 0.);
27  descriptions.addWithDefaultLabel(desc);
28  }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ require()

template<typename T >
static void TestAlpakaHostDeviceCompare::require ( T const &  host,
T const &  device,
T const &  expectedDiff,
std::string_view  name 
)
inlinestatic

Definition at line 31 of file TestAlpakaHostDeviceCompare.cc.

References change_name::diff, Exception, query::host, and Skims_PA_cff::name.

Referenced by analyze().

31  {
32  T const diff = host - device;
33  if (diff != expectedDiff) {
34  throw cms::Exception("Assert") << "Comparison of " << name << " failed, expected difference " << expectedDiff
35  << " but got " << diff << ", host value " << host << " device value " << device;
36  }
37  }
string host
Definition: query.py:115
long double T

Member Data Documentation

◆ deviceToken_

edm::EDGetTokenT<portabletest::TestHostCollection> const TestAlpakaHostDeviceCompare::deviceToken_
private

Definition at line 53 of file TestAlpakaHostDeviceCompare.cc.

Referenced by analyze().

◆ expectedXdiff_

double const TestAlpakaHostDeviceCompare::expectedXdiff_
private

Definition at line 54 of file TestAlpakaHostDeviceCompare.cc.

Referenced by analyze().

◆ hostToken_

edm::EDGetTokenT<portabletest::TestHostCollection> const TestAlpakaHostDeviceCompare::hostToken_
private

Definition at line 52 of file TestAlpakaHostDeviceCompare.cc.

Referenced by analyze().