Skip to content

Commit 3615d30

Browse files
authored
ITSGPU: Run CellFinding on GPU (AliceO2Group#13653)
1 parent 831670f commit 3615d30

File tree

9 files changed

+584
-314
lines changed

9 files changed

+584
-314
lines changed

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackParametrizationWithError.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
4242
using MatrixDSym5 = o2::math_utils::SMatrix<double, kNParams, kNParams, o2::math_utils::MatRepSym<double, kNParams>>;
4343
using MatrixD5 = o2::math_utils::SMatrix<double, kNParams, kNParams, o2::math_utils::MatRepStd<double, kNParams, kNParams>>;
4444

45-
GPUd() TrackParametrizationWithError();
45+
GPUhd() TrackParametrizationWithError();
4646
GPUd() TrackParametrizationWithError(value_t x, value_t alpha, const params_t& par, const covMat_t& cov, int charge = 1, const PID pid = PID::Pion);
4747
GPUd() TrackParametrizationWithError(const dim3_t& xyz, const dim3_t& pxpypz,
4848
const gpu::gpustd::array<value_t, kLabCovMatSize>& cv, int sign, bool sectorAlpha = true, const PID pid = PID::Pion);
@@ -145,7 +145,7 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
145145

146146
//__________________________________________________________________________
147147
template <typename value_T>
148-
GPUdi() TrackParametrizationWithError<value_T>::TrackParametrizationWithError() : TrackParametrization<value_T>{}
148+
GPUhdi() TrackParametrizationWithError<value_T>::TrackParametrizationWithError() : TrackParametrization<value_T>{}
149149
{
150150
}
151151

Detectors/ITSMFT/ITS/tracking/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ o2_add_library(ITStracking
3737
O2::ITSMFTReconstruction
3838
O2::DataFormatsITS)
3939

40-
4140
if (OpenMP_CXX_FOUND)
4241
target_compile_definitions(${targetName} PRIVATE WITH_OPENMP)
4342
target_link_libraries(${targetName} PRIVATE OpenMP::OpenMP_CXX)

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

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,28 @@ class TimeFrameGPU : public TimeFrame
5252
void initDevice(IndexTableUtils*, const TrackingParameters& trkParam, const TimeFrameGPUParameters&, const int, const int);
5353
void initDeviceSAFitting();
5454
void loadTrackingFrameInfoDevice(const int);
55-
void loadUnsortedClustersDevice();
56-
void loadClustersDevice();
55+
void loadUnsortedClustersDevice(const int);
56+
void loadClustersDevice(const int);
5757
void loadTrackletsDevice();
58+
void loadTrackletsLUTDevice();
5859
void loadCellsDevice();
59-
void loadCellsLUT();
60+
void loadCellsLUTDevice();
6061
void loadTrackSeedsDevice();
6162
void loadTrackSeedsChi2Device();
6263
void loadRoadsDevice();
6364
void loadTrackSeedsDevice(std::vector<CellSeed>&);
65+
void createCellsBuffers(const int);
66+
void createCellsDevice();
67+
void createCellsLUTDevice();
68+
void createNeighboursDevice();
6469
void createNeighboursDevice(const unsigned int& layer, std::vector<std::pair<int, int>>& neighbours);
6570
void createNeighboursLUTDevice(const int, const unsigned int);
6671
void createTrackITSExtDevice(std::vector<CellSeed>&);
6772
void downloadTrackITSExtDevice(std::vector<CellSeed>&);
68-
void downloadCellsNeighbours(std::vector<std::vector<std::pair<int, int>>>&, const int);
69-
void downloadNeighboursLUT(std::vector<int>&, const int);
70-
void downloadCellsDevice(const int);
73+
void downloadCellsNeighboursDevice(std::vector<std::vector<std::pair<int, int>>>&, const int);
74+
void downloadNeighboursLUTDevice(std::vector<int>&, const int);
75+
void downloadCellsDevice();
76+
void downloadCellsLUTDevice();
7177
void unregisterRest();
7278
void initDeviceChunks(const int, const int);
7379
template <Task task>
@@ -98,11 +104,11 @@ class TimeFrameGPU : public TimeFrame
98104
int* getDeviceNeighboursLUT(const int layer) { return mNeighboursLUTDevice[layer]; }
99105
gpuPair<int, int>* getDeviceNeighbours(const int layer) { return mNeighboursDevice[layer]; }
100106
TrackingFrameInfo* getDeviceTrackingFrameInfo(const int);
101-
// TrackingFrameInfo** getDeviceArrayTrackingFrameInfo() { return mTrackingFrameInfoDeviceArray; }
102107
const TrackingFrameInfo** getDeviceArrayTrackingFrameInfo() const { return mTrackingFrameInfoDeviceArray; }
103-
Cluster** getDeviceArrayClusters() const { return mClustersDeviceArray; }
104-
Cluster** getDeviceArrayUnsortedClusters() const { return mUnsortedClustersDeviceArray; }
105-
Tracklet** getDeviceArrayTracklets() const { return mTrackletsDeviceArray; }
108+
const Cluster** getDeviceArrayClusters() const { return mClustersDeviceArray; }
109+
const Cluster** getDeviceArrayUnsortedClusters() const { return mUnsortedClustersDeviceArray; }
110+
const Tracklet** getDeviceArrayTracklets() const { return mTrackletsDeviceArray; }
111+
const int** getDeviceArrayTrackletsLUT() const { return mTrackletsLUTDeviceArray; }
106112
int** getDeviceArrayCellsLUT() const { return mCellsLUTDeviceArray; }
107113
int** getDeviceArrayNeighboursCellLUT() const { return mNeighboursCellLUTDeviceArray; }
108114
CellSeed** getDeviceArrayCells() const { return mCellsDeviceArray; }
@@ -117,13 +123,21 @@ class TimeFrameGPU : public TimeFrame
117123
gsl::span<int> getHostNTracklets(const int chunkId);
118124
gsl::span<int> getHostNCells(const int chunkId);
119125

126+
// Host-available device getters
127+
gsl::span<int*> getDeviceCellLUTs() { return mCellsLUTDevice; }
128+
gsl::span<CellSeed*> getDeviceCells() { return mCellsDevice; }
129+
gsl::span<int, nLayers - 2> getNCellsDevice() { return mNCells; }
130+
120131
private:
121132
void allocMemAsync(void**, size_t, Stream*, bool); // Abstract owned and unowned memory allocations
122133
bool mHostRegistered = false;
123134
std::vector<GpuTimeFrameChunk<nLayers>> mMemChunks;
124135
TimeFrameGPUParameters mGpuParams;
125136
StaticTrackingParameters<nLayers> mStaticTrackingParams;
126137

138+
// Host-available device buffer sizes
139+
std::array<int, nLayers - 2> mNCells;
140+
127141
// Device pointers
128142
StaticTrackingParameters<nLayers>* mTrackingParamsDevice;
129143
IndexTableUtils* mIndexTableUtilsDevice;
@@ -135,12 +149,15 @@ class TimeFrameGPU : public TimeFrame
135149
// Hybrid pref
136150
std::array<Cluster*, nLayers> mClustersDevice;
137151
std::array<Cluster*, nLayers> mUnsortedClustersDevice;
138-
Cluster** mClustersDeviceArray;
139-
Cluster** mUnsortedClustersDeviceArray;
152+
const Cluster** mClustersDeviceArray;
153+
const Cluster** mUnsortedClustersDeviceArray;
140154
std::array<Tracklet*, nLayers - 1> mTrackletsDevice;
141-
Tracklet** mTrackletsDeviceArray;
155+
const Tracklet** mTrackletsDeviceArray;
156+
const int** mTrackletsLUTDeviceArray;
157+
std::array<int*, nLayers - 2> mTrackletsLUTDevice;
142158
std::array<int*, nLayers - 2> mCellsLUTDevice;
143159
std::array<int*, nLayers - 3> mNeighboursLUTDevice;
160+
144161
int** mCellsLUTDeviceArray;
145162
int** mNeighboursCellDeviceArray;
146163
int** mNeighboursCellLUTDeviceArray;

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,41 @@ GPUg() void fitTrackSeedsKernel(
4949
const o2::base::PropagatorF::MatCorrType matCorrType = o2::base::PropagatorF::MatCorrType::USEMatCorrLUT);
5050
#endif
5151
} // namespace gpu
52+
53+
void countCellsHandler(const Cluster** sortedClusters,
54+
const Cluster** unsortedClusters,
55+
const TrackingFrameInfo** tfInfo,
56+
const Tracklet** tracklets,
57+
const int** trackletsLUT,
58+
const int nTracklets,
59+
const int layer,
60+
CellSeed* cells,
61+
int** cellsLUTsDeviceArray,
62+
int* cellsLUTsHost,
63+
const float bz,
64+
const float maxChi2ClusterAttachment,
65+
const float cellDeltaTanLambdaSigma,
66+
const float nSigmaCut,
67+
const int nBlocks,
68+
const int nThreads);
69+
70+
void computeCellsHandler(const Cluster** sortedClusters,
71+
const Cluster** unsortedClusters,
72+
const TrackingFrameInfo** tfInfo,
73+
const Tracklet** tracklets,
74+
const int** trackletsLUT,
75+
const int nTracklets,
76+
const int layer,
77+
CellSeed* cells,
78+
int** cellsLUTsDeviceArray,
79+
int* cellsLUTsHost,
80+
const float bz,
81+
const float maxChi2ClusterAttachment,
82+
const float cellDeltaTanLambdaSigma,
83+
const float nSigmaCut,
84+
const int nBlocks,
85+
const int nThreads);
86+
5287
void countCellNeighboursHandler(CellSeed** cellsLayersDevice,
5388
int* neighboursLUTs,
5489
int** cellsLUTs,

Detectors/ITSMFT/ITS/tracking/GPU/cuda/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if(CUDA_ENABLED)
1414
find_package(CUDAToolkit)
1515
message(STATUS "Building ITS CUDA tracker")
1616
# add_compile_options(-O0 -g -lineinfo -fPIC)
17+
# add_compile_definitions(ITS_MEASURE_GPU_TIME)
1718
o2_add_library(ITStrackingCUDA
1819
SOURCES ClusterLinesGPU.cu
1920
Context.cu

0 commit comments

Comments
 (0)