forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeFrameChunk.h
More file actions
150 lines (131 loc) · 5.25 KB
/
TimeFrameChunk.h
File metadata and controls
150 lines (131 loc) · 5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
///
#ifndef TRACKINGITSGPU_INCLUDE_TIMEFRAMECHUNKGPU_H
#define TRACKINGITSGPU_INCLUDE_TIMEFRAMECHUNKGPU_H
#include "ITStracking/Configuration.h"
#include "ITStracking/TimeFrame.h"
#include "ITStrackingGPU/ClusterLinesGPU.h"
// #include "ITStrackingGPU/Array.h"
// #include "ITStrackingGPU/Vector.h"
#include "ITStrackingGPU/Stream.h"
#include <gsl/gsl>
namespace o2::its::gpu
{
template <int nLayers>
struct StaticTrackingParameters {
StaticTrackingParameters<nLayers>& operator=(const StaticTrackingParameters<nLayers>& t) = default;
void set(const TrackingParameters& pars)
{
ClusterSharing = pars.ClusterSharing;
MinTrackLength = pars.MinTrackLength;
NSigmaCut = pars.NSigmaCut;
PVres = pars.PVres;
DeltaROF = pars.DeltaROF;
ZBins = pars.ZBins;
PhiBins = pars.PhiBins;
CellDeltaTanLambdaSigma = pars.CellDeltaTanLambdaSigma;
}
/// General parameters
int ClusterSharing = 0;
int MinTrackLength = nLayers;
float NSigmaCut = 5;
float PVres = 1.e-2f;
int DeltaROF = 0;
int ZBins{256};
int PhiBins{128};
/// Cell finding cuts
float CellDeltaTanLambdaSigma = 0.007f;
};
template <int nLayers>
class GpuTimeFrameChunk
{
public:
static size_t computeScalingSizeBytes(const int, const TimeFrameGPUParameters&);
static size_t computeFixedSizeBytes(const TimeFrameGPUParameters&);
static size_t computeRofPerChunk(const TimeFrameGPUParameters&, const size_t);
GpuTimeFrameChunk() = delete;
GpuTimeFrameChunk(o2::its::TimeFrame* tf, TimeFrameGPUParameters& conf)
{
mTimeFramePtr = tf;
mTFGPUParams = &conf;
}
~GpuTimeFrameChunk();
/// Most relevant operations
void allocate(const size_t, Stream&);
void reset(const Task, Stream&);
size_t loadDataOnDevice(const size_t, const size_t, const int, Stream&);
/// Interface
Cluster* getDeviceClusters(const int);
int* getDeviceClusterExternalIndices(const int);
int* getDeviceIndexTables(const int);
Tracklet* getDeviceTracklets(const int);
int* getDeviceTrackletsLookupTables(const int);
CellSeed* getDeviceCells(const int);
int* getDeviceCellsLookupTables(const int);
int* getDeviceRoadsLookupTables(const int);
TimeFrameGPUParameters* getTimeFrameGPUParameters() const { return mTFGPUParams; }
int* getDeviceCUBTmpBuffer() { return mCUBTmpBufferDevice; }
int* getDeviceFoundTracklets() { return mFoundTrackletsDevice; }
int* getDeviceNFoundCells() { return mNFoundCellsDevice; }
int* getDeviceCellNeigboursLookupTables(const int);
int* getDeviceCellNeighbours(const int);
CellSeed** getDeviceArrayCells() const { return mCellsDeviceArray; }
int** getDeviceArrayNeighboursCell() const { return mNeighboursCellDeviceArray; }
int** getDeviceArrayNeighboursCellLUT() const { return mNeighboursCellLookupTablesDeviceArray; }
/// Vertexer only
int* getDeviceNTrackletCluster(const int combid) { return mNTrackletsPerClusterDevice[combid]; }
Line* getDeviceLines() { return mLinesDevice; };
int* getDeviceNFoundLines() { return mNFoundLinesDevice; }
int* getDeviceNExclusiveFoundLines() { return mNExclusiveFoundLinesDevice; }
unsigned char* getDeviceUsedTracklets() { return mUsedTrackletsDevice; }
int* getDeviceClusteredLines() { return mClusteredLinesDevice; }
size_t getNPopulatedRof() const { return mNPopulatedRof; }
private:
/// Host
std::array<gsl::span<const Cluster>, nLayers> mHostClusters;
std::array<gsl::span<const int>, nLayers> mHostIndexTables;
/// Device
std::array<Cluster*, nLayers> mClustersDevice;
std::array<int*, nLayers> mClusterExternalIndicesDevice;
std::array<int*, nLayers> mIndexTablesDevice;
std::array<Tracklet*, nLayers - 1> mTrackletsDevice;
std::array<int*, nLayers - 1> mTrackletsLookupTablesDevice;
std::array<CellSeed*, nLayers - 2> mCellsDevice;
// Road<nLayers - 2>* mRoadsDevice;
std::array<int*, nLayers - 2> mCellsLookupTablesDevice;
std::array<int*, nLayers - 3> mNeighboursCellDevice;
std::array<int*, nLayers - 3> mNeighboursCellLookupTablesDevice;
std::array<int*, nLayers - 2> mRoadsLookupTablesDevice;
// These are to make them accessible using layer index
CellSeed** mCellsDeviceArray;
int** mNeighboursCellDeviceArray;
int** mNeighboursCellLookupTablesDeviceArray;
// Small accessory buffers
int* mCUBTmpBufferDevice;
int* mFoundTrackletsDevice;
int* mNFoundCellsDevice;
/// Vertexer only
Line* mLinesDevice;
int* mNFoundLinesDevice;
int* mNExclusiveFoundLinesDevice;
unsigned char* mUsedTrackletsDevice;
std::array<int*, 2> mNTrackletsPerClusterDevice;
int* mClusteredLinesDevice;
/// State and configuration
bool mAllocated = false;
size_t mNRof = 0;
size_t mNPopulatedRof = 0;
o2::its::TimeFrame* mTimeFramePtr = nullptr;
TimeFrameGPUParameters* mTFGPUParams = nullptr;
};
} // namespace o2::its::gpu
#endif