CMS 3D CMS Logo

TestAlpakaStreamSynchronizingProducerToDevice.cc
Go to the documentation of this file.
9 
10 #include "TestAlgo.h"
11 
20  public:
22  : putToken_{produces()},
23  size_{iConfig.getParameter<edm::ParameterSet>("size").getParameter<int32_t>(
25 
26  void acquire(device::Event const& iEvent, device::EventSetup const& iSetup) override {
27  deviceProduct_ = std::make_unique<portabletest::TestDeviceCollection>(size_, iEvent.queue());
28 
29  // run the algorithm, potentially asynchronously
30  algo_.fill(iEvent.queue(), *deviceProduct_);
31  }
32 
33  void produce(device::Event& iEvent, device::EventSetup const& iSetup) override {
35  }
36 
37  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
39 
41  psetSize.add<int32_t>("alpaka_serial_sync");
42  psetSize.add<int32_t>("alpaka_cuda_async");
43  psetSize.add<int32_t>("alpaka_rocm_async");
44  desc.add("size", psetSize);
45 
46  descriptions.addWithDefaultLabel(desc);
47  }
48 
49  private:
51  const int32_t size_;
52 
53  // implementation of the algorithm
55 
56  std::unique_ptr<portabletest::TestDeviceCollection> deviceProduct_;
57  };
58 
59 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
60 
62 DEFINE_FWK_ALPAKA_MODULE(TestAlpakaStreamSynchronizingProducerToDevice);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void produce(device::Event &iEvent, device::EventSetup const &iSetup) override
void acquire(device::Event const &iEvent, device::EventSetup const &iSetup) override
int iEvent
Definition: GenABIO.cc:224
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void fill(Queue &queue, portabletest::TestDeviceCollection &collection, double xvalue=0.) const
Definition: TestAlgo.dev.cc:83
#define EDM_STRINGIZE(token)
Definition: stringize.h:6
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