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"))),
25  esMultiToken_(esConsumes(config.getParameter<edm::ESInputTag>("eventSetupSourceMulti"))),
29  size_{config.getParameter<edm::ParameterSet>("size").getParameter<int32_t>(
31  size2_{config.getParameter<edm::ParameterSet>("size").getParameter<int32_t>(
33  size3_{config.getParameter<edm::ParameterSet>("size").getParameter<int32_t>(
35 
36  void produce(edm::StreamID, device::Event& iEvent, device::EventSetup const& iSetup) const override {
37  [[maybe_unused]] auto const& esData = iSetup.getData(esToken_);
38  [[maybe_unused]] auto const& esMultiData = iSetup.getData(esMultiToken_);
39 
40  portabletest::TestDeviceCollection deviceProduct{size_, iEvent.queue()};
41  portabletest::TestDeviceMultiCollection2 deviceProductMulti2{{{size_, size2_}}, iEvent.queue()};
42  portabletest::TestDeviceMultiCollection3 deviceProductMulti3{{{size_, size2_, size3_}}, iEvent.queue()};
43 
44  // run the algorithm, potentially asynchronously
45  algo_.fill(iEvent.queue(), deviceProduct);
46  algo_.fillMulti2(iEvent.queue(), deviceProductMulti2);
47  algo_.fillMulti3(iEvent.queue(), deviceProductMulti3);
48 
49  iEvent.emplace(deviceToken_, std::move(deviceProduct));
50  iEvent.emplace(deviceTokenMulti2_, std::move(deviceProductMulti2));
51  iEvent.emplace(deviceTokenMulti3_, std::move(deviceProductMulti3));
52  }
53 
54  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
56  desc.add("eventSetupSource", edm::ESInputTag{});
57  desc.add("eventSetupSourceMulti", edm::ESInputTag{});
58 
60  psetSize.add<int32_t>("alpaka_serial_sync");
61  psetSize.add<int32_t>("alpaka_cuda_async");
62  psetSize.add<int32_t>("alpaka_rocm_async");
63  desc.add("size", psetSize);
64 
65  descriptions.addWithDefaultLabel(desc);
66  }
67 
68  private:
74  const int32_t size_;
75  const int32_t size2_;
76  const int32_t size3_;
77 
78  // implementation of the algorithm
80  };
81 
82 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
83 
85 DEFINE_FWK_ALPAKA_MODULE(TestAlpakaGlobalProducer);
const device::EDPutToken< portabletest::TestDeviceMultiCollection3 > deviceTokenMulti3_
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
const device::ESGetToken< AlpakaESTestDataACMultiDevice, AlpakaESTestRecordA > esMultiToken_
Definition: config.py:1
const device::EDPutToken< portabletest::TestDeviceCollection > deviceToken_
PortableCollection< TestSoA > TestDeviceCollection
int iEvent
Definition: GenABIO.cc:224
void fillMulti2(Queue &queue, portabletest::TestDeviceMultiCollection2 &collection, double xvalue=0.) const
Definition: TestAlgo.dev.cc:92
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
PortableCollection3< TestSoA, TestSoA2, TestSoA3 > TestDeviceMultiCollection3
void fill(Queue &queue, portabletest::TestDeviceCollection &collection, double xvalue=0.) const
Definition: TestAlgo.dev.cc:77
#define EDM_STRINGIZE(token)
Definition: stringize.h:6
const device::EDPutToken< portabletest::TestDeviceMultiCollection2 > deviceTokenMulti2_
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
PortableCollection2< TestSoA, TestSoA2 > TestDeviceMultiCollection2
void fillMulti3(Queue &queue, portabletest::TestDeviceMultiCollection3 &collection, double xvalue=0.) const
const device::ESGetToken< AlpakaESTestDataADevice, AlpakaESTestRecordA > esToken_
def move(src, dest)
Definition: eostools.py:511