CMS 3D CMS Logo

TestAlpakaGlobalProducer.cc
Go to the documentation of this file.
12 
13 #include "TestAlgo.h"
14 
22  public:
24  : esToken_(esConsumes(config.getParameter<edm::ESInputTag>("eventSetupSource"))),
26  size_{config.getParameter<edm::ParameterSet>("size").getParameter<int32_t>(
28 
29  void produce(edm::StreamID, device::Event& iEvent, device::EventSetup const& iSetup) const override {
30  [[maybe_unused]] auto const& esData = iSetup.getData(esToken_);
31 
32  portabletest::TestDeviceCollection deviceProduct{size_, iEvent.queue()};
33 
34  // run the algorithm, potentially asynchronously
35  algo_.fill(iEvent.queue(), deviceProduct);
36 
37  iEvent.emplace(deviceToken_, std::move(deviceProduct));
38  }
39 
40  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
42  desc.add("eventSetupSource", edm::ESInputTag{});
43 
45  psetSize.add<int32_t>("alpaka_serial_sync");
46  psetSize.add<int32_t>("alpaka_cuda_async");
47  psetSize.add<int32_t>("alpaka_rocm_async");
48  desc.add("size", psetSize);
49 
50  descriptions.addWithDefaultLabel(desc);
51  }
52 
53  private:
56  const int32_t size_;
57 
58  // implementation of the algorithm
60  };
61 
62 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
63 
65 DEFINE_FWK_ALPAKA_MODULE(TestAlpakaGlobalProducer);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void produce(edm::StreamID, device::Event &iEvent, device::EventSetup const &iSetup) const override
Definition: config.py:1
const device::EDPutToken< portabletest::TestDeviceCollection > deviceToken_
PortableCollection< TestSoA > TestDeviceCollection
int iEvent
Definition: GenABIO.cc:224
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T const & getData(edm::ESGetToken< T, R > const &iToken) const
Definition: EventSetup.h:32
void fill(Queue &queue, portabletest::TestDeviceCollection &collection, double xvalue=0.) const
Definition: TestAlgo.dev.cc:41
#define EDM_STRINGIZE(token)
Definition: stringize.h:6
HLT enums.
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
const device::ESGetToken< AlpakaESTestDataADevice, AlpakaESTestRecordA > esToken_
def move(src, dest)
Definition: eostools.py:511