CMS 3D CMS Logo

TestAlpakaGlobalProducerOffset.cc
Go to the documentation of this file.
13 
14 #include "TestAlgo.h"
15 
23  public:
25  : esToken_(esConsumes()),
27  x_(config.getParameter<edm::ParameterSet>("xvalue").getParameter<double>(
29 
30  void produce(edm::StreamID, device::Event& iEvent, device::EventSetup const& iSetup) const override {
31  auto const& esData = iSetup.getData(esToken_);
32 
33  portabletest::TestDeviceCollection deviceProduct{esData->metadata().size(), iEvent.queue()};
34 
35  // run the algorithm, potentially asynchronously
36  algo_.fill(iEvent.queue(), deviceProduct, x_);
37 
38  iEvent.emplace(deviceToken_, std::move(deviceProduct));
39  }
40 
41  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
43 
44  // TODO: if this becomes an accepted pattern, we could look into
45  // simplifying the definition (also this use case has additional
46  // constraints not in a general PSet)
48  psetX.add<double>("alpaka_serial_sync", 0.);
49  psetX.add<double>("alpaka_cuda_async", 0.);
50  desc.add("xvalue", psetX);
51 
52  descriptions.addWithDefaultLabel(desc);
53  }
54 
55  private:
58 
59  TestAlgo const algo_{};
60 
61  double const x_;
62  };
63 
64 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
65 
67 DEFINE_FWK_ALPAKA_MODULE(TestAlpakaGlobalProducerOffset);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Definition: config.py:1
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:224
void produce(edm::StreamID, device::Event &iEvent, device::EventSetup const &iSetup) const override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T const & getData(edm::ESGetToken< T, R > const &iToken) const
Definition: EventSetup.h:32
void fill(Queue &queue, portabletest::TestDeviceCollection &collection, double xvalue=0.) const
Definition: TestAlgo.dev.cc:43
#define EDM_STRINGIZE(token)
Definition: stringize.h:6
device::EDPutToken< portabletest::TestDeviceCollection > const deviceToken_
#define DEFINE_FWK_ALPAKA_MODULE(name)
Definition: MakerMacros.h:16
device::ESGetToken< AlpakaESTestDataADevice, AlpakaESTestRecordA > const esToken_
def move(src, dest)
Definition: eostools.py:511