Skip to content

Commit 40fd024

Browse files
committed
GPU: Unify applying settings for sync reco between standalone and GPUWorkflow
1 parent 4d0047c commit 40fd024

File tree

6 files changed

+36
-28
lines changed

6 files changed

+36
-28
lines changed

GPU/GPUTracking/Global/GPUChainTracking.cxx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,3 +1007,17 @@ void GPUChainTracking::SetO2Propagator(const o2::base::Propagator* prop)
10071007
GPUFatal("GPU magnetic field for propagator requested, but received an O2 propagator without GPU field");
10081008
}
10091009
}
1010+
1011+
void GPUChainTracking::ApplySyncSettings(GPUSettingsProcessing& proc, GPUSettingsRec& rec, GPUDataTypes::RecoStepField& steps, bool syncMode, int32_t dEdxMode)
1012+
{
1013+
if (syncMode) {
1014+
rec.useMatLUT = false;
1015+
rec.tpc.rebuildTrackMaxNonIntCov = 0.f;
1016+
}
1017+
if (proc.rtc.optSpecialCode == -1) {
1018+
proc.rtc.optSpecialCode = syncMode;
1019+
}
1020+
if (dEdxMode != -2) {
1021+
steps.setBits(GPUDataTypes::RecoStep::TPCdEdx, dEdxMode == -1 ? !syncMode : dEdxMode > 0);
1022+
}
1023+
}

GPU/GPUTracking/Global/GPUChainTracking.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ struct GPUNewCalibValues;
6666
struct GPUTriggerOutputs;
6767
struct CfFragment;
6868
class GPUTPCClusterFinder;
69+
struct GPUSettingsProcessing;
70+
struct GPUSettingsRec;
6971

7072
class GPUChainTracking : public GPUChain
7173
{
@@ -86,6 +88,7 @@ class GPUChainTracking : public GPUChain
8688
void ClearErrorCodes(bool cpuOnly = false);
8789
int32_t DoQueuedUpdates(int32_t stream, bool updateSlave = true); // Forces doing queue calib updates, don't call when you are not sure you are allowed to do so!
8890
bool QARanForTF() const { return mFractionalQAEnabled; }
91+
static void ApplySyncSettings(GPUSettingsProcessing& proc, GPUSettingsRec& rec, GPUDataTypes::RecoStepField& steps, bool syncMode, int32_t dEdxMode = -2);
8992

9093
// Structures for input and output data
9194
GPUTrackingInOutPointers& mIOPtrs;

GPU/GPUTracking/Interface/GPUO2Interface.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,8 @@ void GPUO2Interface::UseGPUPolynomialFieldInPropagator(o2::base::Propagator* pro
268268
{
269269
prop->setGPUField(&mCtx[0].mRec->GetParam().polynomialField);
270270
}
271+
272+
void GPUO2Interface::ApplySyncSettings(GPUSettingsProcessing& proc, GPUSettingsRec& rec, GPUDataTypes::RecoStepField& steps, bool syncMode, int32_t dEdxMode)
273+
{
274+
GPUChainTracking::ApplySyncSettings(proc, rec, steps, syncMode, dEdxMode);
275+
}

GPU/GPUTracking/Interface/GPUO2Interface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ struct GPUInterfaceInputUpdate;
5656
struct GPUTrackingOutputs;
5757
struct GPUConstantMem;
5858
struct GPUNewCalibValues;
59+
struct GPUSettingsProcessing;
60+
struct GPUSettingsRec;
5961

6062
struct GPUO2Interface_processingContext;
6163
struct GPUO2Interface_Internals;
@@ -80,6 +82,7 @@ class GPUO2Interface
8082

8183
// Updates all calibration objects that are != nullptr in newCalib
8284
int32_t UpdateCalibration(const GPUCalibObjectsConst& newCalib, const GPUNewCalibValues& newVals, uint32_t iThread = 0);
85+
static void ApplySyncSettings(GPUSettingsProcessing& proc, GPUSettingsRec& rec, GPUDataTypes::RecoStepField& steps, bool syncMode, int32_t dEdxMode = -2);
8386

8487
int32_t registerMemoryForGPU(const void* ptr, size_t size);
8588
int32_t unregisterMemoryForGPU(const void* ptr);

GPU/GPUTracking/Standalone/Benchmark/standalone.cxx

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,6 @@ int32_t SetupReconstruction()
377377
} else if (chainTracking->GetTRDGeometry() == nullptr) {
378378
steps.steps.setBits(GPUDataTypes::RecoStep::TRDTracking, false);
379379
}
380-
if (configStandalone.rundEdx != -1) {
381-
steps.steps.setBits(GPUDataTypes::RecoStep::TPCdEdx, configStandalone.rundEdx > 0);
382-
}
383380
if (configStandalone.runCompression != -1) {
384381
steps.steps.setBits(GPUDataTypes::RecoStep::TPCCompression, configStandalone.runCompression > 0);
385382
}
@@ -434,23 +431,15 @@ int32_t SetupReconstruction()
434431
}
435432
}
436433

437-
bool runAsyncQA = procSet.runQA && !configStandalone.testSyncAsyncQcInSync;
438-
if (configStandalone.testSyncAsync || configStandalone.testSync) {
439-
// Set settings for synchronous
440-
if (configStandalone.rundEdx == -1) {
441-
steps.steps.setBits(GPUDataTypes::RecoStep::TPCdEdx, 0);
442-
}
443-
recSet.useMatLUT = false;
444-
if (configStandalone.testSyncAsync) {
445-
procSet.eventDisplay = nullptr;
446-
if (!configStandalone.testSyncAsyncQcInSync) {
447-
procSet.runQA = false;
448-
}
434+
// Set settings for synchronous
435+
GPUChainTracking::ApplySyncSettings(procSet, recSet, steps.steps, configStandalone.testSyncAsync || configStandalone.testSync, configStandalone.rundEdx);
436+
int32_t runAsyncQA = procSet.runQA && !configStandalone.testSyncAsyncQcInSync ? procSet.runQA : 0;
437+
if (configStandalone.testSyncAsync) {
438+
procSet.eventDisplay = nullptr;
439+
if (!configStandalone.testSyncAsyncQcInSync) {
440+
procSet.runQA = false;
449441
}
450442
}
451-
if (configStandalone.proc.rtc.optSpecialCode == -1) {
452-
configStandalone.proc.rtc.optSpecialCode = configStandalone.testSyncAsync || configStandalone.testSync;
453-
}
454443

455444
rec->SetSettings(&grp, &recSet, &procSet, &steps);
456445
if (configStandalone.proc.doublePipeline) {
@@ -470,13 +459,12 @@ int32_t SetupReconstruction()
470459
procSet.runQA = runAsyncQA;
471460
procSet.eventDisplay = eventDisplay.get();
472461
procSet.runCompressionStatistics = 0;
473-
procSet.rtc.optSpecialCode = 0;
474462
if (recSet.tpc.rejectionStrategy >= GPUSettings::RejectionStrategyB) {
475463
procSet.tpcInputWithClusterRejection = 1;
476464
}
477465
recSet.tpc.disableRefitAttachment = 0xFF;
478466
recSet.maxTrackQPtB5 = CAMath::Min(recSet.maxTrackQPtB5, recSet.tpc.rejectQPtB5);
479-
recSet.useMatLUT = true;
467+
GPUChainTracking::ApplySyncSettings(procSet, recSet, steps.steps, false, configStandalone.rundEdx);
480468
recAsync->SetSettings(&grp, &recSet, &procSet, &steps);
481469
}
482470

GPU/Workflow/src/GPUWorkflowSpec.cxx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,15 @@ void GPURecoWorkflowSpec::init(InitContext& ic)
185185
}
186186
}
187187
mConfig->configInterface.outputToExternalBuffers = true;
188-
if (mConfParam->synchronousProcessing) {
189-
mConfig->configReconstruction.useMatLUT = false;
190-
}
191-
if (mConfig->configProcessing.rtc.optSpecialCode == -1) {
192-
mConfig->configProcessing.rtc.optSpecialCode = mConfParam->synchronousProcessing;
193-
}
188+
const bool runTracking = mSpecConfig.outputTracks || mSpecConfig.outputCompClustersRoot || mSpecConfig.outputCompClustersFlat;
189+
GPUO2Interface::ApplySyncSettings(mConfig->configProcessing, mConfig->configReconstruction, mConfig->configWorkflow.steps, mConfParam->synchronousProcessing, runTracking ? mConfParam->rundEdx : -2);
194190

195191
// Configure the "GPU workflow" i.e. which steps we run on the GPU (or CPU)
196-
if (mSpecConfig.outputTracks || mSpecConfig.outputCompClustersRoot || mSpecConfig.outputCompClustersFlat) {
192+
if (runTracking) {
197193
mConfig->configWorkflow.steps.set(GPUDataTypes::RecoStep::TPCConversion,
198194
GPUDataTypes::RecoStep::TPCSectorTracking,
199195
GPUDataTypes::RecoStep::TPCMerging);
200196
mConfig->configWorkflow.outputs.set(GPUDataTypes::InOutType::TPCMergedTracks);
201-
mConfig->configWorkflow.steps.setBits(GPUDataTypes::RecoStep::TPCdEdx, mConfParam->rundEdx == -1 ? !mConfParam->synchronousProcessing : mConfParam->rundEdx);
202197
}
203198
if (mSpecConfig.outputCompClustersRoot || mSpecConfig.outputCompClustersFlat) {
204199
mConfig->configWorkflow.steps.setBits(GPUDataTypes::RecoStep::TPCCompression, true);

0 commit comments

Comments
 (0)