CMS 3D CMS Logo

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

Public Member Functions

 PixelVertexProducerCUDAT (const edm::ParameterSet &iConfig)
 
 ~PixelVertexProducerCUDAT () 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 Types

using GPUAlgo = gpuVertexFinder::Producer< TrackerTraits >
 
using TracksSoADevice = TrackSoAHeterogeneousDevice< TrackerTraits >
 
using TracksSoAHost = TrackSoAHeterogeneousHost< TrackerTraits >
 

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 GPUAlgo gpuAlgo_
 
bool onGPU_
 
const float ptMax_
 
const float ptMin_
 
edm::EDGetTokenT< TracksSoAHosttokenCPUTrack_
 
edm::EDPutTokenT< ZVertexSoAHosttokenCPUVertex_
 
edm::EDGetTokenT< cms::cuda::Product< TracksSoADevice > > tokenGPUTrack_
 
edm::EDPutTokenT< cms::cuda::Product< ZVertexSoADevice > > tokenGPUVertex_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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

template<typename TrackerTraits>
class PixelVertexProducerCUDAT< TrackerTraits >

Definition at line 31 of file PixelVertexProducerCUDA.cc.

Member Typedef Documentation

◆ GPUAlgo

template<typename TrackerTraits >
using PixelVertexProducerCUDAT< TrackerTraits >::GPUAlgo = gpuVertexFinder::Producer<TrackerTraits>
private

Definition at line 34 of file PixelVertexProducerCUDA.cc.

◆ TracksSoADevice

template<typename TrackerTraits >
using PixelVertexProducerCUDAT< TrackerTraits >::TracksSoADevice = TrackSoAHeterogeneousDevice<TrackerTraits>
private

Definition at line 32 of file PixelVertexProducerCUDA.cc.

◆ TracksSoAHost

template<typename TrackerTraits >
using PixelVertexProducerCUDAT< TrackerTraits >::TracksSoAHost = TrackSoAHeterogeneousHost<TrackerTraits>
private

Definition at line 33 of file PixelVertexProducerCUDA.cc.

Constructor & Destructor Documentation

◆ PixelVertexProducerCUDAT()

template<typename TrackerTraits >
PixelVertexProducerCUDAT< TrackerTraits >::PixelVertexProducerCUDAT ( const edm::ParameterSet iConfig)
explicit

Definition at line 62 of file PixelVertexProducerCUDA.cc.

References edm::EDConsumerBase::consumes(), edm::ParameterSet::getParameter(), PixelVertexProducerCUDAT< TrackerTraits >::onGPU_, edm::ProductRegistryHelper::produces(), PixelVertexProducerCUDAT< TrackerTraits >::tokenCPUTrack_, PixelVertexProducerCUDAT< TrackerTraits >::tokenCPUVertex_, PixelVertexProducerCUDAT< TrackerTraits >::tokenGPUTrack_, and PixelVertexProducerCUDAT< TrackerTraits >::tokenGPUVertex_.

63  : onGPU_(conf.getParameter<bool>("onGPU")),
64  gpuAlgo_(conf.getParameter<bool>("oneKernel"),
65  conf.getParameter<bool>("useDensity"),
66  conf.getParameter<bool>("useDBSCAN"),
67  conf.getParameter<bool>("useIterative"),
68  conf.getParameter<int>("minT"),
69  conf.getParameter<double>("eps"),
70  conf.getParameter<double>("errmax"),
71  conf.getParameter<double>("chi2max")),
72  ptMin_(conf.getParameter<double>("PtMin")), // 0.5 GeV
73  ptMax_(conf.getParameter<double>("PtMax")) // 75. GeV
74 {
75  if (onGPU_) {
76  tokenGPUTrack_ = consumes(conf.getParameter<edm::InputTag>("pixelTrackSrc"));
78  } else {
79  tokenCPUTrack_ = consumes(conf.getParameter<edm::InputTag>("pixelTrackSrc"));
81  }
82 }
edm::EDGetTokenT< TracksSoAHost > tokenCPUTrack_
edm::EDPutTokenT< cms::cuda::Product< ZVertexSoADevice > > tokenGPUVertex_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDPutTokenT< ZVertexSoAHost > tokenCPUVertex_
edm::EDGetTokenT< cms::cuda::Product< TracksSoADevice > > tokenGPUTrack_

◆ ~PixelVertexProducerCUDAT()

template<typename TrackerTraits >
PixelVertexProducerCUDAT< TrackerTraits >::~PixelVertexProducerCUDAT ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

template<typename TrackerTraits >
void PixelVertexProducerCUDAT< TrackerTraits >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 85 of file PixelVertexProducerCUDA.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

85  {
87 
88  // Only one of these three algos can be used at once.
89  // Maybe this should become a Plugin Factory
90  desc.add<bool>("onGPU", true);
91  desc.add<bool>("oneKernel", true);
92  desc.add<bool>("useDensity", true);
93  desc.add<bool>("useDBSCAN", false);
94  desc.add<bool>("useIterative", false);
95 
96  desc.add<int>("minT", 2); // min number of neighbours to be "core"
97  desc.add<double>("eps", 0.07); // max absolute distance to cluster
98  desc.add<double>("errmax", 0.01); // max error to be "seed"
99  desc.add<double>("chi2max", 9.); // max normalized distance to cluster
100 
101  desc.add<double>("PtMin", 0.5);
102  desc.add<double>("PtMax", 75.);
103  desc.add<edm::InputTag>("pixelTrackSrc", edm::InputTag("pixelTracksCUDA"));
104 
105  descriptions.addWithDefaultLabel(desc);
106 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

template<typename TrackerTraits >
void PixelVertexProducerCUDAT< TrackerTraits >::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 147 of file PixelVertexProducerCUDA.cc.

References iEvent.

149  {
150  if (onGPU_) {
151  produceOnGPU(streamID, iEvent, iSetup);
152  } else {
153  produceOnCPU(streamID, iEvent, iSetup);
154  }
155 }
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()

template<typename TrackerTraits >
void PixelVertexProducerCUDAT< TrackerTraits >::produceOnCPU ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
private

Definition at line 122 of file PixelVertexProducerCUDA.cc.

References cms::cuda::assert(), gather_cfg::cout, iEvent, DMR_cfg::maxTracks, nHits, TracksUtilities< TrackerTraits >::nHits(), nt, and pwdgSkimBPark_cfi::tracks.

124  {
125  auto& tracks = iEvent.get(tokenCPUTrack_);
126 
127 #ifdef PIXVERTEX_DEBUG_PRODUCE
128  auto const& tsoa = *tracks;
129  auto maxTracks = tsoa.stride();
130  std::cout << "size of SoA " << sizeof(tsoa) << " stride " << maxTracks << std::endl;
131 
132  int32_t nt = 0;
133  for (int32_t it = 0; it < maxTracks; ++it) {
135  assert(nHits == int(tracks.view().hitIndices().size(it)));
136  if (nHits == 0)
137  break; // this is a guard: maybe we need to move to nTracks...
138  nt++;
139  }
140  std::cout << "found " << nt << " tracks in cpu SoA for Vertexing at " << tracks << std::endl;
141 #endif // PIXVERTEX_DEBUG_PRODUCE
142 
143  iEvent.emplace(tokenCPUVertex_, gpuAlgo_.make(tracks.view(), ptMin_, ptMax_));
144 }
ZVertexSoAHost make(const TkSoAConstView &tracks_view, float ptMin, float ptMax) const
edm::EDGetTokenT< TracksSoAHost > tokenCPUTrack_
assert(be >=bs)
int iEvent
Definition: GenABIO.cc:224
edm::EDPutTokenT< ZVertexSoAHost > tokenCPUVertex_
int nt
Definition: AMPTWrapper.h:42
static constexpr __host__ __device__ int nHits(const TrackSoAConstView &tracks, int i)
maxTracks
Definition: DMR_cfg.py:158
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits

◆ produceOnGPU()

template<typename TrackerTraits >
void PixelVertexProducerCUDAT< TrackerTraits >::produceOnGPU ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
private

Definition at line 109 of file PixelVertexProducerCUDA.cc.

References iEvent, and pwdgSkimBPark_cfi::tracks.

111  {
113  auto hTracks = iEvent.getHandle(tokenGPUTrack_);
114 
115  cms::cuda::ScopedContextProduce ctx{*hTracks};
116  auto& tracks = ctx.get(*hTracks);
117 
118  ctx.emplace(iEvent, tokenGPUVertex_, gpuAlgo_.makeAsync(ctx.stream(), tracks.view(), ptMin_, ptMax_));
119 }
ZVertexSoADevice makeAsync(cudaStream_t stream, const TkSoAConstView &tracks_view, float ptMin, float ptMax) const
edm::EDPutTokenT< cms::cuda::Product< ZVertexSoADevice > > tokenGPUVertex_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< cms::cuda::Product< TracksSoADevice > > tokenGPUTrack_

Member Data Documentation

◆ gpuAlgo_

template<typename TrackerTraits >
const GPUAlgo PixelVertexProducerCUDAT< TrackerTraits >::gpuAlgo_
private

Definition at line 54 of file PixelVertexProducerCUDA.cc.

◆ onGPU_

template<typename TrackerTraits >
bool PixelVertexProducerCUDAT< TrackerTraits >::onGPU_
private

◆ ptMax_

template<typename TrackerTraits >
const float PixelVertexProducerCUDAT< TrackerTraits >::ptMax_
private

Definition at line 58 of file PixelVertexProducerCUDA.cc.

◆ ptMin_

template<typename TrackerTraits >
const float PixelVertexProducerCUDAT< TrackerTraits >::ptMin_
private

Definition at line 57 of file PixelVertexProducerCUDA.cc.

◆ tokenCPUTrack_

template<typename TrackerTraits >
edm::EDGetTokenT<TracksSoAHost> PixelVertexProducerCUDAT< TrackerTraits >::tokenCPUTrack_
private

◆ tokenCPUVertex_

template<typename TrackerTraits >
edm::EDPutTokenT<ZVertexSoAHost> PixelVertexProducerCUDAT< TrackerTraits >::tokenCPUVertex_
private

◆ tokenGPUTrack_

template<typename TrackerTraits >
edm::EDGetTokenT<cms::cuda::Product<TracksSoADevice> > PixelVertexProducerCUDAT< TrackerTraits >::tokenGPUTrack_
private

◆ tokenGPUVertex_

template<typename TrackerTraits >
edm::EDPutTokenT<cms::cuda::Product<ZVertexSoADevice> > PixelVertexProducerCUDAT< TrackerTraits >::tokenGPUVertex_
private