Project
Loading...
Searching...
No Matches
GPUChainTracking.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
17#include <fstream>
18#include <chrono>
19
20#include "GPUChainTracking.h"
21#include "GPUChainTrackingGetters.inc"
22#include "GPUReconstructionIO.h"
24#include "GPUTPCGMMergedTrack.h"
26#include "GPUTPCTrack.h"
27#include "GPUTPCHitId.h"
28#include "GPUTPCClusterData.h"
29#include "TPCZSLinkMapping.h"
30#include "GPUTRDTrackletWord.h"
32#include "GPUTPCMCInfo.h"
33#include "GPUTRDTrack.h"
34#include "GPUTRDTracker.h"
35#include "AliHLTTPCRawCluster.h"
37#include "GPUTRDRecoParam.h"
39#include "GPUQA.h"
40#include "GPULogging.h"
43#include "GPUNewCalibValues.h"
44#include "GPUTriggerOutputs.h"
45#include "GPUDefParametersRuntime.h"
46
48#include "GPUHostDataTypes.h"
50#include "GPUTrackingRefit.h"
51#include "CalibdEdxContainer.h"
52
53#include "TPCFastTransformPOD.h"
54
55#include "utils/linux_helpers.h"
56#include "utils/strtag.h"
57using namespace o2::gpu;
58
59#include "GPUO2DataTypes.h"
60
61using namespace o2::tpc;
62using namespace o2::trd;
63
64GPUChainTracking::GPUChainTracking(GPUReconstruction* rec, uint32_t maxTPCHits, uint32_t maxTRDTracklets) : GPUChain(rec), mIOPtrs(processors()->ioPtrs), mInputsHost(new GPUTrackingInputProvider), mInputsShadow(new GPUTrackingInputProvider), mClusterNativeAccess(new ClusterNativeAccess), mTriggerBuffer(new GPUTriggerOutputs), mMaxTPCHits(maxTPCHits), mMaxTRDTracklets(maxTRDTracklets), mDebugFile(new std::ostream(nullptr))
65{
69}
70
72{
73 if (mDisplayRunning) {
74 GetProcessingSettings().eventDisplay->StopDisplay();
75 }
76}
77
79{
80 if (mRec->IsGPU()) {
84 }
85
87 if (GetRecoSteps() & RecoStep::TPCSectorTracking) {
88 for (uint32_t i = 0; i < NSECTORS; i++) {
89 mRec->RegisterGPUProcessor(&processors()->tpcTrackers[i], GetRecoStepsGPU() & RecoStep::TPCSectorTracking);
90 }
91 }
92 if (GetRecoSteps() & RecoStep::TPCMerging) {
93 mRec->RegisterGPUProcessor(&processors()->tpcMerger, GetRecoStepsGPU() & RecoStep::TPCMerging);
94 }
95 if (GetRecoSteps() & RecoStep::TRDTracking) {
96 mRec->RegisterGPUProcessor(&processors()->trdTrackerGPU, GetRecoStepsGPU() & RecoStep::TRDTracking);
97 }
98 if (GetRecoSteps() & RecoStep::TRDTracking) {
99 mRec->RegisterGPUProcessor(&processors()->trdTrackerO2, GetRecoStepsGPU() & RecoStep::TRDTracking);
100 }
101 if (GetRecoSteps() & RecoStep::TPCCompression) {
102 mRec->RegisterGPUProcessor(&processors()->tpcCompressor, GetRecoStepsGPU() & RecoStep::TPCCompression);
103 }
104 if (GetRecoSteps() & RecoStep::TPCDecompression) {
105 mRec->RegisterGPUProcessor(&processors()->tpcDecompressor, GetRecoStepsGPU() & RecoStep::TPCDecompression);
106 }
107 if (GetRecoSteps() & RecoStep::TPCClusterFinding) {
108 for (uint32_t i = 0; i < NSECTORS; i++) {
109 mRec->RegisterGPUProcessor(&processors()->tpcClusterer[i], GetRecoStepsGPU() & RecoStep::TPCClusterFinding);
110#ifdef GPUCA_HAS_ONNX
111 mRec->RegisterGPUProcessor(&processors()->tpcNNClusterer[i], GetRecoStepsGPU() & RecoStep::TPCClusterFinding);
112#endif
113 }
114 }
115 if (GetRecoSteps() & RecoStep::Refit) {
116 mRec->RegisterGPUProcessor(&processors()->trackingRefit, GetRecoStepsGPU() & RecoStep::Refit);
117 }
118#ifdef GPUCA_KERNEL_DEBUGGER_OUTPUT
119 mRec->RegisterGPUProcessor(&processors()->debugOutput, true);
120#endif
122}
123
125{
126 if (mRec->IsGPU()) {
128 }
129 memcpy((void*)&processorsShadow()->trdTrackerGPU, (const void*)&processors()->trdTrackerGPU, sizeof(processors()->trdTrackerGPU));
130 if (GetRecoStepsGPU() & RecoStep::TPCSectorTracking) {
131 for (uint32_t i = 0; i < NSECTORS; i++) {
132 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcTrackers[i], &processors()->tpcTrackers[i]);
133 }
134 }
135 if (GetRecoStepsGPU() & RecoStep::TPCMerging) {
136 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcMerger, &processors()->tpcMerger);
137 }
138 if (GetRecoStepsGPU() & RecoStep::TRDTracking) {
139 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->trdTrackerGPU, &processors()->trdTrackerGPU);
140 }
141
142 memcpy((void*)&processorsShadow()->trdTrackerO2, (const void*)&processors()->trdTrackerO2, sizeof(processors()->trdTrackerO2));
143 if (GetRecoStepsGPU() & RecoStep::TRDTracking) {
144 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->trdTrackerO2, &processors()->trdTrackerO2);
145 }
146 if (GetRecoStepsGPU() & RecoStep::TPCCompression) {
147 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcCompressor, &processors()->tpcCompressor);
148 }
149 if (GetRecoStepsGPU() & RecoStep::TPCDecompression) {
150 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcDecompressor, &processors()->tpcDecompressor);
151 }
152 if (GetRecoStepsGPU() & RecoStep::TPCClusterFinding) {
153 for (uint32_t i = 0; i < NSECTORS; i++) {
154 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcClusterer[i], &processors()->tpcClusterer[i]);
155#ifdef GPUCA_HAS_ONNX
156 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcNNClusterer[i], &processors()->tpcNNClusterer[i]);
157#endif
158 }
159 }
160 if (GetRecoStepsGPU() & RecoStep::Refit) {
161 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->trackingRefit, &processors()->trackingRefit);
162 }
163#ifdef GPUCA_KERNEL_DEBUGGER_OUTPUT
164 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->debugOutput, &processors()->debugOutput);
165#endif
166}
167
168void GPUChainTracking::MemorySize(size_t& gpuMem, size_t& pageLockedHostMem)
169{
170 gpuMem = constants::GPU_DEFAULT_MEMORY_SIZE;
171 pageLockedHostMem = constants::GPU_DEFAULT_HOST_MEMORY_SIZE;
172}
173
175{
177 GPUError("Invalid Reconstruction Step Setting: dEdx requires TPC Merger to be active");
178 return false;
179 }
181 GPUError("Invalid GPU Reconstruction Step Setting: dEdx requires TPC Merger to be active");
182 return false;
183 }
185 GPUError("Invalid Reconstruction Step Setting: Tracking requires TPC Conversion to be active");
186 return false;
187 }
189 GPUError("Invalid input, TPC Clusterizer needs TPC raw input");
190 return false;
191 }
193 GPUError("Invalid input / output / step, merger cannot read/store sectors tracks and needs TPC conversion");
194 return false;
195 }
197 if ((GetRecoSteps() & gpudatatypes::RecoStep::TPCMerging) && !tpcClustersAvail) {
198 GPUError("Invalid Inputs for track merging, TPC Clusters required");
199 return false;
200 }
201#ifdef GPUCA_RUN2
203 GPUError("Can not run TPC GPU Cluster Finding with Run 2 Data");
204 return false;
205 }
206#endif
208 GPUError("Missing input for TPC Cluster conversion / sector tracking / compression / dEdx: TPC Clusters required");
209 return false;
210 }
212 GPUError("Input for TPC merger missing");
213 return false;
214 }
216 GPUError("Input for TPC compressor missing");
217 return false;
218 }
220 GPUError("Input for TRD Tracker missing");
221 return false;
222 }
223 if ((GetRecoSteps() & gpudatatypes::RecoStep::TRDTracking) && (processors()->calibObjects.trdRecoParam == nullptr)) {
224 GPUError("TRD Reco Parameters are missing");
225 return false;
226 }
228 GPUError("TPC Raw / TPC Clusters / TRD Tracklets cannot be output");
229 return false;
230 }
232 GPUError("No TPC Merged Track Output available");
233 return false;
234 }
236 GPUError("No TPC Compression Output available");
237 return false;
238 }
240 GPUError("No TRD Tracker Output available");
241 return false;
242 }
243 if ((GetRecoSteps() & gpudatatypes::RecoStep::TPCdEdx) && (processors()->calibObjects.dEdxCalibContainer == nullptr)) {
244 GPUError("Cannot run dE/dx without dE/dx calibration container object");
245 return false;
246 }
247 if ((GetRecoSteps() & gpudatatypes::RecoStep::TPCClusterFinding) && processors()->calibObjects.tpcPadGain == nullptr) {
248 GPUError("Cannot run gain calibration without calibration object");
249 return false;
250 }
251 if ((GetRecoSteps() & gpudatatypes::RecoStep::TPCClusterFinding) && processors()->calibObjects.tpcZSLinkMapping == nullptr && mIOPtrs.tpcZS != nullptr) {
252 GPUError("Cannot run TPC ZS Decoder without mapping object. (tpczslinkmapping.dump missing?)");
253 return false;
254 }
255 return true;
256}
257
259{
260 int32_t gatherMode = mRec->GetProcessingSettings().tpcCompressionGatherMode == -1 ? mRec->getGPUParameters(mRec->GetRecoStepsGPU() & gpudatatypes::RecoStep::TPCCompression).par_COMP_GATHER_MODE : mRec->GetProcessingSettings().tpcCompressionGatherMode;
261 if ((param().rec.tpc.nWays & 1) == 0) {
262 GPUError("nWay setting musst be odd number!");
263 return false;
264 }
265 if (param().rec.tpc.mergerInterpolateErrors && param().rec.tpc.nWays < 3) {
266 GPUError("Cannot do error interpolation with NWays < 3!");
267 return false;
268 }
269 if (param().continuousMaxTimeBin > (int32_t)GPUSettings::TPC_MAX_TF_TIME_BIN) {
270 GPUError("configured max time bin exceeds 256 orbits");
271 return false;
272 }
273 if ((GetRecoStepsGPU() & RecoStep::TPCClusterFinding) && std::max(GetProcessingSettings().nTPCClustererLanes + 1, GetProcessingSettings().nTPCClustererLanes * 2) + (GetProcessingSettings().doublePipeline ? 1 : 0) > (int32_t)mRec->NStreams()) {
274 GPUError("NStreams of %d insufficient for %d nTPCClustererLanes", mRec->NStreams(), (int32_t)GetProcessingSettings().nTPCClustererLanes);
275 return false;
276 }
277 if ((mRec->GetRecoStepsGPU() & gpudatatypes::RecoStep::TPCCompression) && GetProcessingSettings().noGPUMemoryRegistration && gatherMode != 3) {
278 GPUError("noGPUMemoryRegistration only possible with gather mode 3 (set to %d / %d)", mRec->GetProcessingSettings().tpcCompressionGatherMode, gatherMode);
279 return false;
280 }
281 if (mRec->IsGPU() && (GetProcessingSettings().clusterizerZSSanityCheck || GetProcessingSettings().mergerSanityCheck)) {
282 GPUError("Clusterizer and merger Sanity checks only supported when not running on GPU");
283 return false;
284 }
285 if (GetProcessingSettings().tpcWriteClustersAfterRejection && (mRec->IsGPU() || param().rec.tpc.compressionTypeMask || !(GetRecoSteps() & gpudatatypes::RecoStep::TPCCompression))) {
286 GPUError("tpcWriteClustersAfterRejection requires compressionTypeMask = 0, no GPU usage, and compression enabled");
287 return false;
288 }
289 if (GetProcessingSettings().doublePipeline) {
290 if (GetProcessingSettings().tpcFreeAllocatedMemoryAfterProcessing) {
291 GPUError("Cannot use double pipeline with tpcFreeAllocatedMemoryAfterProcessing");
292 return false;
293 }
295 GPUError("Invalid outputs for double pipeline mode 0x%x", (uint32_t)GetRecoStepsOutputs());
296 return false;
297 }
302 GPUError("Must use external output for double pipeline mode");
303 return false;
304 }
305 if (gatherMode == 1) {
306 GPUError("Double pipeline incompatible to compression mode 1");
307 return false;
308 }
310 GPUError("Invalid reconstruction settings for double pipeline: Needs compression and cluster finding");
311 return false;
312 }
313 }
314 if ((GetRecoStepsGPU() & gpudatatypes::RecoStep::TPCCompression) && !(GetRecoStepsGPU() & gpudatatypes::RecoStep::TPCCompression) && (gatherMode == 1 || gatherMode == 3)) {
315 GPUError("Invalid tpcCompressionGatherMode for compression on CPU");
316 return false;
317 }
318 if (GetProcessingSettings().tpcApplyClusterFilterOnCPU > 0 && (GetRecoStepsGPU() & gpudatatypes::RecoStep::TPCClusterFinding || GetProcessingSettings().runMC)) {
319 GPUError("tpcApplyClusterFilterOnCPU cannot be used with GPU clusterization or with MC labels");
320 return false;
321 }
322 if (GetRecoSteps() & RecoStep::TRDTracking) {
323 if (GetProcessingSettings().trdTrackModelO2 && (GetProcessingSettings().createO2Output == 0 || (GetMatLUT() == nullptr && !GetProcessingSettings().willProvideO2PropagatorLate))) {
324 GPUError("TRD tracking can only run on O2 TPC tracks if createO2Output is enabled (%d), and matBudLUT is available (0x%p)", (int32_t)GetProcessingSettings().createO2Output, (void*)GetMatLUT());
325 return false;
326 }
327 if ((GetRecoStepsGPU() & RecoStep::TRDTracking) && !GetProcessingSettings().trdTrackModelO2 && GetProcessingSettings().createO2Output > 1) {
328 GPUError("TRD tracking can only run on GPU TPC tracks if the createO2Output setting does not suppress them");
329 return false;
330 }
331 if ((((GetRecoStepsGPU() & RecoStep::TRDTracking) && GetProcessingSettings().trdTrackModelO2) || ((GetRecoStepsGPU() & RecoStep::Refit) && !param().rec.trackingRefitGPUModel)) && (!GetProcessingSettings().o2PropagatorUseGPUField || (GetMatLUT() == nullptr && !GetProcessingSettings().willProvideO2PropagatorLate))) {
332 GPUError("Cannot use TRD tracking or Refit on GPU without GPU polynomial field map (%d) or matlut table (%p)", (int32_t)GetProcessingSettings().o2PropagatorUseGPUField, (void*)GetMatLUT());
333 return false;
334 }
335 }
336 return true;
337}
338
340{
341 const auto& threadContext = GetThreadContext();
342 if (GetProcessingSettings().debugLevel >= 1) {
343 printf("Enabled Reconstruction Steps: 0x%x (on GPU: 0x%x)", (int32_t)GetRecoSteps().get(), (int32_t)GetRecoStepsGPU().get());
344 for (uint32_t i = 0; i < sizeof(gpudatatypes::RECO_STEP_NAMES) / sizeof(gpudatatypes::RECO_STEP_NAMES[0]); i++) {
345 if (GetRecoSteps().isSet(1u << i)) {
346 printf(" - %s", gpudatatypes::RECO_STEP_NAMES[i]);
347 if (GetRecoStepsGPU().isSet(1u << i)) {
348 printf(" (G)");
349 }
350 }
351 }
352 printf("\n");
353 }
354 if (!ValidateSteps()) {
355 return 1;
356 }
357
358 for (uint32_t i = 0; i < mSubOutputControls.size(); i++) {
359 if (mSubOutputControls[i] == nullptr) {
361 }
362 }
363
364 if (!ValidateSettings()) {
365 return 1;
366 }
367
370 if (!qa) {
371 qa.reset(new GPUQA(this));
372 }
373 }
376 if (mEventDisplay == nullptr) {
377 throw std::runtime_error("Error loading event display");
378 }
379 }
380
383
384 if (mRec->IsGPU()) {
386 UpdateGPUCalibObjectsPtrs(-1); // First initialization, for users not using RunChain
388 WriteToConstantMemory(RecoStep::NoRecoStep, (char*)&processors()->errorCodes - (char*)processors(), &processorsShadow()->errorCodes, sizeof(processorsShadow()->errorCodes), -1);
389 TransferMemoryResourceLinkToGPU(RecoStep::NoRecoStep, mInputsHost->mResourceErrorCodes);
390 }
391
392 if (GetProcessingSettings().debugLevel >= 6) {
393 std::string filename = std::string(mRec->IsGPU() ? "GPU" : "CPU") + (mRec->slaveId() != -1 ? (std::string("_slave") + std::to_string(mRec->slaveId())) : std::string(mRec->slavesExist() ? "_master" : "")) + GetProcessingSettings().debugLogSuffix + ".out";
394
395 bool hashOnly = GetProcessingSettings().debugDumpChecksum;
396
397 std::streambuf* backing = nullptr;
398 if (!hashOnly) {
399 mDebugFileBuffer.open(filename.c_str(), std::ios::out);
400 backing = &mDebugFileBuffer;
401 }
402
403 mDebugFileStream = HashStreamBuf(hashOnly, backing);
405 if (GetProcessingSettings().debugFileHexFloat >= 1 || (GetProcessingSettings().debugFileHexFloat == -1 && GetProcessingSettings().deterministicGPUReconstruction)) {
406 *mDebugFile << std::hexfloat;
407 }
408 }
409
410 return 0;
411}
412
414{
415 // TODO: Is this correct?
416 if (processors()->calibObjects.fastTransform && (ptrMask == nullptr || ptrMask->fastTransform)) {
417 memcpy((void*)mFlatObjectsShadow.mCalibObjects.fastTransform, (const void*)processors()->calibObjects.fastTransform, processors()->calibObjects.fastTransform->size());
418 }
419
420 if (processors()->calibObjects.dEdxCalibContainer && (ptrMask == nullptr || ptrMask->dEdxCalibContainer)) {
421 memcpy((void*)mFlatObjectsShadow.mCalibObjects.dEdxCalibContainer, (const void*)processors()->calibObjects.dEdxCalibContainer, sizeof(*processors()->calibObjects.dEdxCalibContainer));
422 memcpy((void*)mFlatObjectsShadow.mdEdxSplinesBuffer, (const void*)processors()->calibObjects.dEdxCalibContainer->getFlatBufferPtr(), processors()->calibObjects.dEdxCalibContainer->getFlatBufferSize());
423 mFlatObjectsShadow.mCalibObjects.dEdxCalibContainer->clearInternalBufferPtr();
426 }
427 if (processors()->calibObjects.matLUT && (ptrMask == nullptr || ptrMask->matLUT)) {
428 memcpy((void*)mFlatObjectsShadow.mCalibObjects.matLUT, (const void*)processors()->calibObjects.matLUT, sizeof(*processors()->calibObjects.matLUT));
429 memcpy((void*)mFlatObjectsShadow.mMatLUTBuffer, (const void*)processors()->calibObjects.matLUT->getFlatBufferPtr(), processors()->calibObjects.matLUT->getFlatBufferSize());
430 mFlatObjectsShadow.mCalibObjects.matLUT->clearInternalBufferPtr();
433 }
434 if (processors()->calibObjects.trdGeometry && (ptrMask == nullptr || ptrMask->trdGeometry)) {
435 memcpy((void*)mFlatObjectsShadow.mCalibObjects.trdGeometry, (const void*)processors()->calibObjects.trdGeometry, sizeof(*processors()->calibObjects.trdGeometry));
436 mFlatObjectsShadow.mCalibObjects.trdGeometry->clearInternalBufferPtr();
437 }
438 if (processors()->calibObjects.trdRecoParam && (ptrMask == nullptr || ptrMask->trdRecoParam)) {
439 memcpy((void*)mFlatObjectsShadow.mCalibObjects.trdRecoParam, (const void*)processors()->calibObjects.trdRecoParam, sizeof(*processors()->calibObjects.trdRecoParam));
440 }
441 if (processors()->calibObjects.tpcPadGain && (ptrMask == nullptr || ptrMask->tpcPadGain)) {
442 memcpy((void*)mFlatObjectsShadow.mCalibObjects.tpcPadGain, (const void*)processors()->calibObjects.tpcPadGain, sizeof(*processors()->calibObjects.tpcPadGain));
443 }
444 if (processors()->calibObjects.tpcZSLinkMapping && (ptrMask == nullptr || ptrMask->tpcZSLinkMapping)) {
445 memcpy((void*)mFlatObjectsShadow.mCalibObjects.tpcZSLinkMapping, (const void*)processors()->calibObjects.tpcZSLinkMapping, sizeof(*processors()->calibObjects.tpcZSLinkMapping));
446 }
447 if (processors()->calibObjects.o2Propagator && (ptrMask == nullptr || ptrMask->o2Propagator)) {
448 memcpy((void*)mFlatObjectsShadow.mCalibObjects.o2Propagator, (const void*)processors()->calibObjects.o2Propagator, sizeof(*processors()->calibObjects.o2Propagator));
449 mFlatObjectsShadow.mCalibObjects.o2Propagator->setGPUField(&processorsDevice()->param.polynomialField);
451 }
453 memcpy((void*)&processorsShadow()->calibObjects, (void*)&mFlatObjectsDevice.mCalibObjects, sizeof(mFlatObjectsDevice.mCalibObjects));
454}
455
457{
458 WriteToConstantMemory(RecoStep::NoRecoStep, (char*)&processors()->calibObjects - (char*)processors(), &mFlatObjectsDevice.mCalibObjects, sizeof(mFlatObjectsDevice.mCalibObjects), stream);
459}
460
462{
466 }
467 if (mIOPtrs.tpcZS && param().rec.fwdTPCDigitsAsClusters) {
468 throw std::runtime_error("Forwading zero-suppressed hits not supported");
469 }
471 return 0;
472}
473
475{
477 if (!qa) {
478 qa.reset(new GPUQA(this));
479 }
480 if (!GetQA()->IsInitialized()) {
482 }
483 return 0;
484}
485
487{
488 if (GetProcessingSettings().runQA && GetQA()->IsInitialized() && !(mConfigQA && mConfigQA->shipToQC) && !mQAFromForeignChain) {
489 GetQA()->UpdateChain(this);
491 }
492 if (GetProcessingSettings().debugLevel >= 6) {
493 mDebugFile->flush();
494 mDebugFileBuffer.close();
495
496 if (GetProcessingSettings().debugDumpChecksum) {
497 GPUInfo("Debug hash: %s", mDebugFileStream.hash().c_str());
498 }
499 }
501 mCompressionStatistics->Finish();
502 }
503 return 0;
504}
505
507{
508 char* fastTransformBase = (char*)mem;
510 // TODO: Is this correct?!
511 char* podBuf = nullptr;
513 mCalibObjects.fastTransform = reinterpret_cast<TPCFastTransformPOD*>(podBuf);
514 }
515 if ((char*)mem - fastTransformBase < mChainTracking->GetProcessingSettings().fastTransformObjectsMinMemorySize) {
516 mem = fastTransformBase + mChainTracking->GetProcessingSettings().fastTransformObjectsMinMemorySize; // TODO: Fixme and do proper dynamic allocation
517 }
520 }
523 }
524 char* dummyPtr;
528 } else if (mChainTracking->GetProcessingSettings().lateO2MatLutProvisioningSize) {
529 computePointerWithAlignment(mem, dummyPtr, mChainTracking->GetProcessingSettings().lateO2MatLutProvisioningSize);
530 }
534 }
537 }
540 }
543 mCalibObjects.o2Propagator = nullptr; // Always reserve memory for o2::Propagator, since it may be propagatred only during run() not during init().
544 }
546 mem = (char*)mem + mChainTracking->GetProcessingSettings().calibObjectsExtraMemorySize; // TODO: Fixme and do proper dynamic allocation
547 }
548 return mem;
549}
550
552{
553 std::memset((void*)&mIOPtrs, 0, sizeof(mIOPtrs));
555 new (&mIOMem) InOutMemory;
556 mClusterNativeAccessReduced.reset(nullptr);
557 if (mClusterNativeAccess.get()) {
558 memset((void*)mClusterNativeAccess.get(), 0, sizeof(*mClusterNativeAccess));
559 }
560}
561
563{
564 for (uint32_t i = 0; i < NSECTORS; i++) {
569 }
571 std::memset(mIOMem.clusterNativeAccess.get(), 0, sizeof(ClusterNativeAccess)); // ClusterNativeAccess has no its own constructor
585}
586
592
593void GPUChainTracking::SetMatLUT(std::unique_ptr<o2::base::MatLayerCylSet>&& lut)
594{
595 mMatLUTU = std::move(lut);
597}
598
599void GPUChainTracking::SetTRDGeometry(std::unique_ptr<o2::trd::GeometryFlat>&& geo)
600{
601 mTRDGeometryU = std::move(geo);
603}
604
605void GPUChainTracking::SetTRDRecoParam(std::unique_ptr<GPUTRDRecoParam>&& par)
606{
607 mTRDRecoParamU = std::move(par);
609}
610
612{
613 int32_t retVal = 0;
614 std::unique_ptr<GPUSettingsGRP> grp;
615 const GPUSettingsProcessing* p = nullptr;
616 std::lock_guard lk(mMutexUpdateCalib);
618 if (mNewCalibValues->newSolenoidField || mNewCalibValues->newContinuousMaxTimeBin || mNewCalibValues->newTPCTimeBinCut) {
619 grp = std::make_unique<GPUSettingsGRP>(mRec->GetGRPSettings());
620 if (mNewCalibValues->newSolenoidField) {
621 grp->solenoidBzNominalGPU = mNewCalibValues->solenoidField;
622 }
623 if (mNewCalibValues->newContinuousMaxTimeBin) {
624 grp->grpContinuousMaxTimeBin = mNewCalibValues->continuousMaxTimeBin;
625 }
626 if (mNewCalibValues->newTPCTimeBinCut) {
627 grp->tpcCutTimeBin = mNewCalibValues->tpcTimeBinCut;
628 }
629 }
630 }
631 if (GetProcessingSettings().tpcDownscaledEdx != 0) {
633 }
634 if (grp || p) {
635 mRec->UpdateSettings(grp.get(), p);
636 retVal = 1;
637 }
639 if (mNewCalibObjects->o2Propagator && ((mNewCalibObjects->o2Propagator->getGPUField() != nullptr) ^ GetProcessingSettings().o2PropagatorUseGPUField)) {
640 GPUFatal("GPU magnetic field for propagator requested, but received an O2 propagator without GPU field");
641 }
642 void* const* pSrc = (void* const*)mNewCalibObjects.get();
643 void** pDst = (void**)&processors()->calibObjects;
644 for (uint32_t i = 0; i < sizeof(processors()->calibObjects) / sizeof(void*); i++) {
645 if (pSrc[i]) {
646 pDst[i] = pSrc[i];
647 }
648 }
650 if (GetProcessingSettings().trdTrackModelO2) {
652 if (mRec->IsGPU()) {
653 TransferMemoryResourceLinkToGPU(RecoStep::NoRecoStep, processors()->trdTrackerO2.MemoryPermanent(), stream);
654 }
655 } else {
657 if (mRec->IsGPU()) {
658 TransferMemoryResourceLinkToGPU(RecoStep::NoRecoStep, processors()->trdTrackerGPU.MemoryPermanent(), stream);
659 }
660 }
661 }
662 if (mRec->IsGPU()) {
663 std::array<uint8_t, sizeof(GPUTrackingFlatObjects)> oldFlatPtrs, oldFlatPtrsDevice;
664 memcpy(oldFlatPtrs.data(), (void*)&mFlatObjectsShadow, oldFlatPtrs.size());
665 memcpy(oldFlatPtrsDevice.data(), (void*)&mFlatObjectsDevice, oldFlatPtrsDevice.size());
667 bool ptrsChanged = memcmp(oldFlatPtrs.data(), (void*)&mFlatObjectsShadow, oldFlatPtrs.size()) || memcmp(oldFlatPtrsDevice.data(), (void*)&mFlatObjectsDevice, oldFlatPtrsDevice.size());
668 if (ptrsChanged) {
669 GPUInfo("Updating all calib objects since pointers changed");
670 }
671 UpdateGPUCalibObjects(stream, ptrsChanged ? nullptr : mNewCalibObjects.get());
672 }
673 }
674
675 if ((mUpdateNewCalibObjects || (mRec->slavesExist() && updateSlave)) && mRec->IsGPU()) {
676 UpdateGPUCalibObjectsPtrs(stream); // Reinitialize
677 retVal = 1;
678 }
679 mNewCalibObjects.reset(nullptr);
680 mNewCalibValues.reset(nullptr);
682 return retVal;
683}
684
686{
687 if ((((GetRecoSteps() & RecoStep::TRDTracking) && !GetProcessingSettings().trdTrackModelO2 && !GetProcessingSettings().willProvideO2PropagatorLate) || ((GetRecoSteps() & RecoStep::Refit) && !param().rec.trackingRefitGPUModel)) && processors()->calibObjects.o2Propagator == nullptr) {
688 GPUFatal("Cannot run TRD tracking or refit with o2 track model without o2 propagator"); // This check must happen during run, since o2::Propagator cannot be available during init
689 }
690 if (GetProcessingSettings().autoAdjustHostThreads && !mRec->IsGPU()) {
692 }
693 const auto threadContext = GetThreadContext();
694 if (GetProcessingSettings().runCompressionStatistics && mCompressionStatistics == nullptr) {
696 }
697 const bool needQA = GPUQA::QAAvailable() && (GetProcessingSettings().runQA || (GetProcessingSettings().eventDisplay && (mIOPtrs.nMCInfosTPC || GetProcessingSettings().runMC)));
698 if (needQA && GetQA()->IsInitialized() == false) {
701 }
702 }
703 if (needQA) {
704 mFractionalQAEnabled = GetProcessingSettings().qcRunFraction == 100.f || (uint32_t)(rand() % 10000) < (uint32_t)(GetProcessingSettings().qcRunFraction * 100);
705 }
706 if (GetProcessingSettings().debugLevel >= 6) {
707 *mDebugFile << "\n\nProcessing event " << mRec->getNEventsProcessed() << std::endl;
708 }
710
711 mRec->getGeneralStepTimer(GeneralStep::Prepare).Start();
712 try {
714 } catch (const std::bad_alloc& e) {
715 GPUError("Memory Allocation Error");
717 }
718 mRec->getGeneralStepTimer(GeneralStep::Prepare).Stop();
719
721
722 SynchronizeStream(0); // Synchronize all init copies that might be ongoing
723
724 if (GetProcessingSettings().debugOnFailure) {
725 mRec->setDebugDumpCallback([this]() { DoDebugRawDump(); });
726 }
727
729 if (runRecoStep(RecoStep::TPCDecompression, &GPUChainTracking::RunTPCDecompression)) {
731 }
732 } else if (mIOPtrs.tpcPackedDigits || mIOPtrs.tpcZS) {
733 if (runRecoStep(RecoStep::TPCClusterFinding, &GPUChainTracking::RunTPCClusterizer, false)) {
735 }
736 }
737
738 if (GetProcessingSettings().autoAdjustHostThreads && !mRec->IsGPU() && mIOPtrs.clustersNative) {
740 }
741
744 }
745
746 mRec->PushNonPersistentMemory(qStr2Tag("TPCSLCD1")); // 1st stack level for TPC tracking sector data
748 if (runRecoStep(RecoStep::TPCSectorTracking, &GPUChainTracking::RunTPCTrackingSectors)) {
750 }
751
752 if (runRecoStep(RecoStep::TPCMerging, &GPUChainTracking::RunTPCTrackingMerger, false)) {
754 }
756 mRec->PopNonPersistentMemory(RecoStep::TPCSectorTracking, qStr2Tag("TPCSLCD1")); // Release 1st stack level, TPC sector data not needed after merger
758 }
759
761 if (GetProcessingSettings().doublePipeline) {
763 if (foreignChain && foreignChain->mIOPtrs.tpcZS) {
764 if (GetProcessingSettings().debugLevel >= 3) {
765 GPUInfo("Preempting tpcZS input of foreign chain");
766 }
767 mPipelineFinalizationCtx.reset(new GPUChainTrackingFinalContext);
768 mPipelineFinalizationCtx->rec = this->mRec;
769 foreignChain->mPipelineNotifyCtx = mPipelineFinalizationCtx.get();
770 }
771 }
772 if (runRecoStep(RecoStep::TPCCompression, &GPUChainTracking::RunTPCCompression)) {
774 }
775 }
776
777 if (runRecoStep(RecoStep::TRDTracking, &GPUChainTracking::RunTRDTracking)) {
779 }
780
781 if (runRecoStep(RecoStep::Refit, &GPUChainTracking::RunRefit)) {
783 }
784
785 if (!GetProcessingSettings().doublePipeline) { // Synchronize with output copies running asynchronously
786 SynchronizeStream(OutputStream());
787 }
788
789 if (GetProcessingSettings().autoAdjustHostThreads && !mRec->IsGPU()) {
791 }
792
794 if (CheckErrorCodes(false, false, mRec->getErrorCodeOutput())) { // TODO: Eventually, we should use GPUReconstruction::CheckErrorCodes
796 if (!GetProcessingSettings().ignoreNonFatalGPUErrors) {
797 return retVal;
798 }
799 }
800
801 if (GetProcessingSettings().doublePipeline) {
802 return retVal;
803 }
804 int32_t retVal2 = RunChainFinalize();
805 return retVal2 ? retVal2 : retVal;
806}
807
808int32_t GPUChainTracking::RunChainFinalize()
809{
810 if (mIOPtrs.clustersNative && (GetRecoSteps() & RecoStep::TPCCompression) && GetProcessingSettings().runCompressionStatistics) {
812 mCompressionStatistics->RunStatistics(mIOPtrs.clustersNative, &c, param(), GetProcessingSettings().runCompressionStatistics >= 2);
813 }
814
815 if (GetProcessingSettings().outputSanityCheck) {
816 OutputSanityCheck();
817 }
818
819 const bool needQA = GPUQA::QAAvailable() && (GetProcessingSettings().runQA || (GetProcessingSettings().eventDisplay && mIOPtrs.nMCInfosTPC));
820 if (needQA && mFractionalQAEnabled) {
821 mRec->getGeneralStepTimer(GeneralStep::QA).Start();
822 GetQA()->UpdateChain(this);
823 GetQA()->RunQA(!GetProcessingSettings().runQA);
824 mRec->getGeneralStepTimer(GeneralStep::QA).Stop();
825 if (GetProcessingSettings().debugLevel == 0) {
826 GPUInfo("Total QA runtime: %d us", (int32_t)(mRec->getGeneralStepTimer(GeneralStep::QA).GetElapsedTime() * 1000000));
827 }
828 }
829
830 if (GetProcessingSettings().showOutputStat) {
832 }
833
835
836 // PrintMemoryRelations();
837
839 if (!mDisplayRunning) {
840 GPUInfo("Starting Event Display...");
841 if (mEventDisplay->StartDisplay()) {
842 GPUError("Error starting Event Display");
844 }
845 mDisplayRunning = true;
846 } else {
847 mEventDisplay->ShowNextEvent();
848 }
849
850 mEventDisplay->WaitTillEventShown();
851
852 if (GetProcessingSettings().runsStandalone) {
853 while (kbhit()) {
854 getch();
855 }
856 GPUInfo("Press key for next event!");
857 }
858 int32_t iKey;
859 do {
860 usleep(10000);
861 if (GetProcessingSettings().runsStandalone) {
862 iKey = kbhit() ? getch() : 0;
863 if (iKey == 27 && kbhit()) { // Escape sequence (arrow keys, ...), not the ESC key: the display translates up to 8 characters after the ESC
864 uint64_t extendedKey = 0;
865 for (uint32_t i = 0; kbhit(); i++) {
866 const int32_t c = getch();
867 extendedKey |= i < 8 ? (uint64_t)(uint8_t)c << (8 * i) : 0;
868 }
869 GetProcessingSettings().eventDisplay->sendExternalGUIKey(0, 1, extendedKey);
870 iKey = 0;
871 }
872 if (iKey == 27) {
873 GetProcessingSettings().eventDisplay->setDisplayControl(2);
874 } else if (iKey == 'n') {
875 break;
876 } else if (iKey) {
877 GetProcessingSettings().eventDisplay->sendExternalGUIKey(iKey);
878 }
879 }
880 } while (GetProcessingSettings().eventDisplay->getDisplayControl() == 0);
881 if (GetProcessingSettings().eventDisplay->getDisplayControl() == 2) {
882 mDisplayRunning = false;
883 GetProcessingSettings().eventDisplay->StopDisplay();
884 const_cast<GPUSettingsProcessing&>(GetProcessingSettings()).eventDisplay = nullptr; // TODO: fixme - eventDisplay should probably not be put into ProcessingSettings in the first place
886 }
887 GetProcessingSettings().eventDisplay->setDisplayControl(0);
888 GPUInfo("Loading next event...");
889
890 mEventDisplay->BlockTillNextEvent();
891 }
892
894}
895
897{
898 if (mPipelineFinalizationCtx) {
899 {
900 std::unique_lock<std::mutex> lock(mPipelineFinalizationCtx->mutex);
901 auto* ctx = mPipelineFinalizationCtx.get();
902 mPipelineFinalizationCtx->cond.wait(lock, [ctx]() { return ctx->ready; });
903 }
904 mPipelineFinalizationCtx.reset();
905 }
906 return RunChainFinalize();
907}
908
909int32_t GPUChainTracking::CheckErrorCodes(bool cpuOnly, bool forceShowErrors, std::vector<std::array<uint32_t, 4>>* fillErrors)
910{
911 int32_t retVal = 0;
912 bool hasDebugError = false;
913 for (int32_t i = 0; i < 1 + (!cpuOnly && mRec->IsGPU()); i++) {
914 if (i) {
915 const auto& threadContext = GetThreadContext();
916 if (GetProcessingSettings().doublePipeline) {
917 TransferMemoryResourceLinkToHost(RecoStep::NoRecoStep, mInputsHost->mResourceErrorCodes, 0);
919 } else {
920 TransferMemoryResourceLinkToHost(RecoStep::NoRecoStep, mInputsHost->mResourceErrorCodes);
921 }
922 }
923 if (processors()->errorCodes.hasError()) {
924 static int32_t errorsShown = 0;
925 static bool quiet = false;
926 static std::chrono::time_point<std::chrono::steady_clock> silenceFrom;
927 if (!quiet && errorsShown++ >= 10 && GetProcessingSettings().throttleAlarms && !forceShowErrors) {
928 silenceFrom = std::chrono::steady_clock::now();
929 quiet = true;
930 } else if (quiet) {
931 auto currentTime = std::chrono::steady_clock::now();
932 std::chrono::duration<double> elapsed_seconds = currentTime - silenceFrom;
933 if (elapsed_seconds.count() > 60 * 10) {
934 quiet = false;
935 errorsShown = 1;
936 }
937 }
938 retVal = 1;
939 if (GetProcessingSettings().throttleAlarms && !forceShowErrors) {
940 GPUWarning("GPUReconstruction suffered from an error in the %s part", i ? "GPU" : "CPU");
941 } else {
942 GPUError("GPUReconstruction suffered from an error in the %s part", i ? "GPU" : "CPU");
943 }
944 if (!quiet) {
945 processors()->errorCodes.printErrors(GetProcessingSettings().throttleAlarms && !forceShowErrors);
946 }
947 if (fillErrors) {
949 const uint32_t* pErrors = processors()->errorCodes.getErrorPtr();
950 for (uint32_t j = 0; j < nErrors; j++) {
951 fillErrors->emplace_back(std::array<uint32_t, 4>{pErrors[4 * j], pErrors[4 * j + 1], pErrors[4 * j + 2], pErrors[4 * j + 3]});
952 }
953 }
954 if ((GetProcessingSettings().debugOnFailure & 1) || (GetProcessingSettings().debugOnFailure & 4)) {
955 if (GetProcessingSettings().debugOnFailureErrorMask == (uint64_t)-1) {
956 hasDebugError = true;
957 } else {
959 const uint32_t* pErrors = processors()->errorCodes.getErrorPtr();
960 for (uint32_t j = 0; j < nErrors; j++) {
961 if (GetProcessingSettings().debugOnFailureErrorMask & (1 << pErrors[4 * j])) {
962 hasDebugError = true;
963 break;
964 }
965 }
966 }
967 }
968 }
969 }
970 ClearErrorCodes(cpuOnly);
971 if (hasDebugError) {
973 }
974 return retVal;
975}
976
978{
980 if (mRec->IsGPU() && !cpuOnly) {
981 const auto& threadContext = GetThreadContext();
982 WriteToConstantMemory(RecoStep::NoRecoStep, (char*)&processors()->errorCodes - (char*)processors(), &processorsShadow()->errorCodes, sizeof(processorsShadow()->errorCodes), 0);
983 TransferMemoryResourceLinkToGPU(RecoStep::NoRecoStep, mInputsHost->mResourceErrorCodes, 0);
984 }
985}
986
988{
989 std::lock_guard lk(mMutexUpdateCalib);
990 if (mNewCalibObjects) {
991 void* const* pSrc = (void* const*)&obj;
992 void** pDst = (void**)mNewCalibObjects.get();
993 for (uint32_t i = 0; i < sizeof(*mNewCalibObjects) / sizeof(void*); i++) {
994 if (pSrc[i]) {
995 pDst[i] = pSrc[i];
996 }
997 }
998 } else {
1000 }
1001 if (mNewCalibValues) {
1002 mNewCalibValues->updateFrom(&vals);
1003 } else {
1004 mNewCalibValues.reset(new GPUNewCalibValues(vals));
1005 }
1007}
1008
1010{
1011 return (mRec->IsGPU() ? processorsShadow() : processors())->calibObjects.o2Propagator;
1012}
1013
1015{
1017 if ((prop->getGPUField() != nullptr) ^ GetProcessingSettings().o2PropagatorUseGPUField) {
1018 GPUFatal("GPU magnetic field for propagator requested, but received an O2 propagator without GPU field");
1019 }
1020}
1021
1022void GPUChainTracking::ApplySyncSettings(GPUSettingsProcessing& proc, GPUSettingsRec& rec, gpudatatypes::RecoStepField& steps, bool syncMode, int32_t dEdxMode)
1023{
1024 if (syncMode) {
1025 rec.useMatLUT = false;
1026 }
1027 if (proc.rtc.optSpecialCode == -1) {
1028 proc.rtc.optSpecialCode = syncMode;
1029 }
1030 if (dEdxMode != -2) {
1031 steps.setBits(gpudatatypes::RecoStep::TPCdEdx, dEdxMode == -1 ? !syncMode : (dEdxMode > 0));
1032 }
1033}
Definition of container class for dE/dx corrections.
#define rand()
unsigned char uint8_t
unsigned int uint32_t
int32_t i
int32_t retVal
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone proc
configStandalone rec
Online TRD tracker based on extrapolated TPC tracks.
Used for storing the MC labels for the TRD tracklets.
TRD Tracklet word for GPU tracker - 32bit tracklet info + half chamber ID + index.
Definition of a container to keep Monte Carlo truth external to simulation objects.
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
POD correction map.
std::string hash() const
void Start()
Definition timer.cxx:64
double GetElapsedTime()
Definition timer.cxx:115
void Stop()
Definition timer.cxx:76
bitfield & setBits(const bitfield v, bool w)
Definition bitfield.h:45
bool isSet(const bitfield &v) const
Definition bitfield.h:66
void SetMatLUT(std::unique_ptr< o2::base::MatLayerCylSet > &&lut)
static void ApplySyncSettings(GPUSettingsProcessing &proc, GPUSettingsRec &rec, gpudatatypes::RecoStepField &steps, bool syncMode, int32_t dEdxMode=-2)
std::unique_ptr< o2::base::MatLayerCylSet > mMatLUTU
const o2::base::Propagator * GetDeviceO2Propagator()
std::unique_ptr< o2::tpc::ClusterNativeAccess > mClusterNativeAccess
std::unique_ptr< GPUTRDRecoParam > mTRDRecoParamU
void SetTRDGeometry(std::unique_ptr< o2::trd::GeometryFlat > &&geo)
GPUChainTracking * mQAFromForeignChain
void SetO2Propagator(const o2::base::Propagator *prop)
std::unique_ptr< GPUQA > mQA
GPUTrackingFlatObjects mFlatObjectsDevice
int32_t RunTPCClusterizer(bool synchronizeOutput=true)
void UpdateGPUCalibObjectsPtrs(int32_t stream)
int32_t RunTPCTrackingMerger(bool synchronizeOutput=true)
std::unique_ptr< GPUTrackingInputProvider > mInputsHost
std::unique_ptr< GPUTPCClusterStatistics > mCompressionStatistics
const o2::base::MatLayerCylSet * GetMatLUT() const
void SetTRDRecoParam(std::unique_ptr< GPUTRDRecoParam > &&par)
std::unique_ptr< std::ostream > mDebugFile
std::array< GPUOutputControl *, GPUTrackingOutputs::count()> mSubOutputControls
void SetTPCFastTransform(aligned_unique_buffer_ptr< TPCFastTransformPOD > &&tpcFastTransform)
void SetUpdateCalibObjects(const GPUCalibObjectsConst &obj, const GPUNewCalibValues &vals)
std::unique_ptr< GPUCalibObjectsConst > mNewCalibObjects
std::unique_ptr< o2::trd::GeometryFlat > mTRDGeometryU
GPUTrackingFlatObjects mFlatObjectsShadow
void RegisterPermanentMemoryAndProcessors() override
void RegisterGPUProcessors() override
void ClearErrorCodes(bool cpuOnly=false)
const GPUQA * GetQA() const
void MemorySize(size_t &gpuMem, size_t &pageLockedHostMem) override
GPUChainTracking(GPUReconstruction *rec, uint32_t maxTPCHits=constants::GPU_MEM_MAX_TPC_CLUSTERS, uint32_t maxTRDTracklets=constants::GPU_MEM_MAX_TRD_TRACKLETS)
int32_t DoQueuedUpdates(int32_t stream, bool updateSlave=true)
std::unique_ptr< GPUNewCalibValues > mNewCalibValues
int32_t CheckErrorCodes(bool cpuOnly=false, bool forceShowErrors=false, std::vector< std::array< uint32_t, 4 > > *fillErrors=nullptr) override
int32_t PrepareEvent() override
void UpdateGPUCalibObjects(int32_t stream, const GPUCalibObjectsConst *ptrMask=nullptr)
GPUTrackingInOutPointers & mIOPtrs
struct o2::gpu::GPUChainTracking::InOutMemory mIOMem
const o2::tpc::CalibdEdxContainer * GetdEdxCalibContainer() const
std::unique_ptr< GPUTrackingInputProvider > mInputsShadow
const GPUSettingsQA * mConfigQA
int32_t FinalizePipelinedProcessing() override
std::unique_ptr< GPUDisplayInterface > mEventDisplay
std::unique_ptr< o2::tpc::ClusterNativeAccess > mClusterNativeAccessReduced
aligned_unique_buffer_ptr< TPCFastTransformPOD > mTPCFastTransformU
void TransferMemoryResourceLinkToGPU(RecoStep step, int16_t res, int32_t stream=-1, deviceEvent *ev=nullptr, deviceEvent *evList=nullptr, int32_t nEvents=1)
Definition GPUChain.h:124
GPUConstantMem * processorsDevice()
Definition GPUChain.h:86
GPUReconstruction::RecoStepField GetRecoStepsGPU() const
Definition GPUChain.h:72
GPUReconstruction::RecoStepField GetRecoSteps() const
Definition GPUChain.h:71
void WriteToConstantMemory(RecoStep step, size_t offset, const void *src, size_t size, int32_t stream=-1, deviceEvent *ev=nullptr)
Definition GPUChain.h:128
GPUChain * GetNextChainInQueue()
Definition GPUChain.h:236
GPUReconstruction::InOutTypeField GetRecoStepsOutputs() const
Definition GPUChain.h:74
virtual std::unique_ptr< GPUReconstructionProcessing::threadContext > GetThreadContext()
Definition GPUChain.h:109
GPUConstantMem * processors()
Definition GPUChain.h:84
GPUParam & param()
Definition GPUChain.h:87
const GPUSettingsProcessing & GetProcessingSettings() const
Definition GPUChain.h:76
void SynchronizeStream(int32_t stream)
Definition GPUChain.h:89
GPUReconstructionCPU * mRec
Definition GPUChain.h:79
GPUConstantMem * processorsShadow()
Definition GPUChain.h:85
GPUReconstruction::InOutTypeField GetRecoStepsInputs() const
Definition GPUChain.h:73
static constexpr int32_t NSECTORS
Definition GPUChain.h:58
void TransferMemoryResourceLinkToHost(RecoStep step, int16_t res, int32_t stream=-1, deviceEvent *ev=nullptr, deviceEvent *evList=nullptr, int32_t nEvents=1)
Definition GPUChain.h:125
void AllocateIOMemoryHelper(uint32_t n, const T *&ptr, std::unique_ptr< T[]> &u)
Definition GPUChain.h:140
int32_t runRecoStep(RecoStep step, S T::*func, Args... args)
Definition GPUChain.h:298
GPUReconstruction * rec()
Definition GPUChain.h:66
static GPUDisplayInterface * getDisplay(GPUDisplayFrontendInterface *frontend, GPUChainTracking *chain, GPUQA *qa, const GPUParam *param=nullptr, const GPUCalibObjectsConst *calib=nullptr, const GPUSettingsDisplay *config=nullptr, const GPUSettingsProcessing *proc=nullptr)
const uint32_t * getErrorPtr() const
Definition GPUErrors.cxx:96
void setMemory(GPUglobalref() uint32_t *m)
Definition GPUErrors.h:37
bool printErrors(bool silent=false, uint64_t mask=0)
Definition GPUErrors.cxx:61
uint32_t getNErrors() const
Definition GPUErrors.cxx:91
static void computePointerWithAlignment(T *&basePtr, S *&objPtr, size_t nEntries=1)
void InitGPUProcessor(GPUReconstruction *rec, ProcessorType type=PROCESSOR_TYPE_CPU, GPUProcessor *slaveProcessor=nullptr)
static bool QAAvailable()
Definition GPUQA.h:57
int32_t DrawQAHistograms()
Definition GPUQA.h:47
void UpdateChain(GPUChainTracking *chain)
Definition GPUQA.h:59
static bool IsInitialized()
Definition GPUQA.h:58
int32_t InitQA(int32_t tasks=0)
Definition GPUQA.h:45
void RunQA(bool matchOnly=false)
Definition GPUQA.h:46
HighResTimer & getGeneralStepTimer(GeneralStep step)
const GPUDefParameters & getGPUParameters(bool doGPU) const override
std::vector< std::array< uint32_t, 4 > > * getErrorCodeOutput()
RecoStepField GetRecoStepsGPU() const
void RegisterGPUDeviceProcessor(GPUProcessor *proc, GPUProcessor *slaveProcessor)
void RegisterGPUProcessor(T *proc, bool deviceSlave)
void setDebugDumpCallback(std::function< void()> &&callback=std::function< void()>(nullptr))
void ResetRegisteredMemoryPointers(GPUProcessor *proc)
int16_t RegisterMemoryAllocation(T *proc, void *(T::*setPtr)(void *), int32_t type, const char *name="", const GPUMemoryReuse &re=GPUMemoryReuse())
void PopNonPersistentMemory(RecoStep step, uint64_t tag, const GPUProcessor *proc=nullptr)
void UpdateSettings(const GPUSettingsGRP *g, const GPUSettingsProcessing *p=nullptr, const GPUSettingsRecDynamic *d=nullptr)
void PushNonPersistentMemory(uint64_t tag)
GPUMemorySizeScalers * MemoryScalers()
const GPUSettingsProcessing & GetProcessingSettings() const
const GPUSettingsGRP & GetGRPSettings() const
GPUOutputControl & OutputControl()
GLenum GLfloat param
Definition glcorearb.h:271
GLuint GLuint stream
Definition glcorearb.h:1806
GPUCalibObjectsTemplate< ConstPtr > GPUCalibObjectsConst
Global TPC definitions and constants.
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
std::string filename()
std::unique_ptr< GPUDisplayFrontendInterface > eventDisplay
constexpr T qStr2Tag(const char(&str)[N])
Definition strtag.h:24
S< o2::trd::GeometryFlat >::type * trdGeometry
S< o2::tpc::CalibdEdxContainer >::type * dEdxCalibContainer
S< TPCZSLinkMapping >::type * tpcZSLinkMapping
S< TPCFastTransformPOD >::type * fastTransform
S< GPUTRDRecoParam >::type * trdRecoParam
S< TPCPadGainCalib >::type * tpcPadGain
S< o2::base::PropagatorImpl< float > >::type * o2Propagator
S< o2::base::MatLayerCylSet >::type * matLUT
std::unique_ptr< GPUTPCMCInfo[]> mcInfosTPC
std::unique_ptr< GPUTRDTrackletWord[]> trdTracklets
std::unique_ptr< GPUTPCMCInfoCol[]> mcInfosTPCCol
std::unique_ptr< GPUTPCGMMergedTrackHit[]> mergedTrackHits
std::unique_ptr< int32_t[]> trdTrackletIdxFirst
std::unique_ptr< GPUTPCGMMergedTrack[]> mergedTracks
std::unique_ptr< AliHLTTPCClusterMCLabel[]> mcLabelsTPC
std::unique_ptr< GPUTPCClusterData[]> clusterData[NSECTORS]
std::unique_ptr< o2::tpc::ClusterNative[]> clustersNative
std::unique_ptr< float[]> trdTriggerTimes
std::unique_ptr< GPUTPCTrack[]> sectorTracks[NSECTORS]
std::unique_ptr< GPUTRDSpacePoint[]> trdSpacePoints
std::unique_ptr< uint8_t[]> trdTrigRecMask
std::unique_ptr< o2::tpc::ClusterNativeAccess > clusterNativeAccess
std::unique_ptr< AliHLTTPCRawCluster[]> rawClusters[NSECTORS]
std::unique_ptr< GPUTPCHitId[]> sectorClusters[NSECTORS]
std::unique_ptr< GPUTRDTrackGPU[]> trdTracks
GPUTRDTrackerGPU trdTrackerGPU
GPUCalibObjectsConst calibObjects
const GPUTPCHitId * sectorClusters[NSECTORS]
const o2::tpc::ClusterNativeAccess * clustersNative
const o2::tpc::CompressedClustersFlat * tpcCompressedClusters
const AliHLTTPCClusterMCLabel * mcLabelsTPC
const GPUTRDSpacePoint * trdSpacePoints
const GPUTPCTrack * sectorTracks[NSECTORS]
const GPUTRDTrackGPU * trdTracks
const GPUTRDTrackletWord * trdTracklets
const GPUTrackingInOutZS * tpcZS
const AliHLTTPCRawCluster * rawClusters[NSECTORS]
const GPUTPCClusterData * clusterData[NSECTORS]
const GPUTPCGMMergedTrackHit * mergedTrackHits
const GPUTrackingInOutDigits * tpcPackedDigits
const GPUTPCMCInfoCol * mcInfosTPCCol
const GPUTPCGMMergedTrack * mergedTracks
size_t getIndex(const GPUOutputControl &v)
GPUOutputControl sharedClusterMap
GPUOutputControl compressedClusters