CMS 3D CMS Logo

TestAlpakaStreamProducer.cc
Go to the documentation of this file.
2 #include "DataFormats/TestObjects/interface/ToyProducts.h"
13 
14 #include "TestAlgo.h"
15 
24  public:
25  TestAlpakaStreamProducer(edm::ParameterSet const& config) : size_{config.getParameter<int32_t>("size")} {
26  getToken_ = consumes(config.getParameter<edm::InputTag>("source"));
27  esToken_ = esConsumes();
29  }
30 
31  void produce(device::Event& iEvent, device::EventSetup const& iSetup) override {
32  [[maybe_unused]] auto inpData = iEvent.getHandle(getToken_);
33  [[maybe_unused]] auto const& esData = iSetup.getData(esToken_);
34 
35  auto deviceProduct = std::make_unique<portabletest::TestDeviceCollection>(size_, alpaka::getDev(iEvent.queue()));
36 
37  // run the algorithm, potentially asynchronously
38  algo_.fill(iEvent.queue(), *deviceProduct);
39 
40  iEvent.put(devicePutToken_, std::move(deviceProduct));
41  }
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
45  desc.add<edm::InputTag>("source");
46  desc.add<int32_t>("size");
47  descriptions.addWithDefaultLabel(desc);
48  }
49 
50  private:
54  const int32_t size_;
55 
56  // implementation of the algorithm
58  };
59 
60 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
61 
63 DEFINE_FWK_ALPAKA_MODULE(TestAlpakaStreamProducer);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void fill(Queue &queue, portabletest::TestDeviceCollection &collection) const
Definition: TestAlgo.dev.cc:39
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: config.py:1
int iEvent
Definition: GenABIO.cc:224
device::EDPutToken< portabletest::TestDeviceCollection > devicePutToken_
device::ESGetToken< cms::alpakatest::AlpakaESTestDataB< Device >, AlpakaESTestRecordB > esToken_
void produce(device::Event &iEvent, device::EventSetup const &iSetup) override
T const & getData(edm::ESGetToken< T, R > const &iToken) const
Definition: EventSetup.h:27
#define DEFINE_FWK_ALPAKA_MODULE(name)
Definition: MakerMacros.h:9
def move(src, dest)
Definition: eostools.py:511