CMS 3D CMS Logo

TestAlpakaProducer.cc
Go to the documentation of this file.
14 
15 #include "TestAlgo.h"
16 
18 
20  public:
22  : objectToken_{produces()}, collectionToken_{produces()}, size_{config.getParameter<int32_t>("size")} {}
23 
24  void produce(edm::StreamID sid, device::Event& event, device::EventSetup const&) const override {
25  // run the algorithm, potentially asynchronously
26  portabletest::TestDeviceCollection deviceCollection{size_, event.queue()};
27  algo_.fill(event.queue(), deviceCollection);
28 
29  portabletest::TestDeviceObject deviceObject{event.queue()};
30  algo_.fillObject(event.queue(), deviceObject, 5., 12., 13., 42);
31 
32  // put the asynchronous products into the event without waiting
33  event.emplace(objectToken_, std::move(deviceObject));
34  event.emplace(collectionToken_, std::move(deviceCollection));
35  }
36 
37  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
39  desc.add<int32_t>("size");
40  descriptions.addWithDefaultLabel(desc);
41  }
42 
43  private:
46  const int32_t size_;
47 
48  // implementation of the algorithm
50  };
51 
52 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
53 
55 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
Definition: TestAlgo.dev.cc:75
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::TestDeviceObject > objectToken_
void fill(Queue &queue, portabletest::TestDeviceCollection &collection, double xvalue=0.) const
Definition: TestAlgo.dev.cc:41
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
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1