CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PixelVertexProducerCUDA Class Reference
Inheritance diagram for PixelVertexProducerCUDA:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PixelVertexProducerCUDA (const edm::ParameterSet &iConfig)
 
 ~PixelVertexProducerCUDA () override=default
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
void produceOnCPU (edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const
 
void produceOnGPU (edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const
 

Private Attributes

const gpuVertexFinder::Producer gpuAlgo_
 
bool onGPU_
 
const float ptMin_
 
edm::EDGetTokenT< PixelTrackHeterogeneoustokenCPUTrack_
 
edm::EDPutTokenT< ZVertexHeterogeneoustokenCPUVertex_
 
edm::EDGetTokenT< cms::cuda::Product< PixelTrackHeterogeneous > > tokenGPUTrack_
 
edm::EDPutTokenT< ZVertexCUDAProducttokenGPUVertex_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 24 of file PixelVertexProducerCUDA.cc.

Constructor & Destructor Documentation

◆ PixelVertexProducerCUDA()

PixelVertexProducerCUDA::PixelVertexProducerCUDA ( const edm::ParameterSet iConfig)
explicit

Definition at line 49 of file PixelVertexProducerCUDA.cc.

50  : onGPU_(conf.getParameter<bool>("onGPU")),
51  gpuAlgo_(conf.getParameter<bool>("oneKernel"),
52  conf.getParameter<bool>("useDensity"),
53  conf.getParameter<bool>("useDBSCAN"),
54  conf.getParameter<bool>("useIterative"),
55  conf.getParameter<int>("minT"),
56  conf.getParameter<double>("eps"),
57  conf.getParameter<double>("errmax"),
58  conf.getParameter<double>("chi2max")),
59  ptMin_(conf.getParameter<double>("PtMin")) // 0.5 GeV
60 {
61  if (onGPU_) {
63  consumes<cms::cuda::Product<PixelTrackHeterogeneous>>(conf.getParameter<edm::InputTag>("pixelTrackSrc"));
64  tokenGPUVertex_ = produces<ZVertexCUDAProduct>();
65  } else {
66  tokenCPUTrack_ = consumes<PixelTrackHeterogeneous>(conf.getParameter<edm::InputTag>("pixelTrackSrc"));
67  tokenCPUVertex_ = produces<ZVertexHeterogeneous>();
68  }
69 }

References edm::ParameterSet::getParameter(), onGPU_, tokenCPUTrack_, tokenCPUVertex_, tokenGPUTrack_, and tokenGPUVertex_.

◆ ~PixelVertexProducerCUDA()

PixelVertexProducerCUDA::~PixelVertexProducerCUDA ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void PixelVertexProducerCUDA::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 71 of file PixelVertexProducerCUDA.cc.

71  {
73 
74  // Only one of these three algos can be used at once.
75  // Maybe this should become a Plugin Factory
76  desc.add<bool>("onGPU", true);
77  desc.add<bool>("oneKernel", true);
78  desc.add<bool>("useDensity", true);
79  desc.add<bool>("useDBSCAN", false);
80  desc.add<bool>("useIterative", false);
81 
82  desc.add<int>("minT", 2); // min number of neighbours to be "core"
83  desc.add<double>("eps", 0.07); // max absolute distance to cluster
84  desc.add<double>("errmax", 0.01); // max error to be "seed"
85  desc.add<double>("chi2max", 9.); // max normalized distance to cluster
86 
87  desc.add<double>("PtMin", 0.5);
88  desc.add<edm::InputTag>("pixelTrackSrc", edm::InputTag("caHitNtupletCUDA"));
89 
90  auto label = "pixelVertexCUDA";
91  descriptions.add(label, desc);
92 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and label.

◆ produce()

void PixelVertexProducerCUDA::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 133 of file PixelVertexProducerCUDA.cc.

133  {
134  if (onGPU_) {
135  produceOnGPU(streamID, iEvent, iSetup);
136  } else {
137  produceOnCPU(streamID, iEvent, iSetup);
138  }
139 }

References iEvent, onGPU_, produceOnCPU(), and produceOnGPU().

◆ produceOnCPU()

void PixelVertexProducerCUDA::produceOnCPU ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
private

Definition at line 108 of file PixelVertexProducerCUDA.cc.

110  {
111  auto const* tracks = iEvent.get(tokenCPUTrack_).get();
112  assert(tracks);
113 
114 #ifdef PIXVERTEX_DEBUG_PRODUCE
115  auto const& tsoa = *tracks;
116  auto maxTracks = tsoa.stride();
117  std::cout << "size of SoA " << sizeof(tsoa) << " stride " << maxTracks << std::endl;
118 
119  int32_t nt = 0;
120  for (int32_t it = 0; it < maxTracks; ++it) {
121  auto nHits = tsoa.nHits(it);
122  assert(nHits == int(tsoa.hitIndices.size(it)));
123  if (nHits == 0)
124  break; // this is a guard: maybe we need to move to nTracks...
125  nt++;
126  }
127  std::cout << "found " << nt << " tracks in cpu SoA for Vertexing at " << tracks << std::endl;
128 #endif // PIXVERTEX_DEBUG_PRODUCE
129 
131 }

References cms::cuda::assert(), gather_cfg::cout, gpuAlgo_, iEvent, gpuVertexFinder::Producer::make(), HLT_FULL_cff::maxTracks, nHits, nt, ptMin_, tokenCPUTrack_, tokenCPUVertex_, and tracks.

Referenced by produce().

◆ produceOnGPU()

void PixelVertexProducerCUDA::produceOnGPU ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
private

Definition at line 94 of file PixelVertexProducerCUDA.cc.

96  {
98  iEvent.getByToken(tokenGPUTrack_, hTracks);
99 
100  cms::cuda::ScopedContextProduce ctx{*hTracks};
101  auto const* tracks = ctx.get(*hTracks).get();
102 
103  assert(tracks);
104 
105  ctx.emplace(iEvent, tokenGPUVertex_, gpuAlgo_.makeAsync(ctx.stream(), tracks, ptMin_));
106 }

References cms::cuda::assert(), gpuAlgo_, iEvent, gpuVertexFinder::Producer::makeAsync(), ptMin_, tokenGPUTrack_, tokenGPUVertex_, and tracks.

Referenced by produce().

Member Data Documentation

◆ gpuAlgo_

const gpuVertexFinder::Producer PixelVertexProducerCUDA::gpuAlgo_
private

Definition at line 43 of file PixelVertexProducerCUDA.cc.

Referenced by produceOnCPU(), and produceOnGPU().

◆ onGPU_

bool PixelVertexProducerCUDA::onGPU_
private

Definition at line 36 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produce().

◆ ptMin_

const float PixelVertexProducerCUDA::ptMin_
private

Definition at line 46 of file PixelVertexProducerCUDA.cc.

Referenced by produceOnCPU(), and produceOnGPU().

◆ tokenCPUTrack_

edm::EDGetTokenT<PixelTrackHeterogeneous> PixelVertexProducerCUDA::tokenCPUTrack_
private

Definition at line 40 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produceOnCPU().

◆ tokenCPUVertex_

edm::EDPutTokenT<ZVertexHeterogeneous> PixelVertexProducerCUDA::tokenCPUVertex_
private

Definition at line 41 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produceOnCPU().

◆ tokenGPUTrack_

edm::EDGetTokenT<cms::cuda::Product<PixelTrackHeterogeneous> > PixelVertexProducerCUDA::tokenGPUTrack_
private

Definition at line 38 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produceOnGPU().

◆ tokenGPUVertex_

edm::EDPutTokenT<ZVertexCUDAProduct> PixelVertexProducerCUDA::tokenGPUVertex_
private

Definition at line 39 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produceOnGPU().

PixelVertexProducerCUDA::tokenCPUVertex_
edm::EDPutTokenT< ZVertexHeterogeneous > tokenCPUVertex_
Definition: PixelVertexProducerCUDA.cc:41
PixelVertexProducerCUDA::tokenGPUVertex_
edm::EDPutTokenT< ZVertexCUDAProduct > tokenGPUVertex_
Definition: PixelVertexProducerCUDA.cc:39
cms::cuda::ScopedContextProduce
Definition: ScopedContext.h:149
nt
int nt
Definition: AMPTWrapper.h:42
gpuVertexFinder::Producer::makeAsync
ZVertexHeterogeneous makeAsync(cudaStream_t stream, TkSoA const *tksoa, float ptMin) const
PixelVertexProducerCUDA::tokenGPUTrack_
edm::EDGetTokenT< cms::cuda::Product< PixelTrackHeterogeneous > > tokenGPUTrack_
Definition: PixelVertexProducerCUDA.cc:38
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::cuda::assert
assert(be >=bs)
edm::Handle
Definition: AssociativeIterator.h:50
PixelVertexProducerCUDA::produceOnGPU
void produceOnGPU(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const
Definition: PixelVertexProducerCUDA.cc:94
gpuVertexFinder::Producer::make
ZVertexHeterogeneous make(TkSoA const *tksoa, float ptMin) const
Definition: gpuVertexFinderImpl.h:105
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
nHits
const caConstants::TupleMultiplicity *__restrict__ const HitsOnGPU *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ uint32_t nHits
Definition: BrokenLineFitOnGPU.h:27
PixelVertexProducerCUDA::ptMin_
const float ptMin_
Definition: PixelVertexProducerCUDA.cc:46
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
PixelVertexProducerCUDA::produceOnCPU
void produceOnCPU(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const
Definition: PixelVertexProducerCUDA.cc:108
HLT_FULL_cff.maxTracks
maxTracks
Definition: HLT_FULL_cff.py:33248
iEvent
int iEvent
Definition: GenABIO.cc:224
PixelVertexProducerCUDA::onGPU_
bool onGPU_
Definition: PixelVertexProducerCUDA.cc:36
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
PixelVertexProducerCUDA::gpuAlgo_
const gpuVertexFinder::Producer gpuAlgo_
Definition: PixelVertexProducerCUDA.cc:43
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
PixelVertexProducerCUDA::tokenCPUTrack_
edm::EDGetTokenT< PixelTrackHeterogeneous > tokenCPUTrack_
Definition: PixelVertexProducerCUDA.cc:40