CMS 3D CMS Logo

TestAlpakaStreamSynchronizingProducer.cc
Go to the documentation of this file.
7 
8 #include "TestHelperClass.h"
9 
26  public:
32  helper_{iConfig, consumesCollector()},
33  hostHelper_{iConfig, consumesCollector()},
34  expectedInt_{iConfig.getParameter<int>("expectedInt")} {}
35 
36  void acquire(device::Event const& iEvent, device::EventSetup const& iSetup) override {
37  [[maybe_unused]] auto const& esData = iSetup.getData(esTokenDevice_);
38 
39  int const value = hostHelper_.run(iEvent, iSetup);
40  if (value != expectedInt_) {
41  throw cms::Exception("Assert") << "Expected value " << expectedInt_ << ", but got " << value;
42  }
43 
44  helper_.makeAsync(iEvent, iSetup);
45  }
46 
47  void produce(device::Event& iEvent, device::EventSetup const& iSetup) override {
48  iEvent.emplace(putToken_, helper_.moveFrom());
51  }
52 
53  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
57  desc.add<int>("expectedInt");
58  descriptions.addWithDefaultLabel(desc);
59  }
60 
61  private:
66 
69  int const expectedInt_;
70  };
71 
72 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
73 
75 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_
const edm::EDPutTokenT< portabletest::TestHostMultiCollection3 > putTokenMulti3_
portabletest::TestHostMultiCollection2 moveFromMulti2()
int iEvent
Definition: GenABIO.cc:224
int run(edm::Event const &iEvent, edm::EventSetup const &iSetup) const
Definition: value.py:1
const edm::EDPutTokenT< portabletest::TestHostMultiCollection2 > putTokenMulti2_
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)
portabletest::TestHostMultiCollection3 moveFromMulti3()
void produce(device::Event &iEvent, device::EventSetup const &iSetup) override
auto produces(std::string instanceName) noexcept
declare what type of product will make and with which optional label
#define DEFINE_FWK_ALPAKA_MODULE(name)
Definition: MakerMacros.h:16