CMS 3D CMS Logo

TestPortableProducerCUDA.cc
Go to the documentation of this file.
14 
15 #include "TestAlgo.h"
16 
18 public:
20  : deviceToken_{produces()}, size_{config.getParameter<int32_t>("size")} {}
21 
22  void produce(edm::Event& event, edm::EventSetup const&) override {
23  // create a context based on the EDM stream number
24  cms::cuda::ScopedContextProduce ctx(event.streamID());
25 
26  // run the algorithm, potentially asynchronously
27  cudatest::TestDeviceCollection deviceProduct{size_, ctx.stream()};
28  algo_.fill(deviceProduct, ctx.stream());
29 
30  // put the asynchronous product into the event without waiting
31  ctx.emplace(event, deviceToken_, std::move(deviceProduct));
32  }
33 
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
36  desc.add<int32_t>("size");
37  descriptions.addWithDefaultLabel(desc);
38  }
39 
40 private:
42  const int32_t size_;
43 
44  // implementation of the algorithm
46 };
47 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void produce(edm::Event &event, edm::EventSetup const &) override
void fill(cudatest::TestDeviceCollection &collection, cudaStream_t stream) const
Definition: config.py:1
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TestPortableProducerCUDA(edm::ParameterSet const &config)
def move(src, dest)
Definition: eostools.py:511
const edm::EDPutTokenT< cms::cuda::Product< cudatest::TestDeviceCollection > > deviceToken_
Definition: event.py:1