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  deviceCollection.zeroInitialise(event.queue());
34  algo_.checkZero(event.queue(), deviceCollection);
35  algo_.fill(event.queue(), deviceCollection);
36 
37  portabletest::TestDeviceObject deviceObject{event.queue()};
38  deviceObject.zeroInitialise(event.queue());
39  algo_.checkZero(event.queue(), deviceObject);
40  algo_.fillObject(event.queue(), deviceObject, 5., 12., 13., 42);
41 
42  portabletest::TestDeviceMultiCollection2 deviceMultiProduct2{{{size_, size2_}}, event.queue()};
43  deviceMultiProduct2.zeroInitialise(event.queue());
44  algo_.checkZero(event.queue(), deviceMultiProduct2);
45  algo_.fillMulti2(event.queue(), deviceMultiProduct2);
46 
47  portabletest::TestDeviceMultiCollection3 deviceMultiProduct3{{{size_, size2_, size3_}}, event.queue()};
48  deviceMultiProduct3.zeroInitialise(event.queue());
49  algo_.checkZero(event.queue(), deviceMultiProduct3);
50  algo_.fillMulti3(event.queue(), deviceMultiProduct3);
51 
52  // put the asynchronous products into the event without waiting
53  event.emplace(collectionToken_, std::move(deviceCollection));
54  event.emplace(objectToken_, std::move(deviceObject));
55  event.emplace(deviceTokenMulti2_, std::move(deviceMultiProduct2));
56  event.emplace(deviceTokenMulti3_, std::move(deviceMultiProduct3));
57  }
58 
59  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
61  desc.add<int32_t>("size");
62  desc.add<int32_t>("size2");
63  desc.add<int32_t>("size3");
64  descriptions.addWithDefaultLabel(desc);
65  }
66 
67  private:
72  const int32_t size_;
73  const int32_t size2_;
74  const int32_t size3_;
75 
76  // implementation of the algorithm
78  };
79 
80 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
81 
83 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:92
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:77
TestAlpakaProducer(edm::ParameterSet const &config)
void checkZero(Queue &queue, portabletest::TestDeviceCollection const &collection) const
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