RecoPixelVertexing
PixelTriplets
plugins
CAHitNtupletCUDA.cc
Go to the documentation of this file.
1
#include <cuda_runtime.h>
2
3
#include "
CUDADataFormats/Common/interface/Product.h
"
4
#include "
DataFormats/Common/interface/Handle.h
"
5
#include "
FWCore/Framework/interface/ESHandle.h
"
6
#include "
FWCore/Framework/interface/Event.h
"
7
#include "
FWCore/Framework/interface/EventSetup.h
"
8
#include "
FWCore/Framework/interface/MakerMacros.h
"
9
#include "
FWCore/Framework/interface/global/EDProducer.h
"
10
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
11
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
12
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
13
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
14
#include "
FWCore/Utilities/interface/InputTag.h
"
15
#include "
FWCore/PluginManager/interface/ModuleDef.h
"
16
#include "
FWCore/Utilities/interface/EDGetToken.h
"
17
#include "
FWCore/Utilities/interface/RunningAverage.h
"
18
#include "
HeterogeneousCore/CUDACore/interface/ScopedContext.h
"
19
#include "
RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h
"
20
21
#include "
CAHitNtupletGeneratorOnGPU.h
"
22
#include "
CUDADataFormats/Track/interface/PixelTrackHeterogeneous.h
"
23
#include "
CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h
"
24
25
class
CAHitNtupletCUDA
:
public
edm::global::EDProducer
<> {
26
public
:
27
explicit
CAHitNtupletCUDA
(
const
edm::ParameterSet
& iConfig);
28
~CAHitNtupletCUDA
()
override
=
default
;
29
30
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
31
32
private
:
33
void
produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const override
;
34
35
bool
onGPU_
;
36
37
edm::EDGetTokenT<cms::cuda::Product<TrackingRecHit2DGPU>
>
tokenHitGPU_
;
38
edm::EDPutTokenT<cms::cuda::Product<PixelTrackHeterogeneous>
>
tokenTrackGPU_
;
39
edm::EDGetTokenT<TrackingRecHit2DCPU>
tokenHitCPU_
;
40
edm::EDPutTokenT<PixelTrackHeterogeneous>
tokenTrackCPU_
;
41
42
CAHitNtupletGeneratorOnGPU
gpuAlgo_
;
43
};
44
45
CAHitNtupletCUDA::CAHitNtupletCUDA
(
const
edm::ParameterSet
& iConfig)
46
: onGPU_(iConfig.getParameter<
bool
>(
"onGPU"
)), gpuAlgo_(iConfig, consumesCollector()) {
47
if
(
onGPU_
) {
48
tokenHitGPU_
=
49
consumes<cms::cuda::Product<TrackingRecHit2DGPU>>(iConfig.
getParameter
<
edm::InputTag
>(
"pixelRecHitSrc"
));
50
tokenTrackGPU_
= produces<cms::cuda::Product<PixelTrackHeterogeneous>>();
51
}
else
{
52
tokenHitCPU_
= consumes<TrackingRecHit2DCPU>(iConfig.
getParameter
<
edm::InputTag
>(
"pixelRecHitSrc"
));
53
tokenTrackCPU_
= produces<PixelTrackHeterogeneous>();
54
}
55
}
56
57
void
CAHitNtupletCUDA::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
58
edm::ParameterSetDescription
desc
;
59
60
desc
.add<
bool
>(
"onGPU"
,
true
);
61
desc
.add<
edm::InputTag
>(
"pixelRecHitSrc"
,
edm::InputTag
(
"siPixelRecHitsPreSplittingCUDA"
));
62
63
CAHitNtupletGeneratorOnGPU::fillDescriptions
(
desc
);
64
descriptions.
add
(
"pixelTracksCUDA"
,
desc
);
65
}
66
67
void
CAHitNtupletCUDA::produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
const
edm::EventSetup
& es)
const
{
68
auto
bf = 1. /
PixelRecoUtilities::fieldInInvGev
(es);
69
70
if
(
onGPU_
) {
71
auto
hHits =
iEvent
.getHandle(
tokenHitGPU_
);
72
73
cms::cuda::ScopedContextProduce
ctx{*hHits};
74
auto
const
&
hits
= ctx.get(*hHits);
75
76
ctx.emplace(
iEvent
,
tokenTrackGPU_
,
gpuAlgo_
.
makeTuplesAsync
(
hits
, bf, ctx.stream()));
77
}
else
{
78
auto
const
&
hits
=
iEvent
.get(
tokenHitCPU_
);
79
iEvent
.emplace(
tokenTrackCPU_
,
gpuAlgo_
.
makeTuples
(
hits
, bf));
80
}
81
}
82
83
DEFINE_FWK_MODULE
(
CAHitNtupletCUDA
);
ConfigurationDescriptions.h
RunningAverage.h
edm::StreamID
Definition:
StreamID.h:30
Handle.h
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
PixelRecoUtilities::fieldInInvGev
float fieldInInvGev(const edm::EventSetup &iSetup)
Definition:
PixelRecoUtilities.h:25
hfClusterShapes_cfi.hits
hits
Definition:
hfClusterShapes_cfi.py:5
ESHandle.h
cms::cuda::ScopedContextProduce
Definition:
ScopedContext.h:149
edm::EDGetTokenT
Definition:
EDGetToken.h:33
CAHitNtupletCUDA::CAHitNtupletCUDA
CAHitNtupletCUDA(const edm::ParameterSet &iConfig)
Definition:
CAHitNtupletCUDA.cc:45
edm::EDPutTokenT
Definition:
EDPutToken.h:33
TrackingRecHit2DHeterogeneous.h
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
CAHitNtupletGeneratorOnGPU.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
CAHitNtupletCUDA
Definition:
CAHitNtupletCUDA.cc:25
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
CAHitNtupletCUDA::tokenTrackGPU_
edm::EDPutTokenT< cms::cuda::Product< PixelTrackHeterogeneous > > tokenTrackGPU_
Definition:
CAHitNtupletCUDA.cc:38
CAHitNtupletCUDA::~CAHitNtupletCUDA
~CAHitNtupletCUDA() override=default
PixelRecoUtilities.h
ParameterSetDescription.h
CAHitNtupletCUDA::onGPU_
bool onGPU_
Definition:
CAHitNtupletCUDA.cc:35
EDGetToken.h
CAHitNtupletGeneratorOnGPU::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &desc)
Definition:
CAHitNtupletGeneratorOnGPU.cc:130
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
CAHitNtupletGeneratorOnGPU
Definition:
CAHitNtupletGeneratorOnGPU.h:24
CAHitNtupletCUDA::produce
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition:
CAHitNtupletCUDA.cc:67
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
CAHitNtupletCUDA::tokenHitCPU_
edm::EDGetTokenT< TrackingRecHit2DCPU > tokenHitCPU_
Definition:
CAHitNtupletCUDA.cc:39
ModuleDef.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:58
CAHitNtupletGeneratorOnGPU::makeTuplesAsync
PixelTrackHeterogeneous makeTuplesAsync(TrackingRecHit2DGPU const &hits_d, float bfield, cudaStream_t stream) const
Definition:
CAHitNtupletGeneratorOnGPU.cc:176
InputTag.h
CAHitNtupletGeneratorOnGPU::makeTuples
PixelTrackHeterogeneous makeTuples(TrackingRecHit2DCPU const &hits_d, float bfield) const
Definition:
CAHitNtupletGeneratorOnGPU.cc:207
Product.h
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
ScopedContext.h
CAHitNtupletCUDA::tokenTrackCPU_
edm::EDPutTokenT< PixelTrackHeterogeneous > tokenTrackCPU_
Definition:
CAHitNtupletCUDA.cc:40
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
PixelTrackHeterogeneous.h
CAHitNtupletCUDA::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
CAHitNtupletCUDA.cc:57
CAHitNtupletCUDA::gpuAlgo_
CAHitNtupletGeneratorOnGPU gpuAlgo_
Definition:
CAHitNtupletCUDA.cc:42
ConsumesCollector.h
ParameterSet.h
EDProducer.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
CAHitNtupletCUDA::tokenHitGPU_
edm::EDGetTokenT< cms::cuda::Product< TrackingRecHit2DGPU > > tokenHitGPU_
Definition:
CAHitNtupletCUDA.cc:37
Generated for CMSSW Reference Manual by
1.8.16