Skip to content

Commit a98cccd

Browse files
committed
GPU TPC Clusterizer: add overrideClusterizerFragmentLen option
1 parent d540b75 commit a98cccd

6 files changed

Lines changed: 16 additions & 13 deletions

File tree

GPU/GPUTracking/Base/GPUReconstruction.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ int GPUReconstruction::InitPhaseBeforeDevice()
272272
mProcessingSettings.mergerSortTracks = false;
273273
}
274274
if (mProcessingSettings.nTPCClustererLanes == -1) {
275-
mProcessingSettings.nTPCClustererLanes = IsGPU() ? 3 : 1;
275+
mProcessingSettings.nTPCClustererLanes = (GetRecoStepsGPU() & RecoStep::TPCClusterFinding) ? 3 : 1;
276+
}
277+
if (mProcessingSettings.overrideClusterizerFragmentLen == -1) {
278+
mProcessingSettings.overrideClusterizerFragmentLen = (GetRecoStepsGPU() & RecoStep::TPCClusterFinding) ? TPC_MAX_FRAGMENT_LEN_GPU : TPC_MAX_FRAGMENT_LEN_HOST;
276279
}
277280
if (!IsGPU()) {
278281
mProcessingSettings.nDeviceHelperThreads = 0;

GPU/GPUTracking/Definitions/GPUSettingsList.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ AddOption(ompAutoNThreads, bool, true, "", 0, "Auto-adjust number of OMP threads
153153
AddOption(nDeviceHelperThreads, int, 1, "", 0, "Number of CPU helper threads for CPU processing")
154154
AddOption(nStreams, char, 8, "", 0, "Number of GPU streams / command queues")
155155
AddOption(nTPCClustererLanes, char, -1, "", 0, "Number of TPC clusterers that can run in parallel (-1 = autoset)")
156+
AddOption(overrideClusterizerFragmentLen, int, -1, "", 0, "Force the cluster max fragment len to a certain value (-1 = autodetect)")
156157
AddOption(trackletSelectorSlices, char, -1, "", 0, "Number of slices to processes in parallel at max")
157158
AddOption(trackletConstructorInPipeline, char, -1, "", 0, "Run tracklet constructor in the pipeline")
158159
AddOption(trackletSelectorInPipeline, char, -1, "", 0, "Run tracklet selector in the pipeline")

GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,7 @@ int GPUChainTracking::RunTPCClusterizer_prepare(bool restorePointers)
335335
if (mCFContext == nullptr) {
336336
mCFContext.reset(new GPUTPCCFChainContext);
337337
}
338-
const bool doGPU = GetRecoStepsGPU() & RecoStep::TPCClusterFinding;
339-
const short maxFragmentLen = doGPU ? TPC_MAX_FRAGMENT_LEN_GPU : TPC_MAX_FRAGMENT_LEN_HOST;
338+
const short maxFragmentLen = GetProcessingSettings().overrideClusterizerFragmentLen;
340339
mCFContext->tpcMaxTimeBin = param().par.continuousTracking ? std::max<int>(param().par.continuousMaxTimeBin, maxFragmentLen) : TPC_MAX_TIME_BIN_TRIGGERED;
341340
const CfFragment fragmentMax{(tpccf::TPCTime)mCFContext->tpcMaxTimeBin + 1, maxFragmentLen};
342341
mCFContext->prepare(mIOPtrs.tpcZS, fragmentMax);
@@ -547,8 +546,8 @@ int GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
547546

548547
using ChargeMapType = decltype(*clustererShadow.mPchargeMap);
549548
using PeakMapType = decltype(*clustererShadow.mPpeakMap);
550-
runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {}, clustererShadow.mPchargeMap, TPCMapMemoryLayout<ChargeMapType>::items(doGPU) * sizeof(ChargeMapType));
551-
runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {}, clustererShadow.mPpeakMap, TPCMapMemoryLayout<PeakMapType>::items(doGPU) * sizeof(PeakMapType));
549+
runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {}, clustererShadow.mPchargeMap, TPCMapMemoryLayout<ChargeMapType>::items(GetProcessingSettings().overrideClusterizerFragmentLen) * sizeof(ChargeMapType));
550+
runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {}, clustererShadow.mPpeakMap, TPCMapMemoryLayout<PeakMapType>::items(GetProcessingSettings().overrideClusterizerFragmentLen) * sizeof(PeakMapType));
552551
if (fragment.index == 0) {
553552
runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {}, clustererShadow.mPpadIsNoisy, TPC_PADS_IN_SECTOR * sizeof(*clustererShadow.mPpadIsNoisy));
554553
}

GPU/GPUTracking/TPCClusterFinder/Array2D.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ class TilingLayout
6363
return (tileTime * WidthInTiles + tilePad) * (Width * Height) + inTileTime * Width + inTilePad;
6464
}
6565

66-
GPUd() static size_t items(bool gpu)
66+
GPUd() static size_t items(size_t fragmentLen)
6767
{
68-
return (TPC_NUM_OF_PADS + Width - 1) / Width * Width * (TPC_MAX_FRAGMENT_LEN_PADDED(gpu ? TPC_MAX_FRAGMENT_LEN_GPU : TPC_MAX_FRAGMENT_LEN_HOST) + Height - 1) / Height * Height;
68+
return (TPC_NUM_OF_PADS + Width - 1) / Width * Width * (TPC_MAX_FRAGMENT_LEN_PADDED(fragmentLen) + Height - 1) / Height * Height;
6969
}
7070
};
7171

@@ -77,9 +77,9 @@ class LinearLayout
7777
return TPC_NUM_OF_PADS * p.timePadded + p.gpad;
7878
}
7979

80-
GPUd() static size_t items(bool gpu)
80+
GPUd() static size_t items(size_t fragmentLen)
8181
{
82-
return TPC_NUM_OF_PADS * TPC_MAX_FRAGMENT_LEN_PADDED(gpu ? TPC_MAX_FRAGMENT_LEN_GPU : TPC_MAX_FRAGMENT_LEN_HOST);
82+
return TPC_NUM_OF_PADS * TPC_MAX_FRAGMENT_LEN_PADDED(fragmentLen);
8383
}
8484
};
8585

GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ void* GPUTPCClusterFinder::SetPointersScratch(void* mem)
8686
mPclusterPosInRow = nullptr;
8787
}
8888
computePointerWithAlignment(mem, mPisPeak, mNMaxDigitsFragment);
89-
computePointerWithAlignment(mem, mPchargeMap, TPCMapMemoryLayout<decltype(*mPchargeMap)>::items(mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding));
90-
computePointerWithAlignment(mem, mPpeakMap, TPCMapMemoryLayout<decltype(*mPpeakMap)>::items(mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding));
89+
computePointerWithAlignment(mem, mPchargeMap, TPCMapMemoryLayout<decltype(*mPchargeMap)>::items(mRec->GetProcessingSettings().overrideClusterizerFragmentLen));
90+
computePointerWithAlignment(mem, mPpeakMap, TPCMapMemoryLayout<decltype(*mPpeakMap)>::items(mRec->GetProcessingSettings().overrideClusterizerFragmentLen));
9191
computePointerWithAlignment(mem, mPbuf, mBufSize * mNBufs);
9292
computePointerWithAlignment(mem, mPclusterByRow, GPUCA_ROW_COUNT * mNMaxClusterPerRow);
9393

@@ -155,7 +155,7 @@ void GPUTPCClusterFinder::PrepareMC()
155155
assert(mNMaxClusterPerRow > 0);
156156

157157
clearMCMemory();
158-
mPindexMap = new uint[TPCMapMemoryLayout<decltype(*mPindexMap)>::items(mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding)];
158+
mPindexMap = new uint[TPCMapMemoryLayout<decltype(*mPindexMap)>::items(mRec->GetProcessingSettings().overrideClusterizerFragmentLen)];
159159
mPlabelsByRow = new GPUTPCClusterMCInterimArray[GPUCA_ROW_COUNT];
160160
mPlabelsInRow = new uint[GPUCA_ROW_COUNT];
161161
}

GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinderDump.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void GPUTPCClusterFinder::DumpChargeMap(std::ostream& out, std::string_view titl
3838

3939
out << std::hex;
4040

41-
for (TPCFragmentTime i = 0; i < TPC_MAX_FRAGMENT_LEN_PADDED(doGPU ? TPC_MAX_FRAGMENT_LEN_GPU : TPC_MAX_FRAGMENT_LEN_HOST); i++) {
41+
for (TPCFragmentTime i = 0; i < TPC_MAX_FRAGMENT_LEN_PADDED(mRec->GetProcessingSettings().overrideClusterizerFragmentLen); i++) {
4242
int zeros = 0;
4343
for (GlobalPad j = 0; j < TPC_NUM_OF_PADS; j++) {
4444
ushort q = map[{j, i}];

0 commit comments

Comments
 (0)