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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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 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<bool>("doSplitting"),
69  conf.getParameter<int>("minT"),
70  conf.getParameter<double>("eps"),
71  conf.getParameter<double>("errmax"),
72  conf.getParameter<double>("chi2max")),
73  ptMin_(conf.getParameter<double>("PtMin")), // 0.5 GeV
74  ptMax_(conf.getParameter<double>("PtMax")) // 75. GeV
75 {
76  if (onGPU_) {
77  tokenGPUTrack_ = consumes(conf.getParameter<edm::InputTag>("pixelTrackSrc"));
79  } else {
80  tokenCPUTrack_ = consumes(conf.getParameter<edm::InputTag>("pixelTrackSrc"));
82  }
83 }
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 86 of file PixelVertexProducerCUDA.cc.

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

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

References iEvent.

151  {
152  if (onGPU_) {
153  produceOnGPU(streamID, iEvent, iSetup);
154  } else {
155  produceOnCPU(streamID, iEvent, iSetup);
156  }
157 }
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 124 of file PixelVertexProducerCUDA.cc.

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

126  {
127  auto& tracks = iEvent.get(tokenCPUTrack_);
128 
129 #ifdef PIXVERTEX_DEBUG_PRODUCE
130  auto const& tsoa = *tracks;
131  auto maxTracks = tsoa.stride();
132  std::cout << "size of SoA " << sizeof(tsoa) << " stride " << maxTracks << std::endl;
133 
134  int32_t nt = 0;
135  for (int32_t it = 0; it < maxTracks; ++it) {
137  assert(nHits == int(tracks.view().hitIndices().size(it)));
138  if (nHits == 0)
139  break; // this is a guard: maybe we need to move to nTracks...
140  nt++;
141  }
142  std::cout << "found " << nt << " tracks in cpu SoA for Vertexing at " << tracks << std::endl;
143 #endif // PIXVERTEX_DEBUG_PRODUCE
144 
145  iEvent.emplace(tokenCPUVertex_, gpuAlgo_.make(tracks.view(), ptMin_, ptMax_));
146 }
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 111 of file PixelVertexProducerCUDA.cc.

References iEvent, and DiMuonV_cfg::tracks.

113  {
115  auto hTracks = iEvent.getHandle(tokenGPUTrack_);
116 
117  cms::cuda::ScopedContextProduce ctx{*hTracks};
118  auto& tracks = ctx.get(*hTracks);
119 
120  ctx.emplace(iEvent, tokenGPUVertex_, gpuAlgo_.makeAsync(ctx.stream(), tracks.view(), ptMin_, ptMax_));
121 }
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