CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TestCUDAProducerGPU.cc
Go to the documentation of this file.
7 
11 
13 
15 public:
17  ~TestCUDAProducerGPU() override = default;
18 
19  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
20 
21  void produce(edm::StreamID streamID, edm::Event& iEvent, edm::EventSetup const& iSetup) const override;
22 
23 private:
28 };
29 
31  : label_(iConfig.getParameter<std::string>("@module_label")),
32  srcToken_(consumes<cms::cuda::Product<cms::cudatest::Thing>>(iConfig.getParameter<edm::InputTag>("src"))),
33  dstToken_(produces<cms::cuda::Product<cms::cudatest::Thing>>()) {}
34 
37  desc.add<edm::InputTag>("src", edm::InputTag())->setComment("Source of cms::cuda::Product<cms::cudatest::Thing>.");
38  descriptions.addWithDefaultLabel(desc);
39  descriptions.setComment(
40  "This EDProducer is part of the TestCUDAProducer* family. It models a GPU algorithm this is not the first "
41  "algorithm in the chain of the GPU EDProducers. Produces cms::cuda::Product<cms::cudatest::Thing>.");
42 }
43 
45  edm::LogVerbatim("TestCUDAProducerGPU") << label_ << " TestCUDAProducerGPU::produce begin event "
46  << iEvent.id().event() << " stream " << iEvent.streamID();
47 
48  auto const& in = iEvent.get(srcToken_);
50  cms::cudatest::Thing const& input = ctx.get(in);
51 
52  ctx.emplace(iEvent, dstToken_, cms::cudatest::Thing{gpuAlgo_.runAlgo(label_, input.get(), ctx.stream())});
53 
54  edm::LogVerbatim("TestCUDAProducerGPU")
55  << label_ << " TestCUDAProducerGPU::produce end event " << iEvent.id().event() << " stream " << iEvent.streamID();
56 }
57 
Log< level::Info, true > LogVerbatim
EventNumber_t event() const
Definition: EventID.h:40
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const float * get() const
Definition: Thing.h:13
TestCUDAProducerGPUKernel const gpuAlgo_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDPutTokenT< cms::cuda::Product< cms::cudatest::Thing > > const dstToken_
static std::string const input
Definition: EdmProvDump.cc:47
cms::cuda::device::unique_ptr< float[]> runAlgo(const std::string &label, cudaStream_t stream) const
int iEvent
Definition: GenABIO.cc:224
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
std::string const label_
void produce(edm::StreamID streamID, edm::Event &iEvent, edm::EventSetup const &iSetup) const override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
~TestCUDAProducerGPU() override=default
void setComment(std::string const &value)
edm::EDGetTokenT< cms::cuda::Product< cms::cudatest::Thing > > const srcToken_
TestCUDAProducerGPU(const edm::ParameterSet &iConfig)
edm::EventID id() const
Definition: EventBase.h:59
StreamID streamID() const
Definition: Event.h:98