Skip to content

Commit ada64c3

Browse files
committed
ITS: GPU: fix perVtx + upc iteration + atomic level update
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 02b6dc2 commit ada64c3

File tree

14 files changed

+139
-165
lines changed

14 files changed

+139
-165
lines changed

Detectors/ITSMFT/ITS/tracking/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12-
#add_compile_options(-O0 -g -fPIC -fno-omit-frame-pointer)
1312
o2_add_library(ITStracking
1413
TARGETVARNAME targetName
1514
SOURCES src/ClusterLines.cxx
@@ -37,6 +36,7 @@ o2_add_library(ITStracking
3736
PRIVATE_LINK_LIBRARIES
3837
O2::Steer
3938
TBB::tbb)
39+
# target_compile_options(${targetName} PRIVATE -O0 -g -fPIC -fno-omit-frame-pointer)
4040

4141
o2_add_library(ITSTrackingInterface
4242
TARGETVARNAME targetName

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
namespace o2::its::gpu
2424
{
2525

26-
class DefaultGPUAllocator : public ExternalAllocator
27-
{
28-
void* allocate(size_t size) override;
29-
};
30-
3126
template <int nLayers = 7>
3227
class TimeFrameGPU : public TimeFrame<nLayers>
3328
{
@@ -84,7 +79,7 @@ class TimeFrameGPU : public TimeFrame<nLayers>
8479
return mGpuStreams[stream];
8580
}
8681
auto& getStreams() { return mGpuStreams; }
87-
void wipe(const int);
82+
virtual void wipe() final;
8883

8984
/// interface
9085
int getNClustersInRofSpan(const int, const int, const int) const;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
#include "GPUCommonDef.h"
2222
#include "GPUCommonHelpers.h"
2323

24+
#ifndef __HIPCC__
25+
#define THRUST_NAMESPACE thrust::cuda
26+
#else
27+
#define THRUST_NAMESPACE thrust::hip
28+
#endif
29+
2430
namespace o2::its
2531
{
2632

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TimeFrameGPU.cu

Lines changed: 72 additions & 66 deletions
Large diffs are not rendered by default.

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackerTraitsGPU.cxx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
#include "ITStrackingGPU/TrackerTraitsGPU.h"
1919
#include "ITStrackingGPU/TrackingKernels.h"
2020
#include "ITStracking/TrackingConfigParam.h"
21+
#include "ITStracking/Constants.h"
2122

2223
namespace o2::its
2324
{
24-
constexpr int UnusedIndex{-1};
2525

2626
template <int nLayers>
2727
void TrackerTraitsGPU<nLayers>::initialiseTimeFrame(const int iteration)
@@ -48,10 +48,8 @@ void TrackerTraitsGPU<nLayers>::adoptTimeFrame(TimeFrame<nLayers>* tf)
4848
template <int nLayers>
4949
void TrackerTraitsGPU<nLayers>::computeLayerTracklets(const int iteration, int iROFslice, int iVertex)
5050
{
51-
auto& conf = o2::its::ITSGpuTrackingParamConfig::Instance();
51+
const auto& conf = o2::its::ITSGpuTrackingParamConfig::Instance();
5252

53-
const Vertex diamondVert({this->mTrkParams[iteration].Diamond[0], this->mTrkParams[iteration].Diamond[1], this->mTrkParams[iteration].Diamond[2]}, {25.e-6f, 0.f, 0.f, 25.e-6f, 0.f, 36.f}, 1, 1.f);
54-
gsl::span<const Vertex> diamondSpan(&diamondVert, 1);
5553
int startROF{this->mTrkParams[iteration].nROFsPerIterations > 0 ? iROFslice * this->mTrkParams[iteration].nROFsPerIterations : 0};
5654
int endROF{o2::gpu::CAMath::Min(this->mTrkParams[iteration].nROFsPerIterations > 0 ? (iROFslice + 1) * this->mTrkParams[iteration].nROFsPerIterations + this->mTrkParams[iteration].DeltaROF : mTimeFrameGPU->getNrof(), mTimeFrameGPU->getNrof())};
5755

@@ -128,6 +126,7 @@ void TrackerTraitsGPU<nLayers>::computeLayerCells(const int iteration)
128126

129127
for (int iLayer = 0; iLayer < this->mTrkParams[iteration].CellsPerRoad(); ++iLayer) {
130128
if (!mTimeFrameGPU->getNTracklets()[iLayer + 1] || !mTimeFrameGPU->getNTracklets()[iLayer]) {
129+
mTimeFrameGPU->getNCells()[iLayer] = 0;
131130
continue;
132131
}
133132
const int currentLayerTrackletsNum{static_cast<int>(mTimeFrameGPU->getNTracklets()[iLayer])};
@@ -173,9 +172,10 @@ void TrackerTraitsGPU<nLayers>::findCellsNeighbours(const int iteration)
173172
mTimeFrameGPU->createNeighboursIndexTablesDevice();
174173
const auto& conf = o2::its::ITSGpuTrackingParamConfig::Instance();
175174
for (int iLayer{0}; iLayer < this->mTrkParams[iteration].CellsPerRoad() - 1; ++iLayer) {
175+
const int currentLayerCellsNum{static_cast<int>(mTimeFrameGPU->getNCells()[iLayer])};
176176
const int nextLayerCellsNum{static_cast<int>(mTimeFrameGPU->getNCells()[iLayer + 1])};
177-
178-
if (!nextLayerCellsNum) {
177+
if (!nextLayerCellsNum || !currentLayerCellsNum) {
178+
mTimeFrameGPU->getNNeighbours()[iLayer] = 0;
179179
continue;
180180
}
181181

@@ -188,7 +188,7 @@ void TrackerTraitsGPU<nLayers>::findCellsNeighbours(const int iteration)
188188
this->mTrkParams[0].MaxChi2ClusterAttachment,
189189
this->mBz,
190190
iLayer,
191-
mTimeFrameGPU->getNCells()[iLayer],
191+
currentLayerCellsNum,
192192
nextLayerCellsNum,
193193
1e2,
194194
conf.nBlocks,
@@ -204,7 +204,7 @@ void TrackerTraitsGPU<nLayers>::findCellsNeighbours(const int iteration)
204204
this->mTrkParams[0].MaxChi2ClusterAttachment,
205205
this->mBz,
206206
iLayer,
207-
mTimeFrameGPU->getNCells()[iLayer],
207+
currentLayerCellsNum,
208208
nextLayerCellsNum,
209209
1e2,
210210
conf.nBlocks,
@@ -251,8 +251,8 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
251251
conf.nThreads);
252252
}
253253
// fixme: I don't want to move tracks back and forth, but I need a way to use a thrust::allocator that is aware of our managed memory.
254-
if (!trackSeeds.size()) {
255-
LOGP(info, "No track seeds found, skipping track finding");
254+
if (trackSeeds.empty()) {
255+
LOGP(debug, "No track seeds found, skipping track finding");
256256
continue;
257257
}
258258
mTimeFrameGPU->createTrackITSExtDevice(trackSeeds);
@@ -283,7 +283,7 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
283283
int nShared = 0;
284284
bool isFirstShared{false};
285285
for (int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
286-
if (track.getClusterIndex(iLayer) == UnusedIndex) {
286+
if (track.getClusterIndex(iLayer) == constants::UnusedIndex) {
287287
continue;
288288
}
289289
nShared += int(mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer)));
@@ -296,7 +296,7 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
296296

297297
std::array<int, 3> rofs{INT_MAX, INT_MAX, INT_MAX};
298298
for (int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
299-
if (track.getClusterIndex(iLayer) == UnusedIndex) {
299+
if (track.getClusterIndex(iLayer) == constants::UnusedIndex) {
300300
continue;
301301
}
302302
mTimeFrameGPU->markUsedCluster(iLayer, track.getClusterIndex(iLayer));
@@ -320,9 +320,6 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
320320
}
321321
mTimeFrameGPU->loadUsedClustersDevice();
322322
}
323-
if (iteration == this->mTrkParams.size() - 1) {
324-
mTimeFrameGPU->unregisterHostMemory(0);
325-
}
326323
};
327324

328325
template <int nLayers>

0 commit comments

Comments
 (0)