CMS 3D CMS Logo

TestAlpakaStreamSynchronizingProducer.cc
Go to the documentation of this file.
7 
8 #include "TestHelperClass.h"
9 
26  public:
30  helper_{iConfig, consumesCollector()},
31  hostHelper_{iConfig, consumesCollector()},
32  expectedInt_{iConfig.getParameter<int>("expectedInt")} {}
33 
34  void acquire(device::Event const& iEvent, device::EventSetup const& iSetup) override {
35  [[maybe_unused]] auto const& esData = iSetup.getData(esTokenDevice_);
36 
37  int const value = hostHelper_.run(iEvent, iSetup);
38  if (value != expectedInt_) {
39  throw cms::Exception("Assert") << "Expected value " << expectedInt_ << ", but got " << value;
40  }
41 
42  helper_.makeAsync(iEvent, iSetup);
43  }
44 
45  void produce(device::Event& iEvent, device::EventSetup const& iSetup) override {
46  iEvent.emplace(putToken_, helper_.moveFrom());
47  }
48 
49  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
53  desc.add<int>("expectedInt");
54  descriptions.addWithDefaultLabel(desc);
55  }
56 
57  private:
60 
63  int const expectedInt_;
64  };
65 
66 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
67 
69 DEFINE_FWK_ALPAKA_MODULE(TestAlpakaStreamSynchronizingProducer);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void acquire(device::Event const &iEvent, device::EventSetup const &iSetup) override
void makeAsync(device::Event const &iEvent, device::EventSetup const &iSetup)
const device::ESGetToken< AlpakaESTestDataDDevice, AlpakaESTestRecordD > esTokenDevice_
int iEvent
Definition: GenABIO.cc:224
int run(edm::Event const &iEvent, edm::EventSetup const &iSetup) const
Definition: value.py:1
portabletest::TestHostCollection moveFrom()
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
T const & getData(edm::ESGetToken< T, R > const &iToken) const
Definition: EventSetup.h:32
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
void produce(device::Event &iEvent, device::EventSetup const &iSetup) override
#define DEFINE_FWK_ALPAKA_MODULE(name)
Definition: MakerMacros.h:16