Skip to content

Commit 86578c8

Browse files
authored
GPU ITS tracking: make tracking mode available in configKeyVals + fixes (#13056)
* Fix usage of VertexerTraits from within the GPU reco WF * Prepare settings and cleanup interface * Temporarily re-enable the gpu-wf-spec in itsreco-wf * Extend configuration
1 parent 6a8629c commit 86578c8

File tree

15 files changed

+44
-32
lines changed

15 files changed

+44
-32
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ VertexerTraitsGPU::VertexerTraitsGPU()
9393

9494
VertexerTraitsGPU::~VertexerTraitsGPU()
9595
{
96-
gpu::utils::gpuFree(mDeviceIndexTableUtils);
9796
}
9897

9998
void VertexerTraitsGPU::initialise(const TrackingParameters& trackingParams)

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Configuration.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ namespace its
3434
enum class TrackingMode {
3535
Sync,
3636
Async,
37-
Cosmics
37+
Cosmics,
38+
Unset, // Special value to leave a default in case we want to override via Configurable Params
3839
};
3940

4041
std::string asString(TrackingMode mode);
@@ -146,6 +147,7 @@ struct TimeFrameGPUParameters {
146147
size_t maxVerticesCapacity = 5e4;
147148
size_t nMaxROFs = 1e3;
148149
size_t nTimeFrameChunks = 3;
150+
size_t nROFsPerChunk = 768; // pp defaults
149151
int maxGPUMemoryGB = -1;
150152
};
151153

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper<TrackerPara
7878
int nROFsPerIterations = 0;
7979
bool perPrimaryVertexProcessing = false;
8080
bool saveTimeBenchmarks = false;
81+
bool overrideBeamEstimation = false; // used by gpuwf only
82+
int trackingMode = -1; // -1: unset, 0=sync, 1=async, 2=cosmics used by gpuwf only
8183

8284
O2ParamDef(TrackerParamConfig, "ITSCATrackerParam");
8385
};

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingInterface.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,21 @@ class ITSTrackingInterface
3434
public:
3535
ITSTrackingInterface(bool isMC,
3636
int trgType,
37-
const TrackingMode trMode,
3837
const bool overrBeamEst)
3938
: mIsMC{isMC},
4039
mUseTriggers{trgType},
41-
mMode{trMode},
4240
mOverrideBeamEstimation{overrBeamEst}
4341
{
4442
}
4543

4644
void setClusterDictionary(const o2::itsmft::TopologyDictionary* d) { mDict = d; }
4745
void setMeanVertex(const o2::dataformats::MeanVertexObject* v)
4846
{
49-
if (!v) {
47+
if (v == nullptr) {
48+
LOGP(error, "Mean Vertex Object is nullptr");
5049
return;
50+
} else {
51+
LOGP(info, "Mean Vertex set with x: {} y: {}", v->getX(), v->getY());
5152
}
5253
mMeanVertex = v;
5354
}
@@ -61,13 +62,20 @@ class ITSTrackingInterface
6162

6263
// Custom
6364
void setTraitsFromProvider(VertexerTraits*, TrackerTraits*, TimeFrame*);
65+
void setTrackingMode(TrackingMode mode = TrackingMode::Unset)
66+
{
67+
if (mode == TrackingMode::Unset) {
68+
LOGP(fatal, "ITS Tracking mode Unset is meant to be a default. Specify the mode");
69+
}
70+
mMode = mode;
71+
}
6472

6573
private:
6674
bool mIsMC = false;
6775
bool mRunVertexer = true;
6876
bool mCosmicsProcessing = false;
6977
int mUseTriggers = 0;
70-
TrackingMode mMode = TrackingMode::Sync;
78+
TrackingMode mMode = TrackingMode::Unset;
7179
bool mOverrideBeamEstimation = false;
7280
const o2::itsmft::TopologyDictionary* mDict = nullptr;
7381
std::unique_ptr<Tracker> mTracker = nullptr;

Detectors/ITSMFT/ITS/tracking/include/ITStracking/VertexerTraits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ class VertexerTraits
8585
TimeFrame*,
8686
std::vector<o2::MCCompLabel>*);
8787

88-
VertexingParameters getVertexingParameters() const { return mVrtParams; }
8988
static const std::vector<std::pair<int, int>> selectClusters(const int* indexTable,
9089
const std::array<int, 4>& selectedBinsRect,
9190
const IndexTableUtils& utils);
9291

9392
// utils
9493
VertexingParameters& getVertexingParameters() { return mVrtParams; }
94+
VertexingParameters getVertexingParameters() const { return mVrtParams; }
9595
void setIsGPU(const unsigned char isgpu) { mIsGPU = isgpu; };
9696
unsigned char getIsGPU() const { return mIsGPU; };
9797
void dumpVertexerTraits();

Detectors/ITSMFT/ITS/tracking/src/Configuration.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ std::string asString(TrackingMode mode)
2222
return "async";
2323
case TrackingMode::Cosmics:
2424
return "cosmics";
25+
case TrackingMode::Unset:
26+
return "unset";
2527
}
2628
return "unknown";
2729
}

Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ void Tracker::rectifyClusterIndices()
455455
void Tracker::getGlobalConfiguration()
456456
{
457457
auto& tc = o2::its::TrackerParamConfig::Instance();
458+
tc.printKeyValues(true, true);
458459
if (tc.useMatCorrTGeo) {
459460
mTraits->setCorrType(o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrTGeo);
460461
} else if (tc.useFastMaterial) {

Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "DataFormatsTRD/TriggerRecord.h"
2323
#include "CommonDataFormat/IRFrame.h"
2424
#include "DetectorsBase/GRPGeomHelper.h"
25+
#include "ITStracking/TrackingConfigParam.h"
2526

2627
namespace o2
2728
{
@@ -33,9 +34,11 @@ void ITSTrackingInterface::initialise()
3334
mRunVertexer = true;
3435
mCosmicsProcessing = false;
3536
std::vector<TrackingParameters> trackParams;
36-
37+
if (mMode == TrackingMode::Unset) {
38+
mMode = (TrackingMode)(o2::its::TrackerParamConfig::Instance().trackingMode);
39+
LOGP(info, "Tracking mode not set, trying to fetch it from configurable params to: {}", asString(mMode));
40+
}
3741
if (mMode == TrackingMode::Async) {
38-
3942
trackParams.resize(3);
4043
for (auto& param : trackParams) {
4144
param.ZBins = 64;
@@ -49,7 +52,6 @@ void ITSTrackingInterface::initialise()
4952
trackParams[2].CellDeltaTanLambdaSigma *= 4.;
5053
trackParams[2].MinTrackLength = 4;
5154
LOG(info) << "Initializing tracker in async. phase reconstruction with " << trackParams.size() << " passes";
52-
5355
} else if (mMode == TrackingMode::Sync) {
5456
trackParams.resize(1);
5557
trackParams[0].ZBins = 64;
@@ -195,10 +197,7 @@ void ITSTrackingInterface::run(framework::ProcessingContext& pc)
195197
}
196198
}
197199
if (processingMask[iRof] && !selROF) { // passed selection in clusters and not in vertex multiplicity
198-
LOG(debug) << fmt::format("ROF {} rejected by the vertex multiplicity selection [{},{}]",
199-
iRof,
200-
multEstConf.cutMultVtxLow,
201-
multEstConf.cutMultVtxHigh);
200+
LOGP(info, "ROF {} rejected by the vertex multiplicity selection [{},{}]", iRof, multEstConf.cutMultVtxLow, multEstConf.cutMultVtxHigh);
202201
processingMask[iRof] = selROF;
203202
cutVertexMult++;
204203
}
@@ -325,7 +324,7 @@ void ITSTrackingInterface::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
325324
return;
326325
}
327326
if (matcher == ConcreteDataMatcher("GLO", "MEANVERTEX", 0)) {
328-
LOGP(info, "mean vertex acquired");
327+
LOGP(info, "Mean vertex acquired");
329328
setMeanVertex((const o2::dataformats::MeanVertexObject*)obj);
330329
return;
331330
}

Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ float Vertexer::clustersToVerticesHybrid(std::function<void(std::string s)> logg
6767
void Vertexer::getGlobalConfiguration()
6868
{
6969
auto& vc = o2::its::VertexerParamConfig::Instance();
70+
vc.printKeyValues(true, true);
7071
auto& grc = o2::its::GpuRecoParamConfig::Instance();
7172

7273
VertexingParameters verPar;
@@ -90,8 +91,7 @@ void Vertexer::getGlobalConfiguration()
9091
verPar.PhiBins = vc.PhiBins;
9192

9293
TimeFrameGPUParameters tfGPUpar;
93-
tfGPUpar.maxGPUMemoryGB = grc.maxGPUMemoryGB;
94-
tfGPUpar.maxVerticesCapacity = grc.maxVerticesCapacity;
94+
// tfGPUpar.nROFsPerChunk = grc.nROFsPerChunk;
9595

9696
mTraits->updateVertexingParameters(verPar, tfGPUpar);
9797
}

Detectors/ITSMFT/ITS/workflow/include/ITSWorkflow/TrackerSpec.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@
2323

2424
#include "ITStracking/TrackingInterface.h"
2525

26-
#include "GPUO2Interface.h"
27-
#include "GPUReconstruction.h"
28-
#include "GPUChainITS.h"
29-
#include "CommonUtils/StringUtils.h"
30-
#include "TStopwatch.h"
26+
#include "GPUDataTypes.h"
3127
#include "DetectorsBase/GRPGeomHelper.h"
3228

29+
#include "TStopwatch.h"
30+
3331
namespace o2
3432
{
3533
namespace its
@@ -41,9 +39,9 @@ class TrackerDPL : public framework::Task
4139
TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
4240
bool isMC,
4341
int trgType,
44-
const TrackingMode& trMode,
42+
const TrackingMode& trMode = TrackingMode::Unset,
4543
const bool overrBeamEst = false,
46-
o2::gpu::GPUDataTypes::DeviceType dType = o2::gpu::GPUDataTypes::DeviceType::CPU);
44+
gpu::GPUDataTypes::DeviceType dType = gpu::GPUDataTypes::DeviceType::CPU);
4745
~TrackerDPL() override = default;
4846
void init(framework::InitContext& ic) final;
4947
void run(framework::ProcessingContext& pc) final;
@@ -60,7 +58,8 @@ class TrackerDPL : public framework::Task
6058
TStopwatch mTimer;
6159
};
6260

63-
framework::DataProcessorSpec getTrackerSpec(bool useMC, bool useGeom, int useTrig, const std::string& trModeS, const bool overrBeamEst, o2::gpu::GPUDataTypes::DeviceType dType);
61+
using o2::its::TrackingMode;
62+
framework::DataProcessorSpec getTrackerSpec(bool useMC, bool useGeom, int useTrig, const std::string& trMode, const bool overrBeamEst = false, gpu::GPUDataTypes::DeviceType dType = gpu::GPUDataTypes::DeviceType::CPU);
6463

6564
} // namespace its
6665
} // namespace o2

0 commit comments

Comments
 (0)