Project
Loading...
Searching...
No Matches
VertexerTraitsGPU.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11//
13
14#include <gsl/span>
15
19
20namespace o2::its
21{
22
23template <int nLayers>
24void VertexerTraitsGPU<nLayers>::initialise(const TrackingParameters& trackingParams, const int iteration)
25{
26 // FIXME
27 // Two things to fix here:
28 // This loads all necessary data for this step at once, can be overlayed with computation
29 // Also if running with the tracker some data is loaded twice!
30 mTimeFrameGPU->initialise(0, trackingParams, 3, &this->mIndexTableUtils, &mTfGPUParams);
31
32 // FIXME some of these only need to be created once!
33 mTimeFrameGPU->loadIndexTableUtils(iteration);
34 mTimeFrameGPU->createUsedClustersDeviceArray(iteration, 3);
35 mTimeFrameGPU->createClustersDeviceArray(iteration, 3);
36 mTimeFrameGPU->createUnsortedClustersDeviceArray(iteration, 3);
37 mTimeFrameGPU->createClustersIndexTablesArray(iteration);
38 mTimeFrameGPU->createROFrameClustersDeviceArray(iteration);
39 for (int iLayer{0}; iLayer < 3; ++iLayer) {
40 mTimeFrameGPU->loadClustersDevice(iteration, iLayer);
41 mTimeFrameGPU->loadUnsortedClustersDevice(iteration, iLayer);
42 mTimeFrameGPU->loadClustersIndexTables(iteration, iLayer);
43 mTimeFrameGPU->createUsedClustersDevice(iteration, iLayer);
44 mTimeFrameGPU->loadROFrameClustersDevice(iteration, iLayer);
45 }
46}
47
48template <int nLayers>
50{
51 mTimeFrameGPU = static_cast<gpu::TimeFrameGPU<nLayers>*>(tf);
52 this->mTimeFrame = static_cast<TimeFrame<nLayers>*>(tf);
53}
54
55template <int nLayers>
56void VertexerTraitsGPU<nLayers>::updateVertexingParameters(const std::vector<VertexingParameters>& vrtPar, const TimeFrameGPUParameters& tfPar)
57{
58 this->mVrtParams = vrtPar;
59 mTfGPUParams = tfPar;
60 this->mIndexTableUtils.setTrackingParameters(vrtPar[0]);
61 for (auto& par : this->mVrtParams) {
62 par.phiSpan = static_cast<int>(std::ceil(this->mIndexTableUtils.getNphiBins() * par.phiCut / o2::constants::math::TwoPI));
63 par.zSpan = static_cast<int>(std::ceil(par.zCut * this->mIndexTableUtils.getInverseZCoordinate(0)));
64 }
65}
66
67template <int nLayers>
69{
70 if (mTimeFrameGPU->getClusters().empty()) {
71 return;
72 }
73 const auto& conf = ITSGpuTrackingParamConfig::Instance();
74
75 mTimeFrameGPU->createVtxTrackletsLUTDevice(iteration);
76 countTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
77 mTimeFrameGPU->getDeviceMultCutMask(),
78 mTimeFrameGPU->getNrof(),
79 this->mVrtParams[iteration].deltaRof,
80 mTimeFrameGPU->getDeviceROFramesPV(),
81 this->mVrtParams[iteration].vertPerRofThreshold,
82 mTimeFrameGPU->getDeviceArrayClusters(),
83 mTimeFrameGPU->getClusterSizes()[1],
84 mTimeFrameGPU->getDeviceROFrameClusters(),
85 (const uint8_t**)mTimeFrameGPU->getDeviceArrayUsedClusters(),
86 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
87 mTimeFrameGPU->getDeviceArrayNTrackletsPerCluster(),
88 mTimeFrameGPU->getDeviceArrayNTrackletsPerClusterSum(),
89 mTimeFrameGPU->getDeviceArrayNTrackletsPerROF(),
90 mTimeFrameGPU->getDeviceNTrackletsPerCluster(),
91 mTimeFrameGPU->getDeviceNTrackletsPerClusterSum(),
92 iteration,
93 this->mVrtParams[iteration].phiCut,
94 this->mVrtParams[iteration].maxTrackletsPerCluster,
95 conf.nBlocksVtxComputeTracklets[iteration],
96 conf.nThreadsVtxComputeTracklets[iteration],
97 mTimeFrameGPU->getStreams());
98 mTimeFrameGPU->createVtxTrackletsBuffers(iteration);
99 computeTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
100 mTimeFrameGPU->getDeviceMultCutMask(),
101 mTimeFrameGPU->getNrof(),
102 this->mVrtParams[iteration].deltaRof,
103 mTimeFrameGPU->getDeviceROFramesPV(),
104 this->mVrtParams[iteration].vertPerRofThreshold,
105 mTimeFrameGPU->getDeviceArrayClusters(),
106 mTimeFrameGPU->getClusterSizes()[1],
107 mTimeFrameGPU->getDeviceROFrameClusters(),
108 (const uint8_t**)mTimeFrameGPU->getDeviceArrayUsedClusters(),
109 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
110 mTimeFrameGPU->getDeviceArrayTracklets(),
111 (const int32_t**)mTimeFrameGPU->getDeviceArrayNTrackletsPerCluster(),
112 (const int32_t**)mTimeFrameGPU->getDeviceArrayNTrackletsPerClusterSum(),
113 (const int32_t**)mTimeFrameGPU->getDeviceArrayNTrackletsPerROF(),
114 iteration,
115 this->mVrtParams[iteration].phiCut,
116 this->mVrtParams[iteration].maxTrackletsPerCluster,
117 conf.nBlocksVtxComputeTracklets[iteration],
118 conf.nThreadsVtxComputeTracklets[iteration],
119 mTimeFrameGPU->getStreams());
120}
121
122template <int nLayers>
124{
125 if (!mTimeFrameGPU->getTotalTrackletsTF(0) || !mTimeFrameGPU->getTotalTrackletsTF(1)) {
126 return;
127 }
128
129 const auto& conf = ITSGpuTrackingParamConfig::Instance();
130 mTimeFrameGPU->createVtxLinesLUTDevice(iteration);
131 countTrackletsMatchingInROFsHandler(mTimeFrameGPU->getNrof(),
132 this->mVrtParams[iteration].deltaRof,
133 mTimeFrameGPU->getClusterSizes()[1],
134 mTimeFrameGPU->getDeviceROFrameClusters(),
135 mTimeFrameGPU->getDeviceArrayClusters(),
136 mTimeFrameGPU->getDeviceArrayUsedClusters(),
137 (const Tracklet**)mTimeFrameGPU->getDeviceArrayTracklets(),
138 mTimeFrameGPU->getDeviceUsedTracklets(),
139 (const int32_t**)mTimeFrameGPU->getDeviceArrayNTrackletsPerCluster(),
140 (const int32_t**)mTimeFrameGPU->getDeviceArrayNTrackletsPerClusterSum(),
141 mTimeFrameGPU->getDeviceNLinesPerCluster(),
142 mTimeFrameGPU->getDeviceNLinesPerClusterSum(),
143 iteration,
144 this->mVrtParams[iteration].phiCut,
145 this->mVrtParams[iteration].tanLambdaCut,
146 conf.nBlocksVtxComputeMatching[iteration],
147 conf.nThreadsVtxComputeMatching[iteration],
148 mTimeFrameGPU->getStreams());
149 mTimeFrameGPU->createVtxLinesBuffer(iteration);
150 computeTrackletsMatchingInROFsHandler(mTimeFrameGPU->getNrof(),
151 this->mVrtParams[iteration].deltaRof,
152 mTimeFrameGPU->getClusterSizes()[1],
153 mTimeFrameGPU->getDeviceROFrameClusters(),
154 mTimeFrameGPU->getDeviceArrayClusters(),
155 nullptr,
156 (const Tracklet**)mTimeFrameGPU->getDeviceArrayTracklets(),
157 mTimeFrameGPU->getDeviceUsedTracklets(),
158 (const int32_t**)mTimeFrameGPU->getDeviceArrayNTrackletsPerCluster(),
159 (const int32_t**)mTimeFrameGPU->getDeviceArrayNTrackletsPerClusterSum(),
160 (const int32_t*)mTimeFrameGPU->getDeviceNLinesPerClusterSum(),
161 mTimeFrameGPU->getDeviceLines(),
162 iteration,
163 this->mVrtParams[iteration].phiCut,
164 this->mVrtParams[iteration].tanLambdaCut,
165 conf.nBlocksVtxComputeMatching[iteration],
166 conf.nThreadsVtxComputeMatching[iteration],
167 mTimeFrameGPU->getStreams());
168}
169
170template <int nLayers>
172{
173 LOGP(fatal, "This step is not implemented yet!");
174 mTimeFrameGPU->loadUsedClustersDevice();
175}
176
177template class VertexerTraitsGPU<7>;
178
179} // namespace o2::its
void adoptTimeFrame(TimeFrame< nLayers > *tf) noexcept final
void initialise(const TrackingParameters &, const int iteration=0) final
void computeVertices(const int iteration=0) final
void updateVertexingParameters(const std::vector< VertexingParameters > &, const TimeFrameGPUParameters &) final
void computeTracklets(const int iteration=0) final
void computeTrackletMatching(const int iteration=0) final
constexpr float TwoPI
void computeTrackletsMatchingInROFsHandler(const int32_t nRofs, const int32_t deltaROF, const uint32_t nClusters, const int32_t **GPUrestrict() ROFClusters, const Cluster **GPUrestrict() clusters, const uint8_t **GPUrestrict() usedClusters, const Tracklet **GPUrestrict() foundTracklets, uint8_t *GPUrestrict() usedTracklets, const int32_t **GPUrestrict() trackletsPerClusterLUTs, const int32_t **GPUrestrict() trackletsPerClusterSumLUTs, const int32_t *GPUrestrict() linesPerClusterSumLUT, Line *GPUrestrict() lines, const int32_t iteration, const float phiCut, const float tanLambdaCut, const int32_t nBlocks, const int32_t nThreads, gpu::Streams &streams)
void countTrackletsMatchingInROFsHandler(const int32_t nRofs, const int32_t deltaROF, const uint32_t nClusters, const int32_t **GPUrestrict() ROFClusters, const Cluster **GPUrestrict() clusters, uint8_t **GPUrestrict() usedClusters, const Tracklet **GPUrestrict() foundTracklets, uint8_t *GPUrestrict() usedTracklets, const int32_t **GPUrestrict() trackletsPerClusterLUTs, const int32_t **GPUrestrict() trackletsPerClusterSumLUTs, int32_t *GPUrestrict() linesPerClusterLUT, int32_t *GPUrestrict() linesPerClusterSumLUT, const int32_t iteration, const float phiCut, const float tanLambdaCut, const int32_t nBlocks, const int32_t nThreads, gpu::Streams &streams)
Selection.
std::unique_ptr< GPUReconstructionTimeframe > tf