HeterogeneousCore
CUDATest
plugins
TestCUDAProducerGPUFirst.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Event.h
"
2
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
3
#include "
FWCore/Framework/interface/MakerMacros.h
"
4
#include "
FWCore/Framework/interface/global/EDProducer.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
6
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
7
8
#include "
CUDADataFormats/Common/interface/Product.h
"
9
#include "
HeterogeneousCore/CUDACore/interface/ScopedContext.h
"
10
#include "
HeterogeneousCore/CUDATest/interface/Thing.h
"
11
12
#include "
TestCUDAProducerGPUKernel.h
"
13
14
class
TestCUDAProducerGPUFirst
:
public
edm::global::EDProducer
<> {
15
public
:
16
explicit
TestCUDAProducerGPUFirst
(
edm::ParameterSet
const
& iConfig);
17
~TestCUDAProducerGPUFirst
()
override
=
default
;
18
19
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
20
21
void
produce
(
edm::StreamID
stream
,
edm::Event
&
iEvent
,
edm::EventSetup
const
& iSetup)
const override
;
22
23
private
:
24
std::string
const
label_
;
25
edm::EDPutTokenT<cms::cuda::Product<cms::cudatest::Thing>
>
const
dstToken_
;
26
TestCUDAProducerGPUKernel
const
gpuAlgo_
;
27
};
28
29
TestCUDAProducerGPUFirst::TestCUDAProducerGPUFirst
(
edm::ParameterSet
const
& iConfig)
30
: label_(iConfig.getParameter<
std
::
string
>(
"@module_label"
)),
31
dstToken_{produces<cms::cuda::Product<cms::cudatest::Thing>>()} {}
32
33
void
TestCUDAProducerGPUFirst::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
34
edm::ParameterSetDescription
desc;
35
descriptions.
addWithDefaultLabel
(desc);
36
descriptions.
setComment
(
37
"This EDProducer is part of the TestCUDAProducer* family. It models a GPU algorithm this the first algorithm in "
38
"the chain of the GPU EDProducers. Produces cms::cuda::Productcms::cudatest::Thing>."
);
39
}
40
41
void
TestCUDAProducerGPUFirst::produce
(
edm::StreamID
streamID,
42
edm::Event
&
iEvent
,
43
edm::EventSetup
const
& iSetup)
const
{
44
edm::LogVerbatim
(
"TestCUDAProducerGPUFirst"
) <<
label_
<<
" TestCUDAProducerGPUFirst::produce begin event "
45
<<
iEvent
.id().event() <<
" stream "
<<
iEvent
.streamID();
46
47
cms::cuda::ScopedContextProduce
ctx{streamID};
48
49
cms::cuda::device::unique_ptr<float[]>
output
=
gpuAlgo_
.
runAlgo
(
label_
, ctx.stream());
50
ctx.emplace(
iEvent
,
dstToken_
,
std::move
(
output
));
51
52
edm::LogVerbatim
(
"TestCUDAProducerGPUFirst"
) <<
label_
<<
" TestCUDAProducerGPUFirst::produce end event "
53
<<
iEvent
.id().event() <<
" stream "
<<
iEvent
.streamID();
54
}
55
56
DEFINE_FWK_MODULE
(
TestCUDAProducerGPUFirst
);
edm::StreamID
Definition:
StreamID.h:30
TestCUDAProducerGPUFirst::label_
const std::string label_
Definition:
TestCUDAProducerGPUFirst.cc:24
TestCUDAProducerGPUKernel::runAlgo
cms::cuda::device::unique_ptr< float[]> runAlgo(const std::string &label, cudaStream_t stream) const
Definition:
TestCUDAProducerGPUKernel.h:27
cms::cuda::ScopedContextProduce
Definition:
ScopedContext.h:149
convertSQLitetoXML_cfg.output
output
Definition:
convertSQLitetoXML_cfg.py:32
edm::EDPutTokenT
Definition:
EDPutToken.h:33
cms::cuda::stream
cudaStream_t stream
Definition:
HistoContainer.h:57
TestCUDAProducerGPUFirst::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
TestCUDAProducerGPUFirst.cc:33
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
TestCUDAProducerGPUKernel.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
TestCUDAProducerGPUFirst
Definition:
TestCUDAProducerGPUFirst.cc:14
TestCUDAProducerGPUFirst::produce
void produce(edm::StreamID stream, edm::Event &iEvent, edm::EventSetup const &iSetup) const override
Definition:
TestCUDAProducerGPUFirst.cc:41
TestCUDAProducerGPUFirst::~TestCUDAProducerGPUFirst
~TestCUDAProducerGPUFirst() override=default
ParameterSetDescription.h
TestCUDAProducerGPUFirst::TestCUDAProducerGPUFirst
TestCUDAProducerGPUFirst(edm::ParameterSet const &iConfig)
Definition:
TestCUDAProducerGPUFirst.cc:29
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition:
ConfigurationDescriptions.cc:48
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::LogVerbatim
Definition:
MessageLogger.h:297
edm::EventSetup
Definition:
EventSetup.h:57
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition:
device_unique_ptr.h:33
TestCUDAProducerGPUKernel
Definition:
TestCUDAProducerGPUKernel.h:19
Product.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
Frameworkfwd.h
ScopedContext.h
Thing.h
TestCUDAProducerGPUFirst::gpuAlgo_
const TestCUDAProducerGPUKernel gpuAlgo_
Definition:
TestCUDAProducerGPUFirst.cc:26
ParameterSet.h
EDProducer.h
edm::Event
Definition:
Event.h:73
TestCUDAProducerGPUFirst::dstToken_
const edm::EDPutTokenT< cms::cuda::Product< cms::cudatest::Thing > > dstToken_
Definition:
TestCUDAProducerGPUFirst.cc:25
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:87
Generated for CMSSW Reference Manual by
1.8.16