CMS 3D CMS Logo

TestCUDAProducerGPU.cc
Go to the documentation of this file.
7 
11 
13 
15 public:
16  explicit TestCUDAProducerGPU(const edm::ParameterSet& iConfig);
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 
edm::StreamID
Definition: StreamID.h:30
TestCUDAProducerGPU::produce
void produce(edm::StreamID streamID, edm::Event &iEvent, edm::EventSetup const &iSetup) const override
Definition: TestCUDAProducerGPU.cc:44
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
input
static const std::string input
Definition: EdmProvDump.cc:48
TestCUDAProducerGPUKernel::runAlgo
cms::cuda::device::unique_ptr< float[]> runAlgo(const std::string &label, cudaStream_t stream) const
Definition: TestCUDAProducerGPUKernel.h:27
TestCUDAProducerGPU::~TestCUDAProducerGPU
~TestCUDAProducerGPU() override=default
cms::cuda::ScopedContextProduce
Definition: ScopedContext.h:149
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDPutTokenT
Definition: EDPutToken.h:33
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TestCUDAProducerGPUKernel.h
TestCUDAProducerGPU::srcToken_
const edm::EDGetTokenT< cms::cuda::Product< cms::cudatest::Thing > > srcToken_
Definition: TestCUDAProducerGPU.cc:25
TestCUDAProducerGPU::TestCUDAProducerGPU
TestCUDAProducerGPU(const edm::ParameterSet &iConfig)
Definition: TestCUDAProducerGPU.cc:30
TestCUDAProducerGPU::label_
const std::string label_
Definition: TestCUDAProducerGPU.cc:24
TestCUDAProducerGPU::gpuAlgo_
const TestCUDAProducerGPUKernel gpuAlgo_
Definition: TestCUDAProducerGPU.cc:27
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
prod1Switch_cff.cuda
cuda
Definition: prod1Switch_cff.py:11
ParameterSetDescription.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TestCUDAProducerGPU
Definition: TestCUDAProducerGPU.cc:14
TestCUDAProducerGPU::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TestCUDAProducerGPU.cc:35
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition: ConfigurationDescriptions.cc:48
recoMuon::in
Definition: RecoMuonEnumerators.h:6
cms::cudatest::Thing
Definition: Thing.h:8
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogVerbatim
Definition: MessageLogger.h:297
edm::EventSetup
Definition: EventSetup.h:57
TestCUDAProducerGPUKernel
Definition: TestCUDAProducerGPUKernel.h:19
Product.h
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
ScopedContext.h
Thing.h
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
TestCUDAProducerGPU::dstToken_
const edm::EDPutTokenT< cms::cuda::Product< cms::cudatest::Thing > > dstToken_
Definition: TestCUDAProducerGPU.cc:26
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21