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"))),
28  size_{config.getParameter<edm::ParameterSet>("size").getParameter<int32_t>(
30  size2_{config.getParameter<edm::ParameterSet>("size").getParameter<int32_t>(
32  size3_{config.getParameter<edm::ParameterSet>("size").getParameter<int32_t>(
34 
35  void produce(edm::StreamID, device::Event& iEvent, device::EventSetup const& iSetup) const override {
36  [[maybe_unused]] auto const& esData = iSetup.getData(esToken_);
37 
38  portabletest::TestDeviceCollection deviceProduct{size_, iEvent.queue()};
39  portabletest::TestDeviceMultiCollection2 deviceProductMulti2{{{size_, size2_}}, iEvent.queue()};
40  portabletest::TestDeviceMultiCollection3 deviceProductMulti3{{{size_, size2_, size3_}}, iEvent.queue()};
41 
42  // run the algorithm, potentially asynchronously
43  algo_.fill(iEvent.queue(), deviceProduct);
44  algo_.fillMulti2(iEvent.queue(), deviceProductMulti2);
45  algo_.fillMulti3(iEvent.queue(), deviceProductMulti3);
46 
47  iEvent.emplace(deviceToken_, std::move(deviceProduct));
48  iEvent.emplace(deviceTokenMulti2_, std::move(deviceProductMulti2));
49  iEvent.emplace(deviceTokenMulti3_, std::move(deviceProductMulti3));
50  }
51 
52  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
54  desc.add("eventSetupSource", edm::ESInputTag{});
55 
57  psetSize.add<int32_t>("alpaka_serial_sync");
58  psetSize.add<int32_t>("alpaka_cuda_async");
59  psetSize.add<int32_t>("alpaka_rocm_async");
60  desc.add("size", psetSize);
61 
62  descriptions.addWithDefaultLabel(desc);
63  }
64 
65  private:
70  const int32_t size_;
71  const int32_t size2_;
72  const int32_t size3_;
73 
74  // implementation of the algorithm
76  };
77 
78 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
79 
81 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
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:98
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:83
#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