11 template <
typename TrackerTraits>
13 caHitNtupletGeneratorKernels::kernel_printCounters(
counters);
16 template <
typename TrackerTraits>
31 std::cout <<
"building Doublets out of " <<
nhits <<
" Hits. BPIX2 offset is " << offsetBPIX2 << std::endl;
38 this->device_isOuterHitOfCell_ = std::make_unique<OuterHitOfCellContainer[]>(
std::max(1
U,
nhits));
39 assert(this->device_isOuterHitOfCell_.get());
40 this->isOuterHitOfCell_ =
OuterHitOfCell{this->device_isOuterHitOfCell_.get(), offsetBPIX2};
42 auto cellStorageSize = TrackerTraits::maxNumOfActiveDoublets *
sizeof(
CellNeighbors) +
43 TrackerTraits::maxNumOfActiveDoublets *
sizeof(
CellTracks);
46 this->cellStorage_ = std::make_unique<unsigned char[]>(cellStorageSize);
47 this->device_theCellNeighborsContainer_ = (
CellNeighbors *)this->cellStorage_.get();
48 this->device_theCellTracksContainer_ =
51 initDoublets<TrackerTraits>(this->isOuterHitOfCell_,
53 this->device_theCellNeighbors_.get(),
54 this->device_theCellNeighborsContainer_,
55 this->device_theCellTracks_.get(),
56 this->device_theCellTracksContainer_);
59 this->device_theCells_ = std::make_unique<GPUCACell[]>(this->params_.caParams_.maxNumberOfDoublets_);
68 getDoubletsFromHisto<TrackerTraits>(this->device_theCells_.get(),
70 this->device_theCellNeighbors_.get(),
71 this->device_theCellTracks_.get(),
73 this->isOuterHitOfCell_,
75 this->params_.caParams_.maxNumberOfDoublets_,
76 this->device_cellCuts_.get());
79 template <
typename TrackerTraits>
82 cudaStream_t cudaStream) {
86 cms::cuda::launchZero(&
tracks_view.hitIndices(), cudaStream);
88 uint32_t
nhits =
hh.metadata().size();
91 std::cout <<
"start tuple building. N hits " <<
nhits << std::endl;
100 kernel_connect<TrackerTraits>(this->device_hitTuple_apc_,
101 this->device_hitToTuple_apc_,
103 this->device_theCells_.get(),
104 this->device_nCells_,
105 this->device_theCellNeighbors_.get(),
106 this->isOuterHitOfCell_,
107 this->params_.caParams_);
109 if (
nhits > 1 && this->params_.earlyFishbone_) {
110 gpuPixelDoublets::fishbone<TrackerTraits>(
111 hh, this->device_theCells_.get(), this->device_nCells_, this->isOuterHitOfCell_,
nhits,
false);
114 kernel_find_ntuplets<TrackerTraits>(
hh,
116 this->device_theCells_.get(),
117 this->device_nCells_,
118 this->device_theCellTracks_.get(),
119 this->device_hitTuple_apc_,
120 this->params_.caParams_);
121 if (this->params_.doStats_)
122 kernel_mark_used(this->device_theCells_.get(), this->device_nCells_);
124 cms::cuda::finalizeBulk(this->device_hitTuple_apc_, &
tracks_view.hitIndices());
127 kernel_fillNLayers<TrackerTraits>(
tracks_view, this->device_hitTuple_apc_);
130 kernel_earlyDuplicateRemover<TrackerTraits>(
131 this->device_theCells_.get(), this->device_nCells_,
tracks_view, this->params_.dupPassThrough_);
133 kernel_countMultiplicity<TrackerTraits>(
tracks_view, this->device_tupleMultiplicity_.get());
134 cms::cuda::launchFinalize(this->device_tupleMultiplicity_.get(), cudaStream);
135 kernel_fillMultiplicity<TrackerTraits>(
tracks_view, this->device_tupleMultiplicity_.get());
137 if (
nhits > 1 && this->params_.lateFishbone_) {
138 gpuPixelDoublets::fishbone<TrackerTraits>(
139 hh, this->device_theCells_.get(), this->device_nCells_, this->isOuterHitOfCell_,
nhits,
true);
143 template <
typename TrackerTraits>
146 cudaStream_t cudaStream) {
149 int32_t
nhits =
hh.metadata().size();
152 kernel_classifyTracks<TrackerTraits>(
tracks_view, this->params_.qualityCuts_);
153 if (this->params_.lateFishbone_) {
155 kernel_fishboneCleaner<TrackerTraits>(this->device_theCells_.get(), this->device_nCells_,
tracks_view);
159 kernel_fastDuplicateRemover<TrackerTraits>(
160 this->device_theCells_.get(), this->device_nCells_,
tracks_view, this->params_.dupPassThrough_);
163 if (this->params_.doSharedHitCut_ || this->params_.doStats_) {
164 kernel_countHitInTracks<TrackerTraits>(
tracks_view, this->device_hitToTuple_.get());
165 cms::cuda::launchFinalize(this->hitToTupleView_, cudaStream);
166 kernel_fillHitInTracks<TrackerTraits>(
tracks_view, this->device_hitToTuple_.get());
170 if (this->params_.doSharedHitCut_) {
172 this->params_.minHitsForSharingCut_,
173 this->params_.dupPassThrough_,
174 this->device_hitToTuple_.get());
176 kernel_sharedHitCleaner<TrackerTraits>(
hh,
178 this->params_.minHitsForSharingCut_,
179 this->params_.dupPassThrough_,
180 this->device_hitToTuple_.get());
181 if (this->params_.useSimpleTripletCleaner_) {
182 kernel_simpleTripletCleaner<TrackerTraits>(
tracks_view,
183 this->params_.minHitsForSharingCut_,
184 this->params_.dupPassThrough_,
185 this->device_hitToTuple_.get());
188 this->params_.minHitsForSharingCut_,
189 this->params_.dupPassThrough_,
190 this->device_hitToTuple_.get());
194 if (this->params_.doStats_) {
195 std::lock_guard guard(lock_stat);
197 this->device_tupleMultiplicity_.get(),
198 this->device_hitToTuple_.get(),
199 this->device_hitTuple_apc_,
200 this->device_theCells_.get(),
201 this->device_nCells_,
202 this->device_theCellNeighbors_.get(),
203 this->device_theCellTracks_.get(),
204 this->isOuterHitOfCell_,
206 this->params_.caParams_.maxNumberOfDoublets_,
210 if (this->params_.doStats_) {
212 std::lock_guard guard(lock_stat);
213 kernel_doStatsForHitInTracks<TrackerTraits>(this->device_hitToTuple_.get(), this->counters_);
214 kernel_doStatsForTracks<TrackerTraits>(
tracks_view, this->counters_);
217 #ifdef DUMP_GPU_TK_TUPLES 218 static std::atomic<int>
iev(0);
221 std::lock_guard<std::mutex> guard(
lock);
223 kernel_print_found_ntuplets<TrackerTraits>(
hh,
tracks_view, this->device_hitToTuple_.get(), 0, 1000000,
iev);
static void printCounters(Counters const *counters)
void classifyTuples(const HitsConstView &hh, TkSoAView &track_view, cudaStream_t cudaStream)
uint32_t const *__restrict__ TkSoAView< TrackerTraits > tracks_view
caStructures::CellNeighborsT< TrackerTraits > CellNeighbors
TkSoAView< TrackerTraits > HitToTuple< TrackerTraits > const *__restrict__ int32_t int32_t int iev
TrackSoAView< TrackerTraits > TkSoAView
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
HitsConstView< TrackerTraits > hh
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter GPUCACellT< TrackerTraits > const *__restrict__ uint32_t const *__restrict__ CellNeighborsVector< TrackerTraits > const CellTracksVector< TrackerTraits > const OuterHitOfCell< TrackerTraits > const int32_t uint32_t Counters * counters
caStructures::CellTracksT< TrackerTraits > CellTracks
uint32_t CellNeighborsVector< TrackerTraits > CellTracksVector< TrackerTraits > HitsConstView< TrackerTraits > OuterHitOfCell< TrackerTraits > int nActualPairs
void launchKernels(const HitsConstView &hh, TkSoAView &track_view, cudaStream_t cudaStream)
uint32_t CellNeighborsVector< TrackerTraits > CellTracksVector< TrackerTraits > HitsConstView< TrackerTraits > hh
TrackingRecHitSoAConstView< TrackerTraits > HitsConstView
void buildDoublets(const HitsConstView &hh, int32_t offsetBPIX2, cudaStream_t stream)
caStructures::OuterHitOfCellT< TrackerTraits > OuterHitOfCell
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > hh