CMS 3D CMS Logo

TestAlpakaProducer.cc
Go to the documentation of this file.
14 
15 #include "TestAlgo.h"
16 
18 
20  public:
26  size_{config.getParameter<int32_t>("size")},
27  size2_{config.getParameter<int32_t>("size2")},
28  size3_{config.getParameter<int32_t>("size3")} {}
29 
30  void produce(edm::StreamID sid, device::Event& event, device::EventSetup const&) const override {
31  // run the algorithm, potentially asynchronously
32  portabletest::TestDeviceCollection deviceCollection{size_, event.queue()};
33  algo_.fill(event.queue(), deviceCollection);
34 
35  portabletest::TestDeviceObject deviceObject{event.queue()};
36  algo_.fillObject(event.queue(), deviceObject, 5., 12., 13., 42);
37 
38  portabletest::TestDeviceCollection deviceProduct{size_, event.queue()};
39  algo_.fill(event.queue(), deviceProduct);
40 
41  portabletest::TestDeviceMultiCollection2 deviceMultiProduct2{{{size_, size2_}}, event.queue()};
42  algo_.fillMulti2(event.queue(), deviceMultiProduct2);
43 
44  portabletest::TestDeviceMultiCollection3 deviceMultiProduct3{{{size_, size2_, size3_}}, event.queue()};
45  algo_.fillMulti3(event.queue(), deviceMultiProduct3);
46 
47  // put the asynchronous products into the event without waiting
48  event.emplace(collectionToken_, std::move(deviceCollection));
49  event.emplace(objectToken_, std::move(deviceObject));
50  event.emplace(deviceTokenMulti2_, std::move(deviceMultiProduct2));
51  event.emplace(deviceTokenMulti3_, std::move(deviceMultiProduct3));
52  }
53 
54  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
56  desc.add<int32_t>("size");
57  desc.add<int32_t>("size2");
58  desc.add<int32_t>("size3");
59  descriptions.addWithDefaultLabel(desc);
60  }
61 
62  private:
67  const int32_t size_;
68  const int32_t size2_;
69  const int32_t size3_;
70 
71  // implementation of the algorithm
73  };
74 
75 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
76 
78 DEFINE_FWK_ALPAKA_MODULE(TestAlpakaProducer);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void fillObject(Queue &queue, portabletest::TestDeviceObject &object, double x, double y, double z, int32_t id) const
const device::EDPutToken< portabletest::TestDeviceCollection > collectionToken_
void produce(edm::StreamID sid, device::Event &event, device::EventSetup const &) const override
Definition: config.py:1
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
PortableCollection< TestSoA > TestDeviceCollection
PortableObject< TestStruct > TestDeviceObject
const device::EDPutToken< portabletest::TestDeviceMultiCollection3 > deviceTokenMulti3_
const device::EDPutToken< portabletest::TestDeviceMultiCollection2 > deviceTokenMulti2_
void fillMulti2(Queue &queue, portabletest::TestDeviceMultiCollection2 &collection, double xvalue=0.) const
Definition: TestAlgo.dev.cc:97
const device::EDPutToken< portabletest::TestDeviceObject > objectToken_
PortableCollection3< TestSoA, TestSoA2, TestSoA3 > TestDeviceMultiCollection3
void fill(Queue &queue, portabletest::TestDeviceCollection &collection, double xvalue=0.) const
Definition: TestAlgo.dev.cc:82
TestAlpakaProducer(edm::ParameterSet const &config)
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
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1