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"
22#include "GPUTPCClusterData.h"
23#include "GPUTPCSectorOutput.h"
25#include "GPUTPCGMMergedTrack.h"
27#include "GPUTPCTrack.h"
28#include "GPUTPCHitId.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"
38#include "GPUQA.h"
39#include "GPULogging.h"
42#include "GPUNewCalibValues.h"
43#include "GPUTriggerOutputs.h"
44
46#include "GPUHostDataTypes.h"
48#include "GPUTrackingRefit.h"
49#include "CalibdEdxContainer.h"
50
51#include "TPCFastTransform.h"
53
54#include "utils/linux_helpers.h"
55#include "utils/strtag.h"
56using namespace o2::gpu;
57
58#include "GPUO2DataTypes.h"
59
60using namespace o2::tpc;
61using namespace o2::trd;
62
63GPUChainTracking::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::ofstream)
64{
68}
69
71
73{
74 if (mRec->IsGPU()) {
78 }
79
81 if (GetRecoSteps() & RecoStep::TPCSectorTracking) {
82 for (uint32_t i = 0; i < NSECTORS; i++) {
83 mRec->RegisterGPUProcessor(&processors()->tpcTrackers[i], GetRecoStepsGPU() & RecoStep::TPCSectorTracking);
84 }
85 }
86 if (GetRecoSteps() & RecoStep::TPCMerging) {
87 mRec->RegisterGPUProcessor(&processors()->tpcMerger, GetRecoStepsGPU() & RecoStep::TPCMerging);
88 }
89 if (GetRecoSteps() & RecoStep::TRDTracking) {
90 mRec->RegisterGPUProcessor(&processors()->trdTrackerGPU, GetRecoStepsGPU() & RecoStep::TRDTracking);
91 }
92 if (GetRecoSteps() & RecoStep::TRDTracking) {
93 mRec->RegisterGPUProcessor(&processors()->trdTrackerO2, GetRecoStepsGPU() & RecoStep::TRDTracking);
94 }
95 if (GetRecoSteps() & RecoStep::TPCConversion) {
96 mRec->RegisterGPUProcessor(&processors()->tpcConverter, GetRecoStepsGPU() & RecoStep::TPCConversion);
97 }
98 if (GetRecoSteps() & RecoStep::TPCCompression) {
99 mRec->RegisterGPUProcessor(&processors()->tpcCompressor, GetRecoStepsGPU() & RecoStep::TPCCompression);
100 }
101 if (GetRecoSteps() & RecoStep::TPCDecompression) {
102 mRec->RegisterGPUProcessor(&processors()->tpcDecompressor, GetRecoStepsGPU() & RecoStep::TPCDecompression);
103 }
104 if (GetRecoSteps() & RecoStep::TPCClusterFinding) {
105 for (uint32_t i = 0; i < NSECTORS; i++) {
106 mRec->RegisterGPUProcessor(&processors()->tpcClusterer[i], GetRecoStepsGPU() & RecoStep::TPCClusterFinding);
107 }
108 }
109 if (GetRecoSteps() & RecoStep::Refit) {
110 mRec->RegisterGPUProcessor(&processors()->trackingRefit, GetRecoStepsGPU() & RecoStep::Refit);
111 }
112#ifdef GPUCA_KERNEL_DEBUGGER_OUTPUT
113 mRec->RegisterGPUProcessor(&processors()->debugOutput, true);
114#endif
116}
117
119{
120 if (mRec->IsGPU()) {
122 }
123 memcpy((void*)&processorsShadow()->trdTrackerGPU, (const void*)&processors()->trdTrackerGPU, sizeof(processors()->trdTrackerGPU));
124 if (GetRecoStepsGPU() & RecoStep::TPCSectorTracking) {
125 for (uint32_t i = 0; i < NSECTORS; i++) {
126 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcTrackers[i], &processors()->tpcTrackers[i]);
127 }
128 }
129 if (GetRecoStepsGPU() & RecoStep::TPCMerging) {
130 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcMerger, &processors()->tpcMerger);
131 }
132 if (GetRecoStepsGPU() & RecoStep::TRDTracking) {
133 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->trdTrackerGPU, &processors()->trdTrackerGPU);
134 }
135
136 memcpy((void*)&processorsShadow()->trdTrackerO2, (const void*)&processors()->trdTrackerO2, sizeof(processors()->trdTrackerO2));
137 if (GetRecoStepsGPU() & RecoStep::TRDTracking) {
138 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->trdTrackerO2, &processors()->trdTrackerO2);
139 }
140 if (GetRecoStepsGPU() & RecoStep::TPCConversion) {
141 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcConverter, &processors()->tpcConverter);
142 }
143 if (GetRecoStepsGPU() & RecoStep::TPCCompression) {
144 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcCompressor, &processors()->tpcCompressor);
145 }
146 if (GetRecoStepsGPU() & RecoStep::TPCDecompression) {
147 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcDecompressor, &processors()->tpcDecompressor);
148 }
149 if (GetRecoStepsGPU() & RecoStep::TPCClusterFinding) {
150 for (uint32_t i = 0; i < NSECTORS; i++) {
151 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->tpcClusterer[i], &processors()->tpcClusterer[i]);
152 }
153 }
154 if (GetRecoStepsGPU() & RecoStep::Refit) {
155 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->trackingRefit, &processors()->trackingRefit);
156 }
157#ifdef GPUCA_KERNEL_DEBUGGER_OUTPUT
158 mRec->RegisterGPUDeviceProcessor(&processorsShadow()->debugOutput, &processors()->debugOutput);
159#endif
160}
161
162void GPUChainTracking::MemorySize(size_t& gpuMem, size_t& pageLockedHostMem)
163{
164 gpuMem = GPUCA_MEMORY_SIZE;
165 pageLockedHostMem = GPUCA_HOST_MEMORY_SIZE;
166}
167
169{
170 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCdEdx) && !(GetRecoSteps() & GPUDataTypes::RecoStep::TPCMerging)) {
171 GPUError("Invalid Reconstruction Step Setting: dEdx requires TPC Merger to be active");
172 return false;
173 }
174 if ((GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCdEdx) && !(GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCMerging)) {
175 GPUError("Invalid GPU Reconstruction Step Setting: dEdx requires TPC Merger to be active");
176 return false;
177 }
178 if (!param().par.earlyTpcTransform) {
179 if (((GetRecoSteps() & GPUDataTypes::RecoStep::TPCSectorTracking) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCMerging)) && !(GetRecoSteps() & GPUDataTypes::RecoStep::TPCConversion)) {
180 GPUError("Invalid Reconstruction Step Setting: Tracking without early transform requires TPC Conversion to be active");
181 return false;
182 }
183 }
184 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCClusterFinding) && !(GetRecoStepsInputs() & GPUDataTypes::InOutType::TPCRaw)) {
185 GPUError("Invalid input, TPC Clusterizer needs TPC raw input");
186 return false;
187 }
188 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCMerging) && ((GetRecoStepsInputs() & GPUDataTypes::InOutType::TPCSectorTracks) || (GetRecoStepsOutputs() & GPUDataTypes::InOutType::TPCSectorTracks) || !(GetRecoSteps() & GPUDataTypes::RecoStep::TPCConversion))) {
189 GPUError("Invalid input / output / step, merger cannot read/store sectors tracks and needs TPC conversion");
190 return false;
191 }
192 bool tpcClustersAvail = (GetRecoStepsInputs() & GPUDataTypes::InOutType::TPCClusters) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCClusterFinding) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCDecompression);
193 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCMerging) && !tpcClustersAvail) {
194 GPUError("Invalid Inputs for track merging, TPC Clusters required");
195 return false;
196 }
197#ifndef GPUCA_TPC_GEOMETRY_O2
198 if (GetRecoSteps() & GPUDataTypes::RecoStep::TPCClusterFinding) {
199 GPUError("Can not run TPC GPU Cluster Finding with Run 2 Data");
200 return false;
201 }
202#endif
203 if (((GetRecoSteps() & GPUDataTypes::RecoStep::TPCConversion) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCSectorTracking) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCCompression) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCdEdx)) && !tpcClustersAvail) {
204 GPUError("Missing input for TPC Cluster conversion / sector tracking / compression / dEdx: TPC Clusters required");
205 return false;
206 }
207 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCMerging) && !((GetRecoStepsInputs() & GPUDataTypes::InOutType::TPCSectorTracks) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCSectorTracking))) {
208 GPUError("Input for TPC merger missing");
209 return false;
210 }
211 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCCompression) && !((GetRecoStepsInputs() & GPUDataTypes::InOutType::TPCMergedTracks) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCMerging))) {
212 GPUError("Input for TPC compressor missing");
213 return false;
214 }
215 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TRDTracking) && (!((GetRecoStepsInputs() & GPUDataTypes::InOutType::TPCMergedTracks) || (GetRecoSteps() & GPUDataTypes::RecoStep::TPCMerging)) || !(GetRecoStepsInputs() & GPUDataTypes::InOutType::TRDTracklets))) {
216 GPUError("Input for TRD Tracker missing");
217 return false;
218 }
219 if ((GetRecoStepsOutputs() & GPUDataTypes::InOutType::TPCRaw) || (GetRecoStepsOutputs() & GPUDataTypes::InOutType::TRDTracklets)) {
220 GPUError("TPC Raw / TPC Clusters / TRD Tracklets cannot be output");
221 return false;
222 }
223 if ((GetRecoStepsOutputs() & GPUDataTypes::InOutType::TPCSectorTracks) && !(GetRecoSteps() & GPUDataTypes::RecoStep::TPCSectorTracking)) {
224 GPUError("No TPC Sector Tracker Output available");
225 return false;
226 }
227 if ((GetRecoStepsOutputs() & GPUDataTypes::InOutType::TPCMergedTracks) && !(GetRecoSteps() & GPUDataTypes::RecoStep::TPCMerging)) {
228 GPUError("No TPC Merged Track Output available");
229 return false;
230 }
231 if ((GetRecoStepsOutputs() & GPUDataTypes::InOutType::TPCCompressedClusters) && !(GetRecoSteps() & GPUDataTypes::RecoStep::TPCCompression)) {
232 GPUError("No TPC Compression Output available");
233 return false;
234 }
235 if ((GetRecoStepsOutputs() & GPUDataTypes::InOutType::TRDTracks) && !(GetRecoSteps() & GPUDataTypes::RecoStep::TRDTracking)) {
236 GPUError("No TRD Tracker Output available");
237 return false;
238 }
239 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCdEdx) && (processors()->calibObjects.dEdxCalibContainer == nullptr)) {
240 GPUError("Cannot run dE/dx without dE/dx calibration container object");
241 return false;
242 }
243 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCClusterFinding) && processors()->calibObjects.tpcPadGain == nullptr) {
244 GPUError("Cannot run gain calibration without calibration object");
245 return false;
246 }
247 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCClusterFinding) && processors()->calibObjects.tpcZSLinkMapping == nullptr && mIOPtrs.tpcZS != nullptr) {
248 GPUError("Cannot run TPC ZS Decoder without mapping object. (tpczslinkmapping.dump missing?)");
249 return false;
250 }
251 return true;
252}
253
255{
256 if ((param().rec.tpc.nWays & 1) == 0) {
257 GPUError("nWay setting musst be odd number!");
258 return false;
259 }
260 if (param().rec.tpc.mergerInterpolateErrors && param().rec.tpc.nWays == 1) {
261 GPUError("Cannot do error interpolation with NWays = 1!");
262 return false;
263 }
264 if (param().continuousMaxTimeBin > (int32_t)GPUSettings::TPC_MAX_TF_TIME_BIN) {
265 GPUError("configured max time bin exceeds 256 orbits");
266 return false;
267 }
268 if ((GetRecoStepsGPU() & RecoStep::TPCClusterFinding) && std::max(GetProcessingSettings().nTPCClustererLanes + 1, GetProcessingSettings().nTPCClustererLanes * 2) + (GetProcessingSettings().doublePipeline ? 1 : 0) > mRec->NStreams()) {
269 GPUError("NStreams (%d) must be > nTPCClustererLanes (%d)", mRec->NStreams(), (int32_t)GetProcessingSettings().nTPCClustererLanes);
270 return false;
271 }
272 if (GetProcessingSettings().noGPUMemoryRegistration && GetProcessingSettings().tpcCompressionGatherMode != 3) {
273 GPUError("noGPUMemoryRegistration only possible with gather mode 3");
274 return false;
275 }
276 if (GetProcessingSettings().doublePipeline) {
277 if (!GetRecoStepsOutputs().isOnlySet(GPUDataTypes::InOutType::TPCMergedTracks, GPUDataTypes::InOutType::TPCCompressedClusters, GPUDataTypes::InOutType::TPCClusters)) {
278 GPUError("Invalid outputs for double pipeline mode 0x%x", (uint32_t)GetRecoStepsOutputs());
279 return false;
280 }
281 if (((GetRecoStepsOutputs().isSet(GPUDataTypes::InOutType::TPCCompressedClusters) && mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::compressedClusters)] == nullptr) ||
282 (GetRecoStepsOutputs().isSet(GPUDataTypes::InOutType::TPCClusters) && mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clustersNative)] == nullptr) ||
283 (GetRecoStepsOutputs().isSet(GPUDataTypes::InOutType::TPCMergedTracks) && mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::tpcTracks)] == nullptr) ||
285 GPUError("Must use external output for double pipeline mode");
286 return false;
287 }
288 if (GetProcessingSettings().tpcCompressionGatherMode == 1) {
289 GPUError("Double pipeline incompatible to compression mode 1");
290 return false;
291 }
292 if (!(GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression) || !(GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding) || param().rec.fwdTPCDigitsAsClusters) {
293 GPUError("Invalid reconstruction settings for double pipeline: Needs compression and cluster finding");
294 return false;
295 }
296 }
297 if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCDecompression) && GetProcessingSettings().tpcApplyCFCutsAtDecoding && !GetProcessingSettings().tpcUseOldCPUDecoding) {
298 GPUError("tpcApplyCFCutsAtDecoding currently requires tpcUseOldCPUDecoding");
299 return false;
300 }
301 if ((GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression) && !(GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression) && (GetProcessingSettings().tpcCompressionGatherMode == 1 || GetProcessingSettings().tpcCompressionGatherMode == 3)) {
302 GPUError("Invalid tpcCompressionGatherMode for compression on CPU");
303 return false;
304 }
305 if (GetProcessingSettings().tpcApplyDebugClusterFilter == 1 && (GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding || GetProcessingSettings().delayedOutput || GetProcessingSettings().runMC)) {
306 GPUError("tpcApplyDebugClusterFilter cannot be used with GPU clusterization or with delayedOutput for GPU or with MC labels");
307 return false;
308 }
309 if (GetRecoSteps() & RecoStep::TRDTracking) {
310 if (GetProcessingSettings().trdTrackModelO2 && (GetProcessingSettings().createO2Output == 0 || param().rec.tpc.nWaysOuter == 0 || (GetMatLUT() == nullptr && !GetProcessingSettings().willProvideO2PropagatorLate))) {
311 GPUError("TRD tracking can only run on O2 TPC tracks if createO2Output is enabled (%d), nWaysOuter is set (%d), and matBudLUT is available (0x%p)", (int32_t)GetProcessingSettings().createO2Output, (int32_t)param().rec.tpc.nWaysOuter, (void*)GetMatLUT());
312 return false;
313 }
314 if ((GetRecoStepsGPU() & RecoStep::TRDTracking) && !GetProcessingSettings().trdTrackModelO2 && GetProcessingSettings().createO2Output > 1) {
315 GPUError("TRD tracking can only run on GPU TPC tracks if the createO2Output setting does not suppress them");
316 return false;
317 }
318 if ((((GetRecoStepsGPU() & RecoStep::TRDTracking) && GetProcessingSettings().trdTrackModelO2) || ((GetRecoStepsGPU() & RecoStep::Refit) && !param().rec.trackingRefitGPUModel)) && (!GetProcessingSettings().o2PropagatorUseGPUField || (GetMatLUT() == nullptr && !GetProcessingSettings().willProvideO2PropagatorLate))) {
319 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());
320 return false;
321 }
322 }
323 return true;
324}
325
327{
328 const auto& threadContext = GetThreadContext();
329 if (GetProcessingSettings().debugLevel >= 1) {
330 printf("Enabled Reconstruction Steps: 0x%x (on GPU: 0x%x)", (int32_t)GetRecoSteps().get(), (int32_t)GetRecoStepsGPU().get());
331 for (uint32_t i = 0; i < sizeof(GPUDataTypes::RECO_STEP_NAMES) / sizeof(GPUDataTypes::RECO_STEP_NAMES[0]); i++) {
332 if (GetRecoSteps().isSet(1u << i)) {
333 printf(" - %s", GPUDataTypes::RECO_STEP_NAMES[i]);
334 if (GetRecoStepsGPU().isSet(1u << i)) {
335 printf(" (G)");
336 }
337 }
338 }
339 printf("\n");
340 }
341 if (!ValidateSteps()) {
342 return 1;
343 }
344
345 for (uint32_t i = 0; i < mSubOutputControls.size(); i++) {
346 if (mSubOutputControls[i] == nullptr) {
348 }
349 }
350
351 if (!ValidateSettings()) {
352 return 1;
353 }
354
357 if (!qa) {
358 qa.reset(new GPUQA(this));
359 }
360 }
363 if (mEventDisplay == nullptr) {
364 throw std::runtime_error("Error loading event display");
365 }
366 }
367
370
371 if (mRec->IsGPU()) {
373 UpdateGPUCalibObjectsPtrs(-1); // First initialization, for users not using RunChain
375 WriteToConstantMemory(RecoStep::NoRecoStep, (char*)&processors()->errorCodes - (char*)processors(), &processorsShadow()->errorCodes, sizeof(processorsShadow()->errorCodes), -1);
376 TransferMemoryResourceLinkToGPU(RecoStep::NoRecoStep, mInputsHost->mResourceErrorCodes);
377 }
378
379 if (GetProcessingSettings().debugLevel >= 6) {
380 mDebugFile->open(mRec->IsGPU() ? "GPU.out" : "CPU.out");
381 }
382
383 return 0;
384}
385
387{
388 if (processors()->calibObjects.fastTransform && (ptrMask == nullptr || ptrMask->fastTransform)) {
389 memcpy((void*)mFlatObjectsShadow.mCalibObjects.fastTransform, (const void*)processors()->calibObjects.fastTransform, sizeof(*processors()->calibObjects.fastTransform));
390 memcpy((void*)mFlatObjectsShadow.mTpcTransformBuffer, (const void*)processors()->calibObjects.fastTransform->getFlatBufferPtr(), processors()->calibObjects.fastTransform->getFlatBufferSize());
391 mFlatObjectsShadow.mCalibObjects.fastTransform->clearInternalBufferPtr();
394 }
395 if (processors()->calibObjects.fastTransformMShape && (ptrMask == nullptr || ptrMask->fastTransformMShape)) {
396 memcpy((void*)mFlatObjectsShadow.mCalibObjects.fastTransformMShape, (const void*)processors()->calibObjects.fastTransformMShape, sizeof(*processors()->calibObjects.fastTransformMShape));
397 memcpy((void*)mFlatObjectsShadow.mTpcTransformMShapeBuffer, (const void*)processors()->calibObjects.fastTransformMShape->getFlatBufferPtr(), processors()->calibObjects.fastTransformMShape->getFlatBufferSize());
398 mFlatObjectsShadow.mCalibObjects.fastTransformMShape->clearInternalBufferPtr();
401 }
402 if (processors()->calibObjects.fastTransformRef && (ptrMask == nullptr || ptrMask->fastTransformRef)) {
403 memcpy((void*)mFlatObjectsShadow.mCalibObjects.fastTransformRef, (const void*)processors()->calibObjects.fastTransformRef, sizeof(*processors()->calibObjects.fastTransformRef));
404 memcpy((void*)mFlatObjectsShadow.mTpcTransformRefBuffer, (const void*)processors()->calibObjects.fastTransformRef->getFlatBufferPtr(), processors()->calibObjects.fastTransformRef->getFlatBufferSize());
405 mFlatObjectsShadow.mCalibObjects.fastTransformRef->clearInternalBufferPtr();
408 }
409 if (processors()->calibObjects.fastTransformHelper && (ptrMask == nullptr || ptrMask->fastTransformHelper)) {
410 memcpy((void*)mFlatObjectsShadow.mCalibObjects.fastTransformHelper, (const void*)processors()->calibObjects.fastTransformHelper, sizeof(*processors()->calibObjects.fastTransformHelper));
414 }
415 if (processors()->calibObjects.dEdxCalibContainer && (ptrMask == nullptr || ptrMask->dEdxCalibContainer)) {
416 memcpy((void*)mFlatObjectsShadow.mCalibObjects.dEdxCalibContainer, (const void*)processors()->calibObjects.dEdxCalibContainer, sizeof(*processors()->calibObjects.dEdxCalibContainer));
417 memcpy((void*)mFlatObjectsShadow.mdEdxSplinesBuffer, (const void*)processors()->calibObjects.dEdxCalibContainer->getFlatBufferPtr(), processors()->calibObjects.dEdxCalibContainer->getFlatBufferSize());
418 mFlatObjectsShadow.mCalibObjects.dEdxCalibContainer->clearInternalBufferPtr();
421 }
422 if (processors()->calibObjects.matLUT && (ptrMask == nullptr || ptrMask->matLUT)) {
423 memcpy((void*)mFlatObjectsShadow.mCalibObjects.matLUT, (const void*)processors()->calibObjects.matLUT, sizeof(*processors()->calibObjects.matLUT));
424 memcpy((void*)mFlatObjectsShadow.mMatLUTBuffer, (const void*)processors()->calibObjects.matLUT->getFlatBufferPtr(), processors()->calibObjects.matLUT->getFlatBufferSize());
425 mFlatObjectsShadow.mCalibObjects.matLUT->clearInternalBufferPtr();
428 }
429 if (processors()->calibObjects.trdGeometry && (ptrMask == nullptr || ptrMask->trdGeometry)) {
430 memcpy((void*)mFlatObjectsShadow.mCalibObjects.trdGeometry, (const void*)processors()->calibObjects.trdGeometry, sizeof(*processors()->calibObjects.trdGeometry));
431 mFlatObjectsShadow.mCalibObjects.trdGeometry->clearInternalBufferPtr();
432 }
433 if (processors()->calibObjects.tpcPadGain && (ptrMask == nullptr || ptrMask->tpcPadGain)) {
434 memcpy((void*)mFlatObjectsShadow.mCalibObjects.tpcPadGain, (const void*)processors()->calibObjects.tpcPadGain, sizeof(*processors()->calibObjects.tpcPadGain));
435 }
436 if (processors()->calibObjects.tpcZSLinkMapping && (ptrMask == nullptr || ptrMask->tpcZSLinkMapping)) {
437 memcpy((void*)mFlatObjectsShadow.mCalibObjects.tpcZSLinkMapping, (const void*)processors()->calibObjects.tpcZSLinkMapping, sizeof(*processors()->calibObjects.tpcZSLinkMapping));
438 }
439 if (processors()->calibObjects.o2Propagator && (ptrMask == nullptr || ptrMask->o2Propagator)) {
440 memcpy((void*)mFlatObjectsShadow.mCalibObjects.o2Propagator, (const void*)processors()->calibObjects.o2Propagator, sizeof(*processors()->calibObjects.o2Propagator));
441 mFlatObjectsShadow.mCalibObjects.o2Propagator->setGPUField(&processorsDevice()->param.polynomialField);
443 }
445 memcpy((void*)&processorsShadow()->calibObjects, (void*)&mFlatObjectsDevice.mCalibObjects, sizeof(mFlatObjectsDevice.mCalibObjects));
446}
447
449{
450 WriteToConstantMemory(RecoStep::NoRecoStep, (char*)&processors()->calibObjects - (char*)processors(), &mFlatObjectsDevice.mCalibObjects, sizeof(mFlatObjectsDevice.mCalibObjects), stream);
451}
452
454{
458 }
459 if (mIOPtrs.tpcZS && param().rec.fwdTPCDigitsAsClusters) {
460 throw std::runtime_error("Forwading zero-suppressed hits not supported");
461 }
463 return 0;
464}
465
467{
469 if (!qa) {
470 qa.reset(new GPUQA(this));
471 }
472 if (!GetQA()->IsInitialized()) {
473 return GetQA()->InitQA();
474 }
475 return 0;
476}
477
479{
480 if (GetProcessingSettings().runQA && GetQA()->IsInitialized() && !(mConfigQA && mConfigQA->shipToQC) && !mQAFromForeignChain) {
481 GetQA()->UpdateChain(this);
483 }
484 if (GetProcessingSettings().debugLevel >= 6) {
485 mDebugFile->close();
486 }
488 mCompressionStatistics->Finish();
489 }
490 return 0;
491}
492
494{
495 char* fastTransformBase = (char*)mem;
499 }
503 }
507 }
510 }
511 if ((char*)mem - fastTransformBase < mChainTracking->GetProcessingSettings().fastTransformObjectsMinMemorySize) {
512 mem = fastTransformBase + mChainTracking->GetProcessingSettings().fastTransformObjectsMinMemorySize; // TODO: Fixme and do proper dynamic allocation
513 }
516 }
519 }
520 char* dummyPtr;
524 } else if (mChainTracking->GetProcessingSettings().lateO2MatLutProvisioningSize) {
525 computePointerWithAlignment(mem, dummyPtr, mChainTracking->GetProcessingSettings().lateO2MatLutProvisioningSize);
526 }
530 }
533 }
536 mCalibObjects.o2Propagator = nullptr; // Always reserve memory for o2::Propagator, since it may be propagatred only during run() not during init().
537 }
539 mem = (char*)mem + mChainTracking->GetProcessingSettings().calibObjectsExtraMemorySize; // TODO: Fixme and do proper dynamic allocation
540 }
541 return mem;
542}
543
545{
546 std::memset((void*)&mIOPtrs, 0, sizeof(mIOPtrs));
548 new (&mIOMem) InOutMemory;
549}
550
552{
553 for (uint32_t i = 0; i < NSECTORS; i++) {
558 }
560 std::memset(mIOMem.clusterNativeAccess.get(), 0, sizeof(ClusterNativeAccess)); // ClusterNativeAccess has no its own constructor
575}
576
577void GPUChainTracking::SetTPCFastTransform(std::unique_ptr<TPCFastTransform>&& tpcFastTransform, std::unique_ptr<CorrectionMapsHelper>&& tpcTransformHelper)
578{
579 mTPCFastTransformU = std::move(tpcFastTransform);
580 mTPCFastTransformHelperU = std::move(tpcTransformHelper);
583}
584
585void GPUChainTracking::SetMatLUT(std::unique_ptr<o2::base::MatLayerCylSet>&& lut)
586{
587 mMatLUTU = std::move(lut);
589}
590
591void GPUChainTracking::SetTRDGeometry(std::unique_ptr<o2::trd::GeometryFlat>&& geo)
592{
593 mTRDGeometryU = std::move(geo);
595}
596
597int32_t GPUChainTracking::DoQueuedUpdates(int32_t stream, bool updateSlave)
598{
599 int32_t retVal = 0;
600 std::unique_ptr<GPUSettingsGRP> grp;
601 const GPUSettingsProcessing* p = nullptr;
602 std::lock_guard lk(mMutexUpdateCalib);
604 if (mNewCalibValues->newSolenoidField || mNewCalibValues->newContinuousMaxTimeBin || mNewCalibValues->newTPCTimeBinCut) {
605 grp = std::make_unique<GPUSettingsGRP>(mRec->GetGRPSettings());
606 if (mNewCalibValues->newSolenoidField) {
607 grp->solenoidBzNominalGPU = mNewCalibValues->solenoidField;
608 }
609 if (mNewCalibValues->newContinuousMaxTimeBin) {
610 grp->grpContinuousMaxTimeBin = mNewCalibValues->continuousMaxTimeBin;
611 }
612 if (mNewCalibValues->newTPCTimeBinCut) {
613 grp->tpcCutTimeBin = mNewCalibValues->tpcTimeBinCut;
614 }
615 }
616 }
617 if (GetProcessingSettings().tpcDownscaledEdx != 0) {
619 }
620 if (grp || p) {
621 mRec->UpdateSettings(grp.get(), p);
622 retVal = 1;
623 }
625 if (mNewCalibObjects->o2Propagator && ((mNewCalibObjects->o2Propagator->getGPUField() != nullptr) ^ GetProcessingSettings().o2PropagatorUseGPUField)) {
626 GPUFatal("GPU magnetic field for propagator requested, but received an O2 propagator without GPU field");
627 }
628 void* const* pSrc = (void* const*)mNewCalibObjects.get();
629 void** pDst = (void**)&processors()->calibObjects;
630 for (uint32_t i = 0; i < sizeof(processors()->calibObjects) / sizeof(void*); i++) {
631 if (pSrc[i]) {
632 pDst[i] = pSrc[i];
633 }
634 }
635 if (mNewCalibObjects->trdGeometry && (GetRecoSteps() & GPUDataTypes::RecoStep::TRDTracking)) {
636 if (GetProcessingSettings().trdTrackModelO2) {
638 if (mRec->IsGPU()) {
639 TransferMemoryResourceLinkToGPU(RecoStep::NoRecoStep, processors()->trdTrackerO2.MemoryPermanent(), stream);
640 }
641 } else {
643 if (mRec->IsGPU()) {
644 TransferMemoryResourceLinkToGPU(RecoStep::NoRecoStep, processors()->trdTrackerGPU.MemoryPermanent(), stream);
645 }
646 }
647 }
648 if (mRec->IsGPU()) {
649 std::array<uint8_t, sizeof(GPUTrackingFlatObjects)> oldFlatPtrs, oldFlatPtrsDevice;
650 memcpy(oldFlatPtrs.data(), (void*)&mFlatObjectsShadow, oldFlatPtrs.size());
651 memcpy(oldFlatPtrsDevice.data(), (void*)&mFlatObjectsDevice, oldFlatPtrsDevice.size());
653 bool ptrsChanged = memcmp(oldFlatPtrs.data(), (void*)&mFlatObjectsShadow, oldFlatPtrs.size()) || memcmp(oldFlatPtrsDevice.data(), (void*)&mFlatObjectsDevice, oldFlatPtrsDevice.size());
654 if (ptrsChanged) {
655 GPUInfo("Updating all calib objects since pointers changed");
656 }
657 UpdateGPUCalibObjects(stream, ptrsChanged ? nullptr : mNewCalibObjects.get());
658 }
659 }
660
661 if ((mUpdateNewCalibObjects || (mRec->slavesExist() && updateSlave)) && mRec->IsGPU()) {
662 UpdateGPUCalibObjectsPtrs(stream); // Reinitialize
663 retVal = 1;
664 }
665 mNewCalibObjects.reset(nullptr);
666 mNewCalibValues.reset(nullptr);
668 return retVal;
669}
670
672{
673 if ((((GetRecoSteps() & RecoStep::TRDTracking) && !GetProcessingSettings().trdTrackModelO2 && !GetProcessingSettings().willProvideO2PropagatorLate) || ((GetRecoSteps() & RecoStep::Refit) && !param().rec.trackingRefitGPUModel)) && processors()->calibObjects.o2Propagator == nullptr) {
674 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
675 }
676 if (GetProcessingSettings().autoAdjustHostThreads && !mRec->IsGPU()) {
678 }
679 const auto threadContext = GetThreadContext();
680 if (GetProcessingSettings().runCompressionStatistics && mCompressionStatistics == nullptr) {
682 }
683 const bool needQA = GPUQA::QAAvailable() && (GetProcessingSettings().runQA || (GetProcessingSettings().eventDisplay && (mIOPtrs.nMCInfosTPC || GetProcessingSettings().runMC)));
684 if (needQA && GetQA()->IsInitialized() == false) {
685 if (GetQA()->InitQA(GetProcessingSettings().runQA ? -GetProcessingSettings().runQA : -1)) {
686 return 1;
687 }
688 }
689 if (needQA) {
690 mFractionalQAEnabled = GetProcessingSettings().qcRunFraction == 100.f || (uint32_t)(rand() % 10000) < (uint32_t)(GetProcessingSettings().qcRunFraction * 100);
691 }
692 if (GetProcessingSettings().debugLevel >= 6) {
693 *mDebugFile << "\n\nProcessing event " << mRec->getNEventsProcessed() << std::endl;
694 }
696
697 mRec->getGeneralStepTimer(GeneralStep::Prepare).Start();
698 try {
700 } catch (const std::bad_alloc& e) {
701 GPUError("Memory Allocation Error");
702 return (1);
703 }
704 mRec->getGeneralStepTimer(GeneralStep::Prepare).Stop();
705
707
708 SynchronizeStream(0); // Synchronize all init copies that might be ongoing
709
711 if (runRecoStep(RecoStep::TPCDecompression, &GPUChainTracking::RunTPCDecompression)) {
712 return 1;
713 }
714 } else if (mIOPtrs.tpcPackedDigits || mIOPtrs.tpcZS) {
715 if (runRecoStep(RecoStep::TPCClusterFinding, &GPUChainTracking::RunTPCClusterizer, false)) {
716 return 1;
717 }
718 }
719
720 if (GetProcessingSettings().autoAdjustHostThreads && !mRec->IsGPU() && mIOPtrs.clustersNative) {
722 }
723
725 return 1;
726 }
727
728 mRec->PushNonPersistentMemory(qStr2Tag("TPCSLCD1")); // 1st stack level for TPC tracking sector data
730 if (runRecoStep(RecoStep::TPCSectorTracking, &GPUChainTracking::RunTPCTrackingSectors)) {
731 return 1;
732 }
733
734 if (runRecoStep(RecoStep::TPCMerging, &GPUChainTracking::RunTPCTrackingMerger, false)) {
735 return 1;
736 }
738 mRec->PopNonPersistentMemory(RecoStep::TPCSectorTracking, qStr2Tag("TPCSLCD1")); // Release 1st stack level, TPC sector data not needed after merger
740 }
741
743 if (GetProcessingSettings().doublePipeline) {
745 if (foreignChain && foreignChain->mIOPtrs.tpcZS) {
746 if (GetProcessingSettings().debugLevel >= 3) {
747 GPUInfo("Preempting tpcZS input of foreign chain");
748 }
749 mPipelineFinalizationCtx.reset(new GPUChainTrackingFinalContext);
750 mPipelineFinalizationCtx->rec = this->mRec;
751 foreignChain->mPipelineNotifyCtx = mPipelineFinalizationCtx.get();
752 }
753 }
754 if (runRecoStep(RecoStep::TPCCompression, &GPUChainTracking::RunTPCCompression)) {
755 return 1;
756 }
757 }
758
759 if (GetProcessingSettings().trdTrackModelO2 ? runRecoStep(RecoStep::TRDTracking, &GPUChainTracking::RunTRDTracking<GPUTRDTrackerKernels::o2Version>) : runRecoStep(RecoStep::TRDTracking, &GPUChainTracking::RunTRDTracking<GPUTRDTrackerKernels::gpuVersion>)) {
760 return 1;
761 }
762
763 if (runRecoStep(RecoStep::Refit, &GPUChainTracking::RunRefit)) {
764 return 1;
765 }
766
767 if (!GetProcessingSettings().doublePipeline) { // Synchronize with output copies running asynchronously
769 }
770
771 if (GetProcessingSettings().autoAdjustHostThreads && !mRec->IsGPU()) {
773 }
774
775 int32_t retVal = 0;
776 if (CheckErrorCodes(false, false, mRec->getErrorCodeOutput())) {
777 retVal = 3;
778 if (!GetProcessingSettings().ignoreNonFatalGPUErrors) {
779 return retVal;
780 }
781 }
782
783 if (GetProcessingSettings().doublePipeline) {
784 return retVal;
785 }
786 int32_t retVal2 = RunChainFinalize();
787 return retVal2 ? retVal2 : retVal;
788}
789
790int32_t GPUChainTracking::RunChainFinalize()
791{
792 if (mIOPtrs.clustersNative && (GetRecoSteps() & RecoStep::TPCCompression) && GetProcessingSettings().runCompressionStatistics) {
795 }
796
797 if (GetProcessingSettings().outputSanityCheck) {
798 SanityCheck();
799 }
800
801 const bool needQA = GPUQA::QAAvailable() && (GetProcessingSettings().runQA || (GetProcessingSettings().eventDisplay && mIOPtrs.nMCInfosTPC));
802 if (needQA && mFractionalQAEnabled) {
803 mRec->getGeneralStepTimer(GeneralStep::QA).Start();
804 GetQA()->UpdateChain(this);
805 GetQA()->RunQA(!GetProcessingSettings().runQA);
806 mRec->getGeneralStepTimer(GeneralStep::QA).Stop();
807 if (GetProcessingSettings().debugLevel == 0) {
808 GPUInfo("Total QA runtime: %d us", (int32_t)(mRec->getGeneralStepTimer(GeneralStep::QA).GetElapsedTime() * 1000000));
809 }
810 }
811
812 if (GetProcessingSettings().showOutputStat) {
814 }
815
817
818 //PrintMemoryRelations();
819
821 if (!mDisplayRunning) {
822 if (mEventDisplay->StartDisplay()) {
823 return (1);
824 }
825 mDisplayRunning = true;
826 } else {
827 mEventDisplay->ShowNextEvent();
828 }
829
830 if (GetProcessingSettings().eventDisplay->EnableSendKey()) {
831 while (kbhit()) {
832 getch();
833 }
834 GPUInfo("Press key for next event!");
835 }
836
837 int32_t iKey;
838 do {
839 Sleep(10);
840 if (GetProcessingSettings().eventDisplay->EnableSendKey()) {
841 iKey = kbhit() ? getch() : 0;
842 if (iKey == 27) {
843 GetProcessingSettings().eventDisplay->setDisplayControl(2);
844 } else if (iKey == 'n') {
845 break;
846 } else if (iKey) {
847 while (GetProcessingSettings().eventDisplay->getSendKey() != 0) {
848 Sleep(1);
849 }
850 GetProcessingSettings().eventDisplay->setSendKey(iKey);
851 }
852 }
853 } while (GetProcessingSettings().eventDisplay->getDisplayControl() == 0);
854 if (GetProcessingSettings().eventDisplay->getDisplayControl() == 2) {
855 mDisplayRunning = false;
856 GetProcessingSettings().eventDisplay->DisplayExit();
857 const_cast<GPUSettingsProcessing&>(GetProcessingSettings()).eventDisplay = nullptr; // TODO: fixme - eventDisplay should probably not be put into ProcessingSettings in the first place
858 return (2);
859 }
860 GetProcessingSettings().eventDisplay->setDisplayControl(0);
861 GPUInfo("Loading next event");
862
863 mEventDisplay->WaitForNextEvent();
864 }
865
866 return 0;
867}
868
870{
871 if (mPipelineFinalizationCtx) {
872 {
873 std::unique_lock<std::mutex> lock(mPipelineFinalizationCtx->mutex);
874 auto* ctx = mPipelineFinalizationCtx.get();
875 mPipelineFinalizationCtx->cond.wait(lock, [ctx]() { return ctx->ready; });
876 }
877 mPipelineFinalizationCtx.reset();
878 }
879 return RunChainFinalize();
880}
881
882int32_t GPUChainTracking::CheckErrorCodes(bool cpuOnly, bool forceShowErrors, std::vector<std::array<uint32_t, 4>>* fillErrors)
883{
884 int32_t retVal = 0;
885 for (int32_t i = 0; i < 1 + (!cpuOnly && mRec->IsGPU()); i++) {
886 if (i) {
887 const auto& threadContext = GetThreadContext();
888 if (GetProcessingSettings().doublePipeline) {
889 TransferMemoryResourceLinkToHost(RecoStep::NoRecoStep, mInputsHost->mResourceErrorCodes, 0);
891 } else {
892 TransferMemoryResourceLinkToHost(RecoStep::NoRecoStep, mInputsHost->mResourceErrorCodes);
893 }
894 }
895 if (processors()->errorCodes.hasError()) {
896 static int32_t errorsShown = 0;
897 static bool quiet = false;
898 static std::chrono::time_point<std::chrono::steady_clock> silenceFrom;
899 if (!quiet && errorsShown++ >= 10 && GetProcessingSettings().throttleAlarms && !forceShowErrors) {
900 silenceFrom = std::chrono::steady_clock::now();
901 quiet = true;
902 } else if (quiet) {
903 auto currentTime = std::chrono::steady_clock::now();
904 std::chrono::duration<double> elapsed_seconds = currentTime - silenceFrom;
905 if (elapsed_seconds.count() > 60 * 10) {
906 quiet = false;
907 errorsShown = 1;
908 }
909 }
910 retVal = 1;
911 if (GetProcessingSettings().throttleAlarms && !forceShowErrors) {
912 GPUWarning("GPUReconstruction suffered from an error in the %s part", i ? "GPU" : "CPU");
913 } else {
914 GPUError("GPUReconstruction suffered from an error in the %s part", i ? "GPU" : "CPU");
915 }
916 if (!quiet) {
917 processors()->errorCodes.printErrors(GetProcessingSettings().throttleAlarms && !forceShowErrors);
918 }
919 if (fillErrors) {
920 uint32_t nErrors = processors()->errorCodes.getNErrors();
921 const uint32_t* pErrors = processors()->errorCodes.getErrorPtr();
922 for (uint32_t j = 0; j < nErrors; j++) {
923 fillErrors->emplace_back(std::array<uint32_t, 4>{pErrors[4 * j], pErrors[4 * j + 1], pErrors[4 * j + 2], pErrors[4 * j + 3]});
924 }
925 }
926 }
927 }
928 ClearErrorCodes(cpuOnly);
929 return retVal;
930}
931
933{
935 if (mRec->IsGPU() && !cpuOnly) {
936 const auto& threadContext = GetThreadContext();
937 WriteToConstantMemory(RecoStep::NoRecoStep, (char*)&processors()->errorCodes - (char*)processors(), &processorsShadow()->errorCodes, sizeof(processorsShadow()->errorCodes), 0);
938 TransferMemoryResourceLinkToGPU(RecoStep::NoRecoStep, mInputsHost->mResourceErrorCodes, 0);
939 }
940}
941
943{
944 std::lock_guard lk(mMutexUpdateCalib);
945 if (mNewCalibObjects) {
946 void* const* pSrc = (void* const*)&obj;
947 void** pDst = (void**)mNewCalibObjects.get();
948 for (uint32_t i = 0; i < sizeof(*mNewCalibObjects) / sizeof(void*); i++) {
949 if (pSrc[i]) {
950 pDst[i] = pSrc[i];
951 }
952 }
953 } else {
955 }
956 if (mNewCalibValues) {
957 mNewCalibValues->updateFrom(&vals);
958 } else {
959 mNewCalibValues.reset(new GPUNewCalibValues(vals));
960 }
962}
963
965{
966 return (mRec->IsGPU() ? processorsShadow() : processors())->calibObjects.o2Propagator;
967}
968
970{
972 if ((prop->getGPUField() != nullptr) ^ GetProcessingSettings().o2PropagatorUseGPUField) {
973 GPUFatal("GPU magnetic field for propagator requested, but received an O2 propagator without GPU field");
974 }
975}
Definition of container class for dE/dx corrections.
Helper class to access correction maps.
int32_t i
#define GPUCA_MEMORY_SIZE
#define GPUCA_HOST_MEMORY_SIZE
int32_t retVal
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
Definition of TPCFastTransform class.
void Start()
Definition timer.cxx:57
double GetElapsedTime()
Definition timer.cxx:108
void Stop()
Definition timer.cxx:69
bool isSet(const bitfield &v) const
Definition bitfield.h:70
size_t getFlatBufferSize() const
Gives size of the flat buffer.
Definition FlatObject.h:256
void SetMatLUT(std::unique_ptr< o2::base::MatLayerCylSet > &&lut)
std::unique_ptr< o2::base::MatLayerCylSet > mMatLUTU
const o2::base::Propagator * GetDeviceO2Propagator()
void SetTRDGeometry(std::unique_ptr< o2::trd::GeometryFlat > &&geo)
GPUChainTracking * mQAFromForeignChain
void SetO2Propagator(const o2::base::Propagator *prop)
std::unique_ptr< GPUQA > mQA
std::unique_ptr< CorrectionMapsHelper > mTPCFastTransformHelperU
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
std::array< GPUOutputControl *, GPUTrackingOutputs::count()> mSubOutputControls
std::unique_ptr< std::ofstream > mDebugFile
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
void SetTPCFastTransform(std::unique_ptr< TPCFastTransform > &&tpcFastTransform, std::unique_ptr< CorrectionMapsHelper > &&tpcTransformHelper)
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
std::unique_ptr< TPCFastTransform > mTPCFastTransformU
int32_t PrepareEvent() override
GPUChainTracking(GPUReconstruction *rec, uint32_t maxTPCHits=GPUCA_MAX_CLUSTERS, uint32_t maxTRDTracklets=GPUCA_MAX_TRD_TRACKLETS)
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
void TransferMemoryResourceLinkToGPU(RecoStep step, int16_t res, int32_t stream=-1, deviceEvent *ev=nullptr, deviceEvent *evList=nullptr, int32_t nEvents=1)
Definition GPUChain.h:119
GPUConstantMem * processorsDevice()
Definition GPUChain.h:82
GPUReconstruction::RecoStepField GetRecoStepsGPU() const
Definition GPUChain.h:68
GPUReconstruction::RecoStepField GetRecoSteps() const
Definition GPUChain.h:67
virtual std::unique_ptr< gpu_reconstruction_kernels::threadContext > GetThreadContext()
Definition GPUChain.h:104
void WriteToConstantMemory(RecoStep step, size_t offset, const void *src, size_t size, int32_t stream=-1, deviceEvent *ev=nullptr)
Definition GPUChain.h:122
GPUChain * GetNextChainInQueue()
Definition GPUChain.h:217
GPUReconstruction::InOutTypeField GetRecoStepsOutputs() const
Definition GPUChain.h:70
GPUConstantMem * processors()
Definition GPUChain.h:80
GPUParam & param()
Definition GPUChain.h:83
const GPUSettingsProcessing & GetProcessingSettings() const
Definition GPUChain.h:72
void SynchronizeStream(int32_t stream)
Definition GPUChain.h:85
GPUReconstructionCPU * mRec
Definition GPUChain.h:75
GPUConstantMem * processorsShadow()
Definition GPUChain.h:81
GPUReconstruction::InOutTypeField GetRecoStepsInputs() const
Definition GPUChain.h:69
static constexpr int32_t NSECTORS
Definition GPUChain.h:54
void TransferMemoryResourceLinkToHost(RecoStep step, int16_t res, int32_t stream=-1, deviceEvent *ev=nullptr, deviceEvent *evList=nullptr, int32_t nEvents=1)
Definition GPUChain.h:120
void AllocateIOMemoryHelper(uint32_t n, const T *&ptr, std::unique_ptr< T[]> &u)
Definition GPUChain.h:134
int32_t runRecoStep(RecoStep step, S T::*func, Args... args)
Definition GPUChain.h:282
GPUReconstruction * rec()
Definition GPUChain.h:62
static constexpr const char *const RECO_STEP_NAMES[]
static GPUDisplayInterface * getDisplay(GPUDisplayFrontendInterface *frontend, GPUChainTracking *chain, GPUQA *qa, const GPUParam *param=nullptr, const GPUCalibObjectsConst *calib=nullptr, const GPUSettingsDisplay *config=nullptr)
const uint32_t * getErrorPtr() const
Definition GPUErrors.cxx:85
void setMemory(GPUglobalref() uint32_t *m)
Definition GPUErrors.h:34
void printErrors(bool silent=false)
Definition GPUErrors.cxx:57
uint32_t getNErrors() const
Definition GPUErrors.cxx:80
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:56
int32_t DrawQAHistograms()
Definition GPUQA.h:46
void UpdateChain(GPUChainTracking *chain)
Definition GPUQA.h:58
static bool IsInitialized()
Definition GPUQA.h:57
int32_t InitQA(int32_t tasks=0)
Definition GPUQA.h:44
void RunQA(bool matchOnly=false)
Definition GPUQA.h:45
HighResTimer & getGeneralStepTimer(GeneralStep step)
std::vector< std::array< uint32_t, 4 > > * getErrorCodeOutput()
void PopNonPersistentMemory(RecoStep step, uint64_t tag)
void RegisterGPUDeviceProcessor(GPUProcessor *proc, GPUProcessor *slaveProcessor)
void RegisterGPUProcessor(T *proc, bool deviceSlave)
void ResetRegisteredMemoryPointers(GPUProcessor *proc)
int16_t RegisterMemoryAllocation(T *proc, void *(T::*setPtr)(void *), int32_t type, const char *name="", const GPUMemoryReuse &re=GPUMemoryReuse())
void UpdateSettings(const GPUSettingsGRP *g, const GPUSettingsProcessing *p=nullptr, const GPUSettingsRecDynamic *d=nullptr)
void PushNonPersistentMemory(uint64_t tag)
GPUMemorySizeScalers * MemoryScalers()
const GPUSettingsGRP & GetGRPSettings() const
GPUOutputControl & OutputControl()
static constexpr const uint32_t TPC_MAX_TF_TIME_BIN
Definition GPUSettings.h:47
GLenum GLfloat param
Definition glcorearb.h:271
GLuint GLuint stream
Definition glcorearb.h:1806
GPUCalibObjectsTemplate< ConstPtr > GPUCalibObjectsConst
Global TPC definitions and constants.
Definition SimTraits.h:167
Defining DataPointCompositeObject explicitly as copiable.
std::unique_ptr< GPUDisplayFrontendInterface > eventDisplay
GPUReconstruction * rec
constexpr T qStr2Tag(const char *str)
Definition strtag.h:22
S< o2::trd::GeometryFlat >::type * trdGeometry
S< o2::tpc::CalibdEdxContainer >::type * dEdxCalibContainer
S< TPCZSLinkMapping >::type * tpcZSLinkMapping
S< TPCFastTransform >::type * fastTransform
S< TPCPadGainCalib >::type * tpcPadGain
S< o2::base::PropagatorImpl< float > >::type * o2Propagator
S< o2::base::MatLayerCylSet >::type * matLUT
S< CorrectionMapsHelper >::type * fastTransformHelper
S< TPCFastTransform >::type * fastTransformRef
S< TPCFastTransform >::type * fastTransformMShape
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< GPUTPCGMMergedTrackHitXYZ[]> mergedTrackHitsXYZ
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 GPUTPCGMMergedTrackHitXYZ * mergedTrackHitsXYZ
const GPUTPCHitId * sectorClusters[NSECTORS]
const o2::tpc::ClusterNativeAccess * clustersNative
const GPUTPCMCInfo * mcInfosTPC
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