Skip to content

Commit 359e28b

Browse files
authored
ITS: template Traits and TimeFrame (#14312)
* ITS: const log func * ITS: apply virtual to vertexer * ITS: template Traits and TimeFrame * ITS: GPU: use non-templated trackinginterface * ITS: GPU: user cpu vertexer until gpu finalized * ITS: GPU: uses templated Traits/TimeFrame
1 parent 3c38c31 commit 359e28b

34 files changed

+674
-985
lines changed

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TimeFrameGPU.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DefaultGPUAllocator : public ExternalAllocator
3030
};
3131

3232
template <int nLayers = 7>
33-
class TimeFrameGPU : public TimeFrame
33+
class TimeFrameGPU : public TimeFrame<nLayers>
3434
{
3535
public:
3636
TimeFrameGPU();
@@ -205,14 +205,14 @@ class TimeFrameGPU : public TimeFrame
205205
template <int nLayers>
206206
inline int TimeFrameGPU<nLayers>::getNClustersInRofSpan(const int rofIdstart, const int rofSpanSize, const int layerId) const
207207
{
208-
return static_cast<int>(mROFramesClusters[layerId][(rofIdstart + rofSpanSize) < mROFramesClusters.size() ? rofIdstart + rofSpanSize : mROFramesClusters.size() - 1] - mROFramesClusters[layerId][rofIdstart]);
208+
return static_cast<int>(this->mROFramesClusters[layerId][(rofIdstart + rofSpanSize) < this->mROFramesClusters.size() ? rofIdstart + rofSpanSize : this->mROFramesClusters.size() - 1] - this->mROFramesClusters[layerId][rofIdstart]);
209209
}
210210

211211
template <int nLayers>
212212
inline std::vector<unsigned int> TimeFrameGPU<nLayers>::getClusterSizes()
213213
{
214-
std::vector<unsigned int> sizes(mUnsortedClusters.size());
215-
std::transform(mUnsortedClusters.begin(), mUnsortedClusters.end(), sizes.begin(),
214+
std::vector<unsigned int> sizes(this->mUnsortedClusters.size());
215+
std::transform(this->mUnsortedClusters.begin(), this->mUnsortedClusters.end(), sizes.begin(),
216216
[](const auto& v) { return static_cast<unsigned int>(v.size()); });
217217
return sizes;
218218
}

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TrackerTraitsGPU.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,17 @@
1616
#include "ITStracking/TrackerTraits.h"
1717
#include "ITStrackingGPU/TimeFrameGPU.h"
1818

19-
namespace o2
20-
{
21-
namespace its
19+
namespace o2::its
2220
{
2321

2422
template <int nLayers = 7>
25-
class TrackerTraitsGPU final : public TrackerTraits
23+
class TrackerTraitsGPU final : public TrackerTraits<nLayers>
2624
{
2725
public:
2826
TrackerTraitsGPU() = default;
2927
~TrackerTraitsGPU() override = default;
3028

31-
void adoptTimeFrame(TimeFrame* tf) final;
29+
void adoptTimeFrame(TimeFrame<nLayers>* tf) final;
3230
void initialiseTimeFrame(const int iteration) final;
3331

3432
void computeLayerTracklets(const int iteration, int, int) final;
@@ -54,13 +52,6 @@ class TrackerTraitsGPU final : public TrackerTraits
5452
gpu::TimeFrameGPU<7>* mTimeFrameGPU;
5553
};
5654

57-
template <int nLayers>
58-
inline void TrackerTraitsGPU<nLayers>::adoptTimeFrame(TimeFrame* tf)
59-
{
60-
mTimeFrameGPU = static_cast<gpu::TimeFrameGPU<nLayers>*>(tf);
61-
mTimeFrame = static_cast<TimeFrame*>(tf);
62-
}
63-
} // namespace its
64-
} // namespace o2
55+
} // namespace o2::its
6556

66-
#endif
57+
#endif

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TrackingKernels.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ void countTrackletsInROFsHandler(const IndexTableUtils* utils,
7373
const float NSigmaCut,
7474
std::vector<float>& phiCuts,
7575
const float resolutionPV,
76-
std::vector<float>& minR,
77-
std::vector<float>& maxR,
76+
std::array<float, nLayers>& minR,
77+
std::array<float, nLayers>& maxR,
7878
std::vector<float>& resolutions,
7979
std::vector<float>& radii,
8080
std::vector<float>& mulScatAng,
@@ -106,8 +106,8 @@ void computeTrackletsInROFsHandler(const IndexTableUtils* utils,
106106
const float NSigmaCut,
107107
std::vector<float>& phiCuts,
108108
const float resolutionPV,
109-
std::vector<float>& minR,
110-
std::vector<float>& maxR,
109+
std::array<float, nLayers>& minR,
110+
std::array<float, nLayers>& maxR,
111111
std::vector<float>& resolutions,
112112
std::vector<float>& radii,
113113
std::vector<float>& mulScatAng,

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/VertexerTraitsGPU.h

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,37 +37,30 @@ class ROframe;
3737

3838
using constants::its2::InversePhiBinSize;
3939

40-
class VertexerTraitsGPU : public VertexerTraits
40+
class VertexerTraitsGPU final : public VertexerTraits
4141
{
4242
public:
43-
VertexerTraitsGPU();
44-
~VertexerTraitsGPU() = default;
45-
void initialise(const TrackingParameters&, const int iteration = 0) override;
46-
void adoptTimeFrame(TimeFrame*) override;
47-
void computeTracklets(const int iteration = 0) override;
48-
void computeTrackletMatching(const int iteration = 0) override;
49-
void computeVertices(const int iteration = 0) override;
50-
void updateVertexingParameters(const std::vector<VertexingParameters>&, const TimeFrameGPUParameters&) override;
51-
52-
// Hybrid
53-
void initialiseHybrid(const TrackingParameters& pars, const int iteration = 0) override { VertexerTraits::initialise(pars, iteration); }
54-
void computeTrackletsHybrid(const int iteration = 0) override { VertexerTraits::computeTracklets(iteration); }
55-
void computeTrackletMatchingHybrid(const int iteration = 0) override { VertexerTraits::computeTrackletMatching(iteration); }
56-
void computeVerticesHybrid(const int iteration = 0) override { VertexerTraits::computeVertices(iteration); }
57-
void adoptTimeFrameHybrid(TimeFrame* tf) override { VertexerTraits::adoptTimeFrame(tf); }
58-
43+
void initialise(const TrackingParameters&, const int iteration = 0) final;
44+
void adoptTimeFrame(TimeFrame<7>*) noexcept final;
45+
void computeTracklets(const int iteration = 0) final;
46+
void computeTrackletMatching(const int iteration = 0) final;
47+
void computeVertices(const int iteration = 0) final;
48+
void updateVertexingParameters(const std::vector<VertexingParameters>&, const TimeFrameGPUParameters&) final;
5949
void computeVerticesHist();
6050

51+
bool isGPU() const noexcept final { return true; }
52+
const char* getName() const noexcept final { return "GPU"; }
53+
6154
protected:
6255
IndexTableUtils* mDeviceIndexTableUtils;
6356
gpu::TimeFrameGPU<7>* mTimeFrameGPU;
6457
TimeFrameGPUParameters mTfGPUParams;
6558
};
6659

67-
inline void VertexerTraitsGPU::adoptTimeFrame(TimeFrame* tf)
60+
inline void VertexerTraitsGPU::adoptTimeFrame(TimeFrame<7>* tf) noexcept
6861
{
6962
mTimeFrameGPU = static_cast<gpu::TimeFrameGPU<7>*>(tf);
70-
mTimeFrame = static_cast<TimeFrame*>(tf);
63+
mTimeFrame = static_cast<TimeFrame<7>*>(tf);
7164
}
7265

7366
} // namespace its

0 commit comments

Comments
 (0)