src
HeterogeneousCore
CUDATest
plugins
TestPortableProducerCUDA.cc
Go to the documentation of this file.
1
#include "
CUDADataFormats/Common/interface/Product.h
"
2
#include "
CUDADataFormats/PortableTestObjects/interface/TestDeviceCollection.h
"
3
#include "
FWCore/Framework/interface/Event.h
"
4
#include "
FWCore/Framework/interface/EventSetup.h
"
5
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
6
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
7
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
8
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
9
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
10
#include "
FWCore/Utilities/interface/EDGetToken.h
"
11
#include "
FWCore/Utilities/interface/InputTag.h
"
12
#include "
FWCore/Utilities/interface/StreamID.h
"
13
#include "
HeterogeneousCore/CUDACore/interface/ScopedContext.h
"
14
15
#include "
TestAlgo.h
"
16
17
class
TestPortableProducerCUDA
:
public
edm::stream::EDProducer
<> {
18
public
:
19
TestPortableProducerCUDA
(
edm::ParameterSet
const
&
config
)
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) {
35
edm::ParameterSetDescription
desc
;
36
desc
.add<int32_t>(
"size"
);
37
descriptions.
addWithDefaultLabel
(
desc
);
38
}
39
40
private
:
41
const
edm::EDPutTokenT<cms::cuda::Product<cudatest::TestDeviceCollection>
>
deviceToken_
;
42
const
int32_t
size_
;
43
44
// implementation of the algorithm
45
cudatest::TestAlgo
algo_
;
46
};
47
48
#include "
FWCore/Framework/interface/MakerMacros.h
"
49
DEFINE_FWK_MODULE
(
TestPortableProducerCUDA
);
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:87
TestPortableProducerCUDA::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
TestPortableProducerCUDA.cc:34
EDProducer.h
TestPortableProducerCUDA::produce
void produce(edm::Event &event, edm::EventSetup const &) override
Definition:
TestPortableProducerCUDA.cc:22
cms::cuda::PortableDeviceCollection
Definition:
PortableDeviceCollection.h:13
Event.h
TestPortableProducerCUDA
Definition:
TestPortableProducerCUDA.cc:17
EventSetup.h
cudatest::TestAlgo::fill
void fill(cudatest::TestDeviceCollection &collection, cudaStream_t stream) const
config
Definition:
config.py:1
ScopedContext.h
Frameworkfwd.h
edm::EDPutTokenT
Definition:
EDPutToken.h:33
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
ParameterSet.h
TestPortableProducerCUDA::size_
const int32_t size_
Definition:
TestPortableProducerCUDA.cc:42
ParameterSetDescription.h
TestPortableProducerCUDA::algo_
cudatest::TestAlgo algo_
Definition:
TestPortableProducerCUDA.cc:45
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
StreamID.h
edm::EventSetup
Definition:
EventSetup.h:56
EDGetToken.h
Product.h
TestAlgo.h
edm::stream::EDProducer
Definition:
EDProducer.h:36
TestPortableProducerCUDA::TestPortableProducerCUDA
TestPortableProducerCUDA(edm::ParameterSet const &config)
Definition:
TestPortableProducerCUDA.cc:19
cudatest::TestAlgo
Definition:
TestAlgo.h:9
InputTag.h
TestDeviceCollection.h
edm::ParameterSet
Definition:
ParameterSet.h:48
ConfigurationDescriptions.h
edm::Event
Definition:
Event.h:73
cms::cuda::ScopedContextProduce
Definition:
ScopedContext.h:149
MakerMacros.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
TestPortableProducerCUDA::deviceToken_
const edm::EDPutTokenT< cms::cuda::Product< cudatest::TestDeviceCollection > > deviceToken_
Definition:
TestPortableProducerCUDA.cc:41
event
Definition:
event.py:1
Generated for CMSSW Reference Manual by
1.8.14