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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 ptMax_
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file PixelVertexProducerCUDA.cc.

Constructor & Destructor Documentation

◆ PixelVertexProducerCUDA()

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

Definition at line 50 of file PixelVertexProducerCUDA.cc.

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

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

◆ ~PixelVertexProducerCUDA()

PixelVertexProducerCUDA::~PixelVertexProducerCUDA ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 73 of file PixelVertexProducerCUDA.cc.

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

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

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 136 of file PixelVertexProducerCUDA.cc.

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

136  {
137  if (onGPU_) {
138  produceOnGPU(streamID, iEvent, iSetup);
139  } else {
140  produceOnCPU(streamID, iEvent, iSetup);
141  }
142 }
void produceOnGPU(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const
int iEvent
Definition: GenABIO.cc:224
void produceOnCPU(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const

◆ produceOnCPU()

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

Definition at line 111 of file PixelVertexProducerCUDA.cc.

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

Referenced by produce().

113  {
114  auto const* tracks = iEvent.get(tokenCPUTrack_).get();
115  assert(tracks);
116 
117 #ifdef PIXVERTEX_DEBUG_PRODUCE
118  auto const& tsoa = *tracks;
119  auto maxTracks = tsoa.stride();
120  std::cout << "size of SoA " << sizeof(tsoa) << " stride " << maxTracks << std::endl;
121 
122  int32_t nt = 0;
123  for (int32_t it = 0; it < maxTracks; ++it) {
124  auto nHits = tsoa.nHits(it);
125  assert(nHits == int(tsoa.hitIndices.size(it)));
126  if (nHits == 0)
127  break; // this is a guard: maybe we need to move to nTracks...
128  nt++;
129  }
130  std::cout << "found " << nt << " tracks in cpu SoA for Vertexing at " << tracks << std::endl;
131 #endif // PIXVERTEX_DEBUG_PRODUCE
132 
134 }
edm::EDPutTokenT< ZVertexHeterogeneous > tokenCPUVertex_
assert(be >=bs)
int iEvent
Definition: GenABIO.cc:224
int nt
Definition: AMPTWrapper.h:42
auto const & tracks
cannot be loose
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
ZVertexHeterogeneous make(TkSoA const *tksoa, float ptMin, float ptMax) const
edm::EDGetTokenT< PixelTrackHeterogeneous > tokenCPUTrack_
const gpuVertexFinder::Producer gpuAlgo_

◆ produceOnGPU()

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

Definition at line 97 of file PixelVertexProducerCUDA.cc.

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

Referenced by produce().

99  {
101  iEvent.getByToken(tokenGPUTrack_, hTracks);
102 
103  cms::cuda::ScopedContextProduce ctx{*hTracks};
104  auto const* tracks = ctx.get(*hTracks).get();
105 
106  assert(tracks);
107 
108  ctx.emplace(iEvent, tokenGPUVertex_, gpuAlgo_.makeAsync(ctx.stream(), tracks, ptMin_, ptMax_));
109 }
ZVertexHeterogeneous makeAsync(cudaStream_t stream, TkSoA const *tksoa, float ptMin, float ptMax) const
edm::EDPutTokenT< ZVertexCUDAProduct > tokenGPUVertex_
edm::EDGetTokenT< cms::cuda::Product< PixelTrackHeterogeneous > > tokenGPUTrack_
assert(be >=bs)
int iEvent
Definition: GenABIO.cc:224
auto const & tracks
cannot be loose
const gpuVertexFinder::Producer gpuAlgo_

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().

◆ ptMax_

const float PixelVertexProducerCUDA::ptMax_
private

Definition at line 47 of file PixelVertexProducerCUDA.cc.

Referenced by produceOnCPU(), and produceOnGPU().

◆ 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().