CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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 ptMin_
 
edm::EDGetTokenT
< PixelTrackHeterogeneous
tokenCPUTrack_
 
edm::EDPutTokenT
< ZVertexHeterogeneous
tokenCPUVertex_
 
edm::EDGetTokenT
< cms::cuda::Product
< PixelTrackHeterogeneous > > 
tokenGPUTrack_
 
edm::EDPutTokenT
< ZVertexCUDAProduct
tokenGPUVertex_
 

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
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< B > consumes (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 () noexcept
 
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...
 
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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 49 of file PixelVertexProducerCUDA.cc.

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

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 }
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 ( )
overridedefault

Member Function Documentation

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

Definition at line 71 of file PixelVertexProducerCUDA.cc.

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

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("pixelTracksCUDA"));
89 
90  auto label = "pixelVerticesCUDA";
91  descriptions.add(label, desc);
92 }
char const * label
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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.

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

133  {
134  if (onGPU_) {
135  produceOnGPU(streamID, iEvent, iSetup);
136  } else {
137  produceOnCPU(streamID, iEvent, iSetup);
138  }
139 }
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
void PixelVertexProducerCUDA::produceOnCPU ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
private

Definition at line 108 of file PixelVertexProducerCUDA.cc.

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

Referenced by produce().

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 }
edm::EDPutTokenT< ZVertexHeterogeneous > tokenCPUVertex_
auto const & tracks
cannot be loose
ZVertexHeterogeneous make(TkSoA const *tksoa, float ptMin) const
assert(be >=bs)
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
int nt
Definition: AMPTWrapper.h:42
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
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
edm::EDGetTokenT< PixelTrackHeterogeneous > tokenCPUTrack_
tuple cout
Definition: gather_cfg.py:144
const gpuVertexFinder::Producer gpuAlgo_
void PixelVertexProducerCUDA::produceOnGPU ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
private

Definition at line 94 of file PixelVertexProducerCUDA.cc.

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

Referenced by produce().

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 }
edm::EDPutTokenT< ZVertexCUDAProduct > tokenGPUVertex_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< cms::cuda::Product< PixelTrackHeterogeneous > > tokenGPUTrack_
auto const & tracks
cannot be loose
assert(be >=bs)
ZVertexHeterogeneous makeAsync(cudaStream_t stream, TkSoA const *tksoa, float ptMin) const
const gpuVertexFinder::Producer gpuAlgo_

Member Data Documentation

const gpuVertexFinder::Producer PixelVertexProducerCUDA::gpuAlgo_
private

Definition at line 43 of file PixelVertexProducerCUDA.cc.

Referenced by produceOnCPU(), and produceOnGPU().

bool PixelVertexProducerCUDA::onGPU_
private

Definition at line 36 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produce().

const float PixelVertexProducerCUDA::ptMin_
private

Definition at line 46 of file PixelVertexProducerCUDA.cc.

Referenced by produceOnCPU(), and produceOnGPU().

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

Definition at line 40 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produceOnCPU().

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

Definition at line 41 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produceOnCPU().

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

Definition at line 38 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produceOnGPU().

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

Definition at line 39 of file PixelVertexProducerCUDA.cc.

Referenced by PixelVertexProducerCUDA(), and produceOnGPU().