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  psetX.add<double>("alpaka_rocm_async", 0.);
51  desc.add("xvalue", psetX);
52 
53  descriptions.addWithDefaultLabel(desc);
54  }
55 
56  private:
59 
60  TestAlgo const algo_{};
61 
62  double const x_;
63  };
64 
65 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
66 
68 DEFINE_FWK_ALPAKA_MODULE(TestAlpakaGlobalProducerOffset);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Definition: config.py:1
PortableCollection< TestSoA > TestDeviceCollection
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: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
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