CMS 3D CMS Logo

CAHitNtupletCUDA.cc
Go to the documentation of this file.
1 #include <cuda_runtime.h>
2 
20 
24 
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 
41 
43 };
44 
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 
59 
60  desc.add<bool>("onGPU", true);
61  desc.add<edm::InputTag>("pixelRecHitSrc", edm::InputTag("siPixelRecHitsPreSplittingCUDA"));
62 
64  descriptions.add("pixelTracksCUDA", desc);
65 }
66 
68  auto bf = 1. / PixelRecoUtilities::fieldInInvGev(es);
69 
70  if (onGPU_) {
71  auto hHits = iEvent.getHandle(tokenHitGPU_);
72 
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_);
80  }
81 }
82 
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