Project
Loading...
Searching...
No Matches
standalone.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
15#ifndef GPUCA_STANDALONE
16#include "GPUO2ExternalUser.h" // Compiled like O2 code using the GPU interface: full O2 headers (e.g. MatLayerCylSet::rectifyPtrFromFile), ROOT before the GPU headers
19#include "TPCBase/Mapper.h"
20#endif
21
22#include "utils/qconfig.h"
23#include "GPUReconstruction.h"
26#include "GPUChainTracking.h"
27#include "GPUChainTrackingGetters.inc"
28#include "GPUTPCDef.h"
29#include "GPUQA.h"
30#include "GPUParam.h"
32#include "genEvents.h"
33
34#include "GPUTPCGMMergedTrack.h"
35#define GPUSETTINGS_ALL
36#include "GPUSettings.h"
37#include "GPUConstantMem.h"
38
39#include "GPUO2DataTypes.h"
40#include "GPUChainITS.h"
41
42// For creating default objects
44#include "CalibdEdxContainer.h"
45#include "TPCFastTransformPOD.h"
46#include "GPUTRDRecoParam.h"
47#include "TPCZSLinkMapping.h"
48
50
51#include <iostream>
52#include <fstream>
53#include <cstdio>
54#include <cstring>
55#include <chrono>
56#include <tuple>
57#include <algorithm>
58#include <thread>
59#include <future>
60#include <atomic>
61#include <vector>
62
63#ifndef _WIN32
64#include <unistd.h>
65#include <sched.h>
66#include <csignal>
67#include <sys/types.h>
68#include <sys/wait.h>
69#include <sys/select.h>
70#include <cfenv>
71#include <clocale>
72#include <sys/stat.h>
73#endif
74#include "utils/timer.h"
76#include "utils/vecpod.h"
77
78using namespace o2::gpu;
79
80// #define BROKEN_EVENTS
81
82namespace o2::gpu
83{
84extern GPUSettingsStandalone configStandalone;
85}
86
91std::string eventsDir;
93std::unique_ptr<GPUDisplayFrontendInterface> eventDisplay;
94std::unique_ptr<GPUReconstructionTimeframe> tf;
96std::atomic<uint32_t> nIteration, nIterationEnd;
97
98std::vector<GPUTrackingInOutPointers> ioPtrEvents;
99std::vector<GPUChainTracking::InOutMemory> ioMemEvents;
100
101int32_t ReadConfiguration(int argc, char** argv)
102{
103 int32_t qcRet = qConfig::qConfigParse(argc, (const char**)argv);
104 if (qcRet) {
105 if (qcRet != qConfig::qcrHelp) {
106 printf("Error parsing command line parameters\n");
107 }
108 return 1;
109 }
110 if (configStandalone.listRecoSteps) {
111 printf("RecoSteps (bitmask for --recoSteps / --recoStepsGPU):\n");
112 for (int32_t i = 0; i < gpudatatypes::N_RECO_STEPS; i++) {
113 printf("%10d (0x%04x): %s\n", 1 << i, 1 << i, gpudatatypes::RECO_STEP_NAMES[i]);
114 }
115 }
116 if (configStandalone.printSettings > 1) {
117 printf("Config Dump before ReadConfiguration\n");
119 }
120 if (configStandalone.proc.debugLevel == -1) {
121 configStandalone.proc.debugLevel = 0;
122 }
123#ifndef _WIN32
124 setlocale(LC_ALL, "en_US.utf-8");
125 setlocale(LC_NUMERIC, "en_US.utf-8");
126 if (configStandalone.cpuAffinity != -1) {
127#ifdef __linux__
128 cpu_set_t mask;
129 CPU_ZERO(&mask);
130 CPU_SET(configStandalone.cpuAffinity, &mask);
131
132 printf("Setting affinitiy to restrict on CPU core %d\n", configStandalone.cpuAffinity);
133 if (0 != sched_setaffinity(0, sizeof(mask), &mask)) {
134 printf("Error setting CPU affinity\n");
135 return 1;
136 }
137#else
138 printf("CPU affinity not supported on this platform\n");
139 return 1;
140#endif
141 }
142 if (configStandalone.fifoScheduler) {
143#ifdef __linux__
144 printf("Setting FIFO scheduler\n");
145 sched_param param;
146 sched_getparam(0, &param);
147 param.sched_priority = 1;
148 if (0 != sched_setscheduler(0, SCHED_FIFO, &param)) {
149 printf("Error setting scheduler\n");
150 return 1;
151 }
152#else
153 printf("FIFO scheduler not supported on this platform\n");
154 return 1;
155#endif
156 }
157#ifdef __FAST_MATH__
158 if (configStandalone.fpe == 1) {
159#else
160 if (configStandalone.fpe) {
161#endif
162#ifdef __linux__
163 feenableexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
164#else
165 printf("Trapping floating point exceptions not supported on this platform\n");
166#endif
167 }
168 bool detMode = false, noFTZMode = false;
169#ifdef GPUCA_DETERMINISTIC_MODE
170 detMode = true;
171#endif
172#ifdef GPUCA_DETERMINISTIC_NO_FTZ
173 noFTZMode = true;
174#endif
175 if (configStandalone.flushDenormals >= 1 || (configStandalone.flushDenormals == -1 && (configStandalone.proc.deterministicGPUReconstruction >= 1 || (configStandalone.proc.deterministicGPUReconstruction == -1 && detMode)) && !noFTZMode)) {
176 disable_denormals();
177 }
178
179#else
180 if (configStandalone.cpuAffinity != -1) {
181 printf("Affinity setting not supported on Windows\n");
182 return 1;
183 }
184 if (configStandalone.fifoScheduler) {
185 printf("FIFO Scheduler setting not supported on Windows\n");
186 return 1;
187 }
188 if (configStandalone.fpe == 1) {
189 printf("FPE not supported on Windows\n");
190 return 1;
191 }
192#endif
193#ifdef GPUCA_RUN2
194#warning Why was configStandalone.rec.tpc.mergerReadFromTrackerDirectly = 0 needed?
195 configStandalone.proc.inKernelParallel = false;
196 configStandalone.proc.createO2Output = 0;
197 if (configStandalone.rundEdx == -1) {
198 configStandalone.rundEdx = 0;
199 }
200#endif
201#ifndef GPUCA_BUILD_QA
202 if (configStandalone.proc.runQA || configStandalone.eventGenerator) {
203 printf("QA not enabled in build\n");
204 return 1;
205 }
206#endif
207 if (configStandalone.proc.doublePipeline && configStandalone.testSyncAsync) {
208 printf("Cannot run asynchronous processing with double pipeline\n");
209 return 1;
210 }
211 if (configStandalone.proc.doublePipeline && (configStandalone.runs < 4 || !configStandalone.outputcontrolmem)) {
212 printf("Double pipeline mode needs at least 4 runs per event and external output. To cycle though multiple events, use --preloadEvents and --runs n for n iterations round-robin\n");
213 return 1;
214 }
215 if (configStandalone.TF.bunchSim && configStandalone.TF.nMerge) {
216 printf("Cannot run --MERGE and --SIMBUNCHES togeterh\n");
217 return 1;
218 }
219 if (configStandalone.TF.bunchSim > 1) {
220 configStandalone.TF.timeFrameLen = 1.e9 * configStandalone.TF.bunchSim / configStandalone.TF.interactionRate;
221 }
222 if (configStandalone.TF.nMerge) {
223 double len = configStandalone.TF.nMerge - 1;
224 if (configStandalone.TF.randomizeDistance) {
225 len += 0.5;
226 }
227 if (configStandalone.TF.shiftFirstEvent) {
228 len += 0.5;
229 }
231 }
232 if (configStandalone.QA.inputHistogramsOnly && configStandalone.QA.compareInputs.size() == 0) {
233 printf("Can only produce QA pdf output when input files are specified!\n");
234 return 1;
235 }
236 if (configStandalone.QA.enableLocalOutput && !configStandalone.QA.inputHistogramsOnly && configStandalone.QA.output == "" && configStandalone.QA.plotsDir != "") {
237 configStandalone.QA.output = configStandalone.QA.plotsDir + "/output.root";
238 }
239 if (configStandalone.QA.inputHistogramsOnly) {
240 configStandalone.rundEdx = false;
241 configStandalone.noEvents = true;
242 }
243 if (configStandalone.QA.dumpToROOTLevel >= 1) {
244 configStandalone.proc.outputSharedClusterMap = true;
245 }
246 if (configStandalone.eventDisplay) {
247 configStandalone.promptOnExit = 0;
248 }
249 if (configStandalone.proc.debugLevel >= 4) {
250 if (configStandalone.proc.inKernelParallel) {
251 configStandalone.proc.inKernelParallel = 1;
252 } else {
253 configStandalone.proc.nHostThreads = 1;
254 }
255 }
256 if (configStandalone.setO2Settings) {
257 if (configStandalone.runGPU && configStandalone.proc.debugLevel <= 1) {
258 if (!(configStandalone.inputcontrolmem && configStandalone.outputcontrolmem)) {
259 printf("setO2Settings requires the usage of --inputMemory and --outputMemory as in O2\n");
260 return 1;
261 }
262 configStandalone.proc.forceHostMemoryPoolSize = 1024 * 1024 * 1024;
263 }
264 configStandalone.rec.tpc.trackReferenceX = 83;
265 configStandalone.proc.outputSharedClusterMap = 1;
266 configStandalone.proc.clearO2OutputFromGPU = 1;
267 configStandalone.QA.clusterRejectionHistograms = 1;
268 configStandalone.proc.tpcIncreasedMinClustersPerRow = 500000;
269 configStandalone.proc.ignoreNonFatalGPUErrors = 1;
270 // TODO: rundEdx=1
271 // GPU_proc.qcRunFraction=$TPC_TRACKING_QC_RUN_FRACTION;"
272 // [[ $CTFINPUT == 1 ]] && GPU_CONFIG_KEY+="GPU_proc.tpcInputWithClusterRejection=1;"
273 // double pipeline / rtc
274 }
275
276 if (configStandalone.outputcontrolmem) {
277 bool forceEmptyMemory = getenv("LD_PRELOAD") && strstr(getenv("LD_PRELOAD"), "valgrind") != nullptr;
278 outputmemory.reset(GPUReconstruction::alignedDefaultBufferAllocator<char>(configStandalone.outputcontrolmem));
279 if (forceEmptyMemory) {
280 printf("Valgrind detected, emptying GPU output memory to avoid false positive undefined reads");
281 memset(outputmemory.get(), 0, configStandalone.outputcontrolmem);
282 }
283 if (configStandalone.proc.doublePipeline) {
284 outputmemoryPipeline.reset(GPUReconstruction::alignedDefaultBufferAllocator<char>(configStandalone.outputcontrolmem));
285 if (forceEmptyMemory) {
286 memset(outputmemoryPipeline.get(), 0, configStandalone.outputcontrolmem);
287 }
288 }
289 }
290 if (configStandalone.inputcontrolmem) {
291 inputmemory.reset(GPUReconstruction::alignedDefaultBufferAllocator<char>(configStandalone.inputcontrolmem));
292 }
293
294 configStandalone.proc.showOutputStat = true;
295
296 if (configStandalone.runGPU && configStandalone.gpuType == "AUTO") {
297 if (GPUReconstruction::CheckInstanceAvailable(GPUReconstruction::DeviceType::CUDA, configStandalone.proc.debugLevel >= 2)) {
298 configStandalone.gpuType = "CUDA";
299 } else if (GPUReconstruction::CheckInstanceAvailable(GPUReconstruction::DeviceType::HIP, configStandalone.proc.debugLevel >= 2)) {
300 configStandalone.gpuType = "HIP";
301 } else if (GPUReconstruction::CheckInstanceAvailable(GPUReconstruction::DeviceType::OCL, configStandalone.proc.debugLevel >= 2)) {
302 configStandalone.gpuType = "OCL";
303 } else if (GPUReconstruction::CheckInstanceAvailable(GPUReconstruction::DeviceType::OCL, configStandalone.proc.debugLevel >= 2)) {
304 configStandalone.gpuType = "OCL";
305 } else {
306 if (configStandalone.runGPU > 1 && configStandalone.runGPUforce) {
307 printf("No GPU backend / device found, running on CPU is disabled due to runGPUforce\n");
308 return 1;
309 }
310 configStandalone.runGPU = false;
311 configStandalone.gpuType = "CPU";
312 }
313 }
314
315 if (configStandalone.printSettings) {
316 configStandalone.proc.printSettings = true;
317 }
318 if (configStandalone.printSettings > 1) {
319 printf("Config Dump after ReadConfiguration\n");
321 }
322
323 return (0);
324}
325
326void CreateTrivialCalibObjects([[maybe_unused]] int64_t timestamp) // Timestamp of the CCDB objects (O2 build), 1: now
327{
329
332 calib.fastTransform = tmpFastTransformBuffer.get();
333 auto tmpTRDGeometry = std::make_unique<o2::trd::GeometryFlat>();
334 calib.trdGeometry = tmpTRDGeometry.get();
335 auto tmpTRDRecoParam = std::make_unique<GPUTRDRecoParam>();
336 calib.trdRecoParam = tmpTRDRecoParam.get();
337 auto tmpdEdxCalibContainer = std::make_unique<o2::tpc::CalibdEdxContainer>();
338 tmpdEdxCalibContainer->setDefaultZeroSupresssionThreshold();
339 tmpdEdxCalibContainer->setDefaultPolTopologyCorrection();
340 calib.dEdxCalibContainer = tmpdEdxCalibContainer.get();
341 auto tmpTPCPadGainCalib = std::make_unique<TPCPadGainCalib>();
342 calib.tpcPadGain = tmpTPCPadGainCalib.get();
343#ifndef GPUCA_STANDALONE
344 auto tmpTPCZSLinkMapping = std::make_unique<TPCZSLinkMapping>(o2::tpc::Mapper::instance());
345 calib.tpcZSLinkMapping = tmpTPCZSLinkMapping.get();
346 auto& ccdb = o2::ccdb::BasicCCDBManager::instance(); // Default CCDB server (NameConf), objects owned by the manager
347 ccdb.setFatalWhenNull(false); // Without CCDB access, write the other objects
348 if (timestamp != 1) {
349 ccdb.setTimestamp(timestamp);
350 }
351 if (auto* matLUT = ccdb.get<o2::base::MatLayerCylSet>("GLO/Param/MatLUT")) {
353 } else {
354 printf("Could not fetch the material LUT from the CCDB, not written\n");
355 }
356#endif
357
359 rec->DumpSettings("./");
360 printf("Wrote trivial calibration objects to current folder\n");
361}
362
364{
365 if (!configStandalone.eventGenerator) {
366 if (configStandalone.noEvents) {
367 eventsDir = "NON_EXISTING";
368 configStandalone.rundEdx = false;
369 } else if (rec->ReadSettings(eventsDir.c_str())) {
370 printf("Error reading event config file\n");
371 return 1;
372 }
373 const char* tmptext = configStandalone.noEvents ? "Using default event settings, no event dir loaded" : "Read event settings from dir ";
374 printf("%s%s (solenoidBz: %f, constBz %d, maxTimeBin %d)\n", tmptext, configStandalone.noEvents ? "" : eventsDir.c_str(), rec->GetGRPSettings().solenoidBzNominalGPU, (int32_t)rec->GetGRPSettings().constBz, rec->GetGRPSettings().grpContinuousMaxTimeBin);
375 if (configStandalone.testSyncAsync) {
377 }
378 if (configStandalone.proc.doublePipeline) {
380 }
381 }
382
385 if (configStandalone.testSyncAsync) {
388 }
389
391 GPUSettingsRec recSet;
392 GPUSettingsProcessing procSet;
393 recSet = configStandalone.rec;
394 procSet = configStandalone.proc;
396
397 if (configStandalone.solenoidBzNominalGPU != -1e6f) {
398 grp.solenoidBzNominalGPU = configStandalone.solenoidBzNominalGPU;
399 }
400 if (configStandalone.constBz) {
401 grp.constBz = true;
402 }
403 if (configStandalone.TF.nMerge || configStandalone.TF.bunchSim) {
404 if (grp.grpContinuousMaxTimeBin) {
405 printf("ERROR: requested to overlay continuous data - not supported\n");
406 return 1;
407 }
408 if (!configStandalone.cont) {
409 printf("Continuous mode forced\n");
410 configStandalone.cont = true;
411 }
414 }
415 }
416 if (configStandalone.setMaxTimeBin != -2) {
417 grp.grpContinuousMaxTimeBin = configStandalone.setMaxTimeBin;
418 } else if (configStandalone.cont && grp.grpContinuousMaxTimeBin == 0) {
420 }
421 if (grp.grpContinuousMaxTimeBin < -1 && !configStandalone.noEvents) {
422 printf("Invalid maxTimeBin %d\n", grp.grpContinuousMaxTimeBin);
423 return 1;
424 }
425 if (rec->GetDeviceType() == GPUReconstruction::DeviceType::CPU) {
426 printf("Standalone Test Framework for CA Tracker - Using CPU\n");
427 } else {
428 printf("Standalone Test Framework for CA Tracker - Using GPU\n");
429 }
430
431 configStandalone.proc.forceMemoryPoolSize = (configStandalone.proc.forceMemoryPoolSize == 1 && configStandalone.eventDisplay) ? 2 : configStandalone.proc.forceMemoryPoolSize;
432 if (configStandalone.eventDisplay) {
433 eventDisplay.reset(GPUDisplayFrontendInterface::getFrontend(configStandalone.display.displayFrontend.c_str()));
434 if (eventDisplay.get() == nullptr) {
435 throw std::runtime_error("Requested display not available");
436 }
437 printf("Enabling event display (%s backend)\n", eventDisplay->frontendName());
438 procSet.eventDisplay = eventDisplay.get();
439 if (!configStandalone.QA.noMC) {
440 procSet.runMC = true;
441 }
442 }
443
444 if (procSet.runQA && !configStandalone.QA.noMC) {
445 procSet.runMC = true;
446 }
447
448 steps.steps = gpudatatypes::RecoStep::AllRecoSteps;
449 if (configStandalone.runTRD != -1) {
450 steps.steps.setBits(gpudatatypes::RecoStep::TRDTracking, configStandalone.runTRD > 0);
451 } else if (chainTracking->GetTRDGeometry() == nullptr) {
452 steps.steps.setBits(gpudatatypes::RecoStep::TRDTracking, false);
453 }
454 if (configStandalone.runCompression != -1) {
455 steps.steps.setBits(gpudatatypes::RecoStep::TPCCompression, configStandalone.runCompression > 0);
456 }
457 if (configStandalone.runTransformation != -1) {
458 steps.steps.setBits(gpudatatypes::RecoStep::TPCConversion, configStandalone.runTransformation > 0);
459 }
460 steps.steps.setBits(gpudatatypes::RecoStep::Refit, configStandalone.runRefit);
461 if (!configStandalone.runMerger) {
462 steps.steps.setBits(gpudatatypes::RecoStep::TPCMerging, false);
463 steps.steps.setBits(gpudatatypes::RecoStep::TRDTracking, false);
464 steps.steps.setBits(gpudatatypes::RecoStep::TPCdEdx, false);
465 steps.steps.setBits(gpudatatypes::RecoStep::TPCCompression, false);
466 steps.steps.setBits(gpudatatypes::RecoStep::Refit, false);
467 }
468
469 if (configStandalone.TF.bunchSim || configStandalone.TF.nMerge) {
470 steps.steps.setBits(gpudatatypes::RecoStep::TRDTracking, false);
471 }
472 steps.inputs.set(gpudatatypes::InOutType::TPCClusters, gpudatatypes::InOutType::TRDTracklets);
473 steps.steps.setBits(gpudatatypes::RecoStep::TPCDecompression, false);
474 steps.inputs.setBits(gpudatatypes::InOutType::TPCCompressedClusters, false);
475 if (grp.doCompClusterDecode) {
476 steps.inputs.setBits(gpudatatypes::InOutType::TPCCompressedClusters, true);
477 steps.inputs.setBits(gpudatatypes::InOutType::TPCClusters, false);
478 steps.steps.setBits(gpudatatypes::RecoStep::TPCCompression, false);
479 steps.steps.setBits(gpudatatypes::RecoStep::TPCClusterFinding, false);
480 steps.steps.setBits(gpudatatypes::RecoStep::TPCDecompression, true);
481 steps.outputs.setBits(gpudatatypes::InOutType::TPCCompressedClusters, false);
482 } else if (grp.needsClusterer) {
483 steps.inputs.setBits(gpudatatypes::InOutType::TPCRaw, true);
484 steps.inputs.setBits(gpudatatypes::InOutType::TPCClusters, false);
485 } else {
486 steps.steps.setBits(gpudatatypes::RecoStep::TPCClusterFinding, false);
487 }
488
489 // Set settings for synchronous
490 GPUChainTracking::ApplySyncSettings(procSet, recSet, steps.steps, configStandalone.testSyncAsync || configStandalone.testSync, configStandalone.rundEdx);
491 int32_t runAsyncQA = procSet.runQA && !configStandalone.testSyncAsyncQcInSync ? procSet.runQA : 0;
492 if (configStandalone.testSyncAsync) {
493 procSet.eventDisplay = nullptr;
494 if (!configStandalone.testSyncAsyncQcInSync) {
495 procSet.runQA = false;
496 }
497 }
498
499 // Apply --recoSteps flag last so it takes precedence
500 // E.g. ApplySyncSettings might enable TPCdEdx, but might not be needed if only clusterizer was requested
501 if (configStandalone.recoSteps >= 0) {
502 steps.steps &= configStandalone.recoSteps;
503 }
504 if (configStandalone.recoStepsGPU >= 0) {
505 steps.stepsGPUMask &= configStandalone.recoStepsGPU;
506 }
507
508 steps.outputs.clear();
509 steps.outputs.setBits(gpudatatypes::InOutType::TPCMergedTracks, steps.steps.isSet(gpudatatypes::RecoStep::TPCMerging));
510 steps.outputs.setBits(gpudatatypes::InOutType::TPCCompressedClusters, steps.steps.isSet(gpudatatypes::RecoStep::TPCCompression));
511 steps.outputs.setBits(gpudatatypes::InOutType::TRDTracks, steps.steps.isSet(gpudatatypes::RecoStep::TRDTracking));
512 steps.outputs.setBits(gpudatatypes::InOutType::TPCClusters, steps.steps.isSet(gpudatatypes::RecoStep::TPCClusterFinding));
513
514 if (steps.steps.isSet(gpudatatypes::RecoStep::TRDTracking)) {
515 if (procSet.createO2Output && !procSet.trdTrackModelO2) {
516 procSet.createO2Output = 1; // Must not be 2, to make sure TPC GPU tracks are still available for TRD
517 }
518 }
519
520 rec->SetSettings(&grp, &recSet, &procSet, &steps);
521 if (configStandalone.proc.doublePipeline) {
522 recPipeline->SetSettings(&grp, &recSet, &procSet, &steps);
523 }
524 if (configStandalone.testSyncAsync) { // TODO: Add --async mode / flag
525 // Set settings for asynchronous
526 steps.steps.setBits(gpudatatypes::RecoStep::TPCDecompression, true);
527 steps.steps.setBits(gpudatatypes::RecoStep::TPCdEdx, true);
528 steps.steps.setBits(gpudatatypes::RecoStep::TPCCompression, false);
529 steps.steps.setBits(gpudatatypes::RecoStep::TPCClusterFinding, false);
530 steps.inputs.setBits(gpudatatypes::InOutType::TPCRaw, false);
531 steps.inputs.setBits(gpudatatypes::InOutType::TPCClusters, false);
532 steps.inputs.setBits(gpudatatypes::InOutType::TPCCompressedClusters, true);
533 steps.outputs.setBits(gpudatatypes::InOutType::TPCCompressedClusters, false);
534 procSet.runMC = false;
535 procSet.runQA = runAsyncQA;
536 procSet.eventDisplay = eventDisplay.get();
537 procSet.runCompressionStatistics = 0;
538 if (recSet.tpc.rejectionStrategy >= GPUSettings::RejectionStrategyB) {
539 procSet.tpcInputWithClusterRejection = 1;
540 }
541 recSet.tpc.disableRefitAttachment = 0xFF;
542 recSet.maxTrackQPtB5 = CAMath::Min(recSet.maxTrackQPtB5, recSet.tpc.rejectQPtB5);
543 GPUChainTracking::ApplySyncSettings(procSet, recSet, steps.steps, false, configStandalone.rundEdx);
544 recAsync->SetSettings(&grp, &recSet, &procSet, &steps);
545 }
546
547 if (configStandalone.outputcontrolmem) {
548 rec->SetOutputControl(outputmemory.get(), configStandalone.outputcontrolmem);
549 if (configStandalone.proc.doublePipeline) {
551 }
552 }
553
554 o2::base::Propagator* prop = nullptr;
556 prop->setGPUField(&rec->GetParam().polynomialField);
557 prop->setNominalBz(rec->GetParam().bzkG);
558 prop->setMatLUT(chainTracking->GetMatLUT());
560 if (chainTrackingAsync) {
562 }
565 }
566 procSet.o2PropagatorUseGPUField = true;
567
568 if (rec->Init()) {
569 printf("Error initializing GPUReconstruction!\n");
570 return 1;
571 }
572 if (configStandalone.outputcontrolmem && rec->IsGPU()) {
573 if (rec->registerMemoryForGPU(outputmemory.get(), configStandalone.outputcontrolmem) || (configStandalone.proc.doublePipeline && recPipeline->registerMemoryForGPU(outputmemoryPipeline.get(), configStandalone.outputcontrolmem))) {
574 printf("ERROR registering memory for the GPU!!!\n");
575 return 1;
576 }
577 }
578 if (configStandalone.inputcontrolmem && rec->IsGPU()) {
579 if (rec->registerMemoryForGPU(inputmemory.get(), configStandalone.inputcontrolmem)) {
580 printf("ERROR registering input memory for the GPU!!!\n");
581 return 1;
582 }
583 }
584 if (configStandalone.proc.debugLevel >= 4) {
586 }
587 return (0);
588}
589
591{
592 if (configStandalone.inputcontrolmem && !configStandalone.preloadEvents) {
593 rec->SetInputControl(inputmemory.get(), configStandalone.inputcontrolmem);
594 }
596 if (r) {
597 return r;
598 }
599#if !defined(GPUCA_RUN2) && defined(GPUCA_BUILD_QA) && defined(GPUCA_STANDALONE)
600 if ((configStandalone.proc.runQA || configStandalone.eventDisplay) && !configStandalone.QA.noMC) {
603 if (chainTracking->GetQA()->ReadO2MCData((eventsDir + "mc." + std::to_string(n) + ".dump").c_str()) &&
604 chainTracking->GetQA()->ReadO2MCData((eventsDir + "mc.0.dump").c_str()) && configStandalone.proc.runQA) {
605 throw std::runtime_error("Error reading O2 MC dump");
606 }
607 }
608#endif
609 return 0;
610}
611
612int32_t LoadEvent(int32_t iEvent, int32_t x)
613{
614 if (configStandalone.TF.bunchSim) {
615 if (tf->LoadCreateTimeFrame(iEvent)) {
616 return 1;
617 }
618 } else if (configStandalone.TF.nMerge) {
619 if (tf->LoadMergedEvents(iEvent)) {
620 return 1;
621 }
622 } else {
623 if (ReadEvent(iEvent)) {
624 return 1;
625 }
626 }
627 bool encodeZS = configStandalone.encodeZS == -1 ? (chainTracking->mIOPtrs.tpcPackedDigits && !chainTracking->mIOPtrs.tpcZS) : (bool)configStandalone.encodeZS;
628 bool zsFilter = configStandalone.zsFilter == -1 ? (!encodeZS && chainTracking->mIOPtrs.tpcPackedDigits && !chainTracking->mIOPtrs.tpcZS) : (bool)configStandalone.zsFilter;
629 if (encodeZS || zsFilter) {
631 printf("Need digit input to run ZS\n");
632 return 1;
633 }
634 if (zsFilter) {
636 }
637 if (encodeZS) {
639 }
640 }
641 if (!configStandalone.runTransformation) {
643 } else {
644 for (int32_t i = 0; i < chainTracking->NSECTORS; i++) {
646 if (configStandalone.proc.debugLevel >= 2) {
647 printf("Converting Legacy Raw Cluster to Native\n");
648 }
650 break;
651 }
652 }
653 }
654
655 if (configStandalone.stripDumpedEvents) {
658 }
659 }
660
662 printf("Need cluster native data for on-the-fly TPC transform\n");
663 return 1;
664 }
665
667 ioMemEvents[x] = std::move(chainTracking->mIOMem);
669 return 0;
670}
671
672void OutputStat(GPUChainTracking* t, size_t* nTracksTotal = nullptr, size_t* nClustersTotal = nullptr)
673{
674 int32_t nTracks = 0;
675 if (t->GetProcessingSettings().createO2Output) {
676 nTracks += t->mIOPtrs.nOutputTracksTPCO2;
677 } else {
678 for (uint32_t k = 0; k < t->mIOPtrs.nMergedTracks; k++) {
679 if (t->mIOPtrs.mergedTracks[k].OK()) {
680 nTracks++;
681 }
682 }
683 }
684 if (nTracksTotal && nClustersTotal) {
685 *nTracksTotal += nTracks;
686 *nClustersTotal += t->mIOPtrs.nMergedTrackHits;
687 }
688}
689
690int32_t RunBenchmark(GPUReconstruction* recUse, GPUChainTracking* chainTrackingUse, int32_t runs, int32_t iEvent, size_t* nTracksTotal, size_t* nClustersTotal, int32_t threadId = 0, HighResTimer* timerPipeline = nullptr)
691{
692 int32_t iRun = 0, iteration = 0;
693 while ((iteration = nIteration.fetch_add(1)) < runs) {
694 if (configStandalone.runs > 1) {
695 printf("Run %d (thread %d)\n", iteration + 1, threadId);
696 }
697 if (configStandalone.runsInit > 0 && configStandalone.proc.debugCSV.empty()) {
698 recUse->SetResetTimers(iRun < configStandalone.runsInit);
699 }
700 if (configStandalone.outputcontrolmem) {
701 recUse->SetOutputControl(threadId ? outputmemoryPipeline.get() : outputmemory.get(), configStandalone.outputcontrolmem);
702 }
703
704 if (configStandalone.testSyncAsync) {
705 printf("Running synchronous phase\n");
706 }
707 const GPUTrackingInOutPointers& ioPtrs = ioPtrEvents[!configStandalone.preloadEvents ? 0 : (configStandalone.proc.doublePipeline ? (iteration % ioPtrEvents.size()) : (iEvent - configStandalone.StartEvent))];
708 chainTrackingUse->mIOPtrs = ioPtrs;
709 if (iteration == (configStandalone.proc.doublePipeline ? 2 : (configStandalone.runs - 1))) {
710 if (configStandalone.proc.doublePipeline && timerPipeline) {
711 timerPipeline->Start();
712 }
713 if (configStandalone.controlProfiler) {
715 }
716 }
717 int32_t tmpRetVal = recUse->RunChains();
718 int32_t iterationEnd = nIterationEnd.fetch_add(1);
719 if (iterationEnd == configStandalone.runs - 1) {
720 if (configStandalone.proc.doublePipeline && timerPipeline) {
721 timerPipeline->Stop();
722 }
723 if (configStandalone.controlProfiler) {
725 }
726 }
727
728 if (tmpRetVal == GPUReconstruction::retValValue::retOk || tmpRetVal == GPUReconstruction::retValValue::retDoExit) {
729 OutputStat(chainTrackingUse, iRun == 0 ? nTracksTotal : nullptr, iRun == 0 ? nClustersTotal : nullptr);
730 }
731
732 if (tmpRetVal == GPUReconstruction::retValValue::retOk && configStandalone.testSyncAsync) {
737 printf("Running asynchronous phase from %'u compressed clusters\n", syncAsyncDecodedClusters);
738
739 chainTrackingAsync->mIOPtrs = ioPtrs;
749 for (int32_t i = 0; i < chainTracking->NSECTORS; i++) {
754 }
756 if (configStandalone.runsInit > 0 && configStandalone.proc.debugCSV.empty()) {
757 recAsync->SetResetTimers(iRun < configStandalone.runsInit);
758 }
759 tmpRetVal = recAsync->RunChains();
760 if (tmpRetVal == GPUReconstruction::retValValue::retOk || tmpRetVal == GPUReconstruction::retValValue::retDoExit) {
761 OutputStat(chainTrackingAsync, nullptr, nullptr);
762 }
764 }
765 if (!configStandalone.proc.doublePipeline) {
766 recUse->ClearAllocatedMemory();
767 }
768
769 if (tmpRetVal == GPUReconstruction::retValValue::retDoExit) {
770 configStandalone.continueOnError = 0; // Forced exit from event display loop
771 configStandalone.promptOnExit = 0;
772 }
773 if (tmpRetVal == GPUReconstruction::retValValue::retNonFatalErrorCode && configStandalone.proc.ignoreNonFatalGPUErrors) {
774 printf("GPU Standalone Benchmark: Non-FATAL GPU error occured, ignoring\n");
775 } else if (tmpRetVal && !configStandalone.continueOnError) {
776 if (tmpRetVal != GPUReconstruction::retValValue::retDoExit) {
777 printf("GPU Standalone Benchmark: Error occured\n");
778 }
779 return 1;
780 }
781 iRun++;
782 }
783 if (configStandalone.proc.doublePipeline) {
784 recUse->ClearAllocatedMemory();
785 }
786 nIteration.store(runs);
787 return 0;
788}
789
790int32_t main(int argc, char** argv)
791{
792 std::unique_ptr<GPUReconstruction> recUnique, recUniqueAsync, recUniquePipeline;
793
794 if (ReadConfiguration(argc, argv)) {
795 return 1;
796 }
797 configStandalone.proc.runsStandalone = true;
798 eventsDir = std::string(configStandalone.absoluteEventsDir ? "" : "events/") + configStandalone.eventsDir + "/";
799
800 GPUSettingsDeviceBackend deviceSet;
801 deviceSet.deviceType = configStandalone.runGPU ? gpudatatypes::GetDeviceType(configStandalone.gpuType.c_str()) : gpudatatypes::DeviceType::CPU;
802 deviceSet.forceDeviceType = configStandalone.runGPUforce;
803 deviceSet.master = nullptr;
804 recUnique.reset(GPUReconstruction::CreateInstance(deviceSet));
805 rec = recUnique.get();
806 deviceSet.master = rec;
807 if (configStandalone.testSyncAsync) {
808 recUniqueAsync.reset(GPUReconstruction::CreateInstance(deviceSet));
809 recAsync = recUniqueAsync.get();
810 }
811 if (configStandalone.proc.doublePipeline) {
812 recUniquePipeline.reset(GPUReconstruction::CreateInstance(deviceSet));
813 recPipeline = recUniquePipeline.get();
814 }
815 if (rec == nullptr || (configStandalone.testSyncAsync && recAsync == nullptr)) {
816 printf("Error initializing GPUReconstruction\n");
817 return 1;
818 }
819 rec->SetDebugLevelTmp(configStandalone.proc.debugLevel);
821 if (configStandalone.testSyncAsync) {
822 if (configStandalone.proc.debugLevel >= 3) {
824 }
826 }
827 if (configStandalone.proc.doublePipeline) {
828 if (configStandalone.proc.debugLevel >= 3) {
830 }
833 }
834 if (!configStandalone.proc.doublePipeline) {
836 if (configStandalone.testSyncAsync) {
838 }
839 }
840
841 if (configStandalone.recreateTrivialCalibObjects) {
842 CreateTrivialCalibObjects(configStandalone.recreateTrivialCalibObjects);
843 return 0;
844 }
845
846 if (SetupReconstruction()) {
847 return 1;
848 }
849
850 std::unique_ptr<std::thread> pipelineThread;
851 if (configStandalone.proc.doublePipeline) {
852 pipelineThread.reset(new std::thread([]() { rec->RunPipelineWorker(); }));
853 }
854
855 if (configStandalone.seed == -1) {
856 std::random_device rd;
857 configStandalone.seed = (int32_t)rd();
858 printf("Using random seed %d\n", configStandalone.seed);
859 }
860
862
864 if (!configStandalone.noEvents) {
865 while (true) {
866 std::ifstream in;
867 in.open((eventsDir + GPUCA_EVDUMP_FILE "." + std::to_string(nEventsInDirectory) + ".dump").c_str(), std::ifstream::binary);
868 if (in.fail()) {
869 break;
870 }
871 in.close();
873 }
874 }
875
876 if (configStandalone.TF.bunchSim || configStandalone.TF.nMerge) {
878 }
879
880 if (configStandalone.eventGenerator) {
882 return 0;
883 }
884
886 if (configStandalone.TF.bunchSim) {
887 nEvents = configStandalone.nEvents > 0 ? configStandalone.nEvents : 1;
888 } else {
889 if (nEvents == -1 || nEvents > nEventsInDirectory) {
890 if (nEvents >= 0) {
891 printf("Only %d events available in directory %s (%d events requested)\n", nEventsInDirectory, eventsDir.c_str(), nEvents);
892 }
894 }
895 if (nEvents == 0 && !configStandalone.noEvents) {
896 printf("No event data found in event folder\n");
897 }
898 if (configStandalone.TF.nMerge > 1) {
899 nEvents /= configStandalone.TF.nMerge;
900 }
901 }
902
903 ioPtrEvents.resize(configStandalone.preloadEvents ? (nEvents - configStandalone.StartEvent) : 1);
904 ioMemEvents.resize(configStandalone.preloadEvents ? (nEvents - configStandalone.StartEvent) : 1);
905 if (configStandalone.preloadEvents) {
906 printf("Preloading events%s", configStandalone.proc.debugLevel >= 2 ? "\n" : "");
907 fflush(stdout);
908 for (int32_t i = 0; i < nEvents - configStandalone.StartEvent; i++) {
909 LoadEvent(configStandalone.StartEvent + i, i);
910 printf(configStandalone.proc.debugLevel >= 2 ? "Loading event %d\n" : " %d", i + configStandalone.StartEvent);
911 fflush(stdout);
912 }
913 printf("\n");
914 }
915
916 for (int32_t iRunOuter = 0; iRunOuter < configStandalone.runs2; iRunOuter++) {
917 if (configStandalone.QA.inputHistogramsOnly) {
919 break;
920 }
921 if (configStandalone.runs2 > 1) {
922 printf("\nRUN2: %d\n", iRunOuter);
923 }
924 size_t nTracksTotal = 0;
925 size_t nClustersTotal = 0;
926 int32_t nEventsProcessed = 0;
927
928 if (configStandalone.noEvents) {
929 nEvents = 1;
930 configStandalone.StartEvent = 0;
932 }
933
934 for (int32_t iEvent = configStandalone.StartEvent; iEvent < nEvents; iEvent++) {
935 if (iEvent != configStandalone.StartEvent) {
936 printf("\n");
937 }
938 if (!configStandalone.noEvents && !configStandalone.preloadEvents) {
939 HighResTimer timerLoad;
940 timerLoad.Start();
941 if (LoadEvent(iEvent, 0)) {
942 goto breakrun;
943 }
944 if (configStandalone.dumpEvents) {
945 char fname[1024];
946 snprintf(fname, 1024, "event.%d.dump", nEventsProcessed);
947 chainTracking->DumpData(fname);
948 if (nEventsProcessed == 0) {
949 rec->DumpSettings();
950 }
951 }
952
955 if (grp.grpContinuousMaxTimeBin == 0) {
956 printf("Cannot override max time bin for non-continuous data!\n");
957 } else {
959 printf("Max time bin set to %d\n", grp.grpContinuousMaxTimeBin);
960 rec->UpdateSettings(&grp);
961 if (recAsync) {
963 }
964 if (recPipeline) {
966 }
967 }
968 }
969 printf("Loading time: %'d us\n", (int32_t)(1000000 * timerLoad.GetCurrentElapsedTime()));
970 }
971
972 nIteration.store(0);
973 nIterationEnd.store(0);
974 double pipelineWalltime = 1.;
975 if (configStandalone.noEvents) {
976 printf("No processing, no events loaded\n");
977 } else if (configStandalone.proc.doublePipeline) {
978 printf(configStandalone.preloadEvents ? "Processing Events %d to %d in Pipeline\n" : "Processing Event %d in Pipeline %d times\n", iEvent, configStandalone.preloadEvents ? std::min(iEvent + configStandalone.runs - 1, nEvents - 1) : configStandalone.runs);
979 HighResTimer timerPipeline;
980 if (configStandalone.proc.debugLevel < 2 && (RunBenchmark(rec, chainTracking, 1, iEvent, &nTracksTotal, &nClustersTotal) || RunBenchmark(recPipeline, chainTrackingPipeline, 2, iEvent, &nTracksTotal, &nClustersTotal))) {
981 goto breakrun;
982 }
983 auto pipeline1 = std::async(std::launch::async, RunBenchmark, rec, chainTracking, configStandalone.runs, iEvent, &nTracksTotal, &nClustersTotal, 0, &timerPipeline);
984 auto pipeline2 = std::async(std::launch::async, RunBenchmark, recPipeline, chainTrackingPipeline, configStandalone.runs, iEvent, &nTracksTotal, &nClustersTotal, 1, &timerPipeline);
985 if (pipeline1.get() || pipeline2.get()) {
986 goto breakrun;
987 }
988 pipelineWalltime = timerPipeline.GetElapsedTime() / (configStandalone.runs - 2);
989 printf("Pipeline wall time: %f, %d iterations, %f per event\n", timerPipeline.GetElapsedTime(), configStandalone.runs - 2, pipelineWalltime);
990 } else {
991 printf("Processing Event %d\n", iEvent);
992 if (RunBenchmark(rec, chainTracking, configStandalone.runs, iEvent, &nTracksTotal, &nClustersTotal)) {
993 goto breakrun;
994 }
995 }
996 nEventsProcessed++;
997
998 if (configStandalone.timeFrameTime) {
999 double nClusters = chainTracking->GetProcessors()->tpcMerger.NMaxClusters();
1000 if (nClusters > 0) {
1001 const int32_t nOrbits = 32;
1002 const double colRate = 50000;
1003 const double orbitRate = 11245;
1004 const double nClsPerTF = 755851. * nOrbits * colRate / orbitRate;
1005 double timePerTF = (configStandalone.proc.doublePipeline ? pipelineWalltime : ((configStandalone.proc.debugLevel ? rec->GetStatKernelTime() : rec->GetStatWallTime()) / 1000000.)) * nClsPerTF / nClusters;
1006 const double nGPUsReq = timePerTF * orbitRate / nOrbits;
1007 char stat[1024];
1008 snprintf(stat, 1024, "Sync phase: %.2f sec per %d orbit TF, %.1f GPUs required", timePerTF, nOrbits, nGPUsReq);
1009 if (configStandalone.testSyncAsync) {
1010 timePerTF = (configStandalone.proc.debugLevel ? recAsync->GetStatKernelTime() : recAsync->GetStatWallTime()) / 1000000. * nClsPerTF / nClusters;
1011 snprintf(stat + strlen(stat), 1024 - strlen(stat), " - Async phase: %f sec per TF", timePerTF);
1012 }
1013 printf("%s (Measured %s time - Extrapolated from %d clusters to %d)\n", stat, configStandalone.proc.debugLevel ? "kernel" : "wall", (int32_t)nClusters, (int32_t)nClsPerTF);
1014 }
1015 }
1018 float rejectionPercentage = (rejected) * 100.f / chainTracking->mIOPtrs.clustersNative->nClustersTotal;
1019 printf("Cluster Rejection: Sync: %'u, Compressed %'u, Async %'u, Rejected %'u (%7.2f%%)\n", chainTracking->mIOPtrs.clustersNative->nClustersTotal, syncAsyncDecodedClusters, chainTrackingAsync->mIOPtrs.clustersNative->nClustersTotal, rejected, rejectionPercentage);
1020 }
1021
1022 if (configStandalone.preloadEvents && configStandalone.proc.doublePipeline) {
1023 break;
1024 }
1025 }
1026 if (nEventsProcessed > 1) {
1027 printf("Total: %zu clusters, %zu tracks\n", nClustersTotal, nTracksTotal);
1028 }
1029 }
1030
1031breakrun:
1032 if (rec->GetProcessingSettings().memoryAllocationStrategy == GPUMemoryResource::ALLOCATION_GLOBAL) {
1034 }
1035
1036#ifndef _WIN32
1037 if (configStandalone.proc.runQA && configStandalone.fpe) {
1038#ifdef __linux__
1039 fedisableexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
1040#endif
1041 }
1042#endif
1043
1044 if (configStandalone.proc.doublePipeline) {
1046 pipelineThread->join();
1047 }
1048
1049 rec->Finalize();
1050 if (configStandalone.testSyncAsync) {
1051 recAsync->Finalize();
1052 }
1053 if (configStandalone.outputcontrolmem && rec->IsGPU()) {
1055 printf("Error unregistering memory\n");
1056 }
1057 }
1058 rec->Exit();
1059
1060 if (configStandalone.promptOnExit) {
1061 printf("Press a key to exit!\n");
1062 getchar();
1063 }
1064 return (0);
1065}
Definition of container class for dE/dx corrections.
Container to store compressed TPC cluster data.
#define srand(x)
int32_t i
#define GPUCA_EVDUMP_FILE
Definition GPUDef.h:47
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 runs
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
Declarations for the wrapper for the set of cylindrical material layers.
class to create TPC fast transformation
POD correction map.
int nClusters
void Start()
Definition timer.cxx:64
double GetCurrentElapsedTime(bool reset=false)
Definition timer.cxx:117
void set(S v)
Definition bitfield.h:55
void clear()
Definition bitfield.h:54
S get() const
Definition bitfield.h:63
bitfield & setBits(const bitfield v, bool w)
Definition bitfield.h:45
bool isSet(const bitfield &v) const
Definition bitfield.h:66
static MatLayerCylSet * rectifyPtrFromFile(MatLayerCylSet *ptr)
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
Definition Propagator.h:180
static BasicCCDBManager & instance()
static void ApplySyncSettings(GPUSettingsProcessing &proc, GPUSettingsRec &rec, gpudatatypes::RecoStepField &steps, bool syncMode, int32_t dEdxMode=-2)
void SetQAFromForeignChain(GPUChainTracking *chain)
void SetCalibObjects(const GPUCalibObjectsConst &obj)
void SetO2Propagator(const o2::base::Propagator *prop)
const GPUTRDGeometry * GetTRDGeometry() const
const TPCFastTransformPOD * GetTPCTransform() const
const o2::base::MatLayerCylSet * GetMatLUT() const
const GPUSettingsDisplay * mConfigDisplay
void DumpData(const char *filename, const GPUTrackingInOutPointers *ioPtrs=nullptr)
const GPUQA * GetQA() const
GPUTrackingInOutPointers & mIOPtrs
struct o2::gpu::GPUChainTracking::InOutMemory mIOMem
int32_t ReadData(const char *filename)
const GPUSettingsQA * mConfigQA
static constexpr int32_t NSECTORS
Definition GPUChain.h:58
const GPUConstantMem * GetProcessors() const
Definition GPUChain.h:68
static GPUDisplayFrontendInterface * getFrontend(const char *type)
int32_t ReadO2MCData(const char *filename)
Definition GPUQA.h:55
void UpdateChain(GPUChainTracking *chain)
Definition GPUQA.h:59
static int32_t GetMaxTimeBin(const o2::tpc::ClusterNativeAccess &native)
static DeviceType GetDeviceType(const char *type)
void SetInputControl(void *ptr, size_t size)
static bool CheckInstanceAvailable(DeviceType type, bool verbose)
void SetSettings(float solenoidBzNominalGPU, const GPURecoStepConfiguration *workflow=nullptr)
static GPUReconstruction * CreateInstance(const GPUSettingsDeviceBackend &cfg)
void UpdateSettings(const GPUSettingsGRP *g, const GPUSettingsProcessing *p=nullptr, const GPUSettingsRecDynamic *d=nullptr)
virtual int32_t RunChains()=0
const GPUParam & GetParam() const
void ClearAllocatedMemory(bool clearOutputs=true)
const GPUSettingsProcessing & GetProcessingSettings() const
void DumpSettings(const char *dir="")
int32_t unregisterMemoryForGPU(const void *ptr)
int32_t registerMemoryForGPU(const void *ptr, size_t size)
const GPUSettingsGRP & GetGRPSettings() const
void SetDebugLevelTmp(int32_t level)
int32_t ReadSettings(const char *dir="")
void SetOutputControl(const GPUOutputControl &v)
static TPCFastTransformPOD * create(aligned_unique_buffer_ptr< TPCFastTransformPOD > &destVector, const TPCFastTransform &src)
Create POD transform from old flat-buffer one. Provided vector will serve as a buffer.
static void RunEventGenerator(GPUChainTracking *rec, const std::string &dir)
Definition genEvents.h:35
static Mapper & instance(const std::string mappingDir="")
Definition Mapper.h:44
static TPCFastTransformHelperO2 * instance()
Singleton.
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
GLboolean r
Definition glcorearb.h:1233
GLenum GLenum GLsizei len
Definition glcorearb.h:4232
GLenum GLfloat param
Definition glcorearb.h:271
GLint GLuint mask
Definition glcorearb.h:291
DeviceType GetDeviceType(const char *type)
GPUSettingsStandalone configStandalone
Definition genEvents.cxx:49
void qConfigPrint()
Definition qconfig.cxx:430
int32_t qConfigParse(int argc, const char **argv, const char *)
Definition qconfig.cxx:410
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
std::unique_ptr< GPUReconstructionTimeframe > tf
std::unique_ptr< char, GPUReconstruction::alignedDefaultBufferDeleter > outputmemoryPipeline(nullptr, GPUReconstruction::alignedDefaultBufferDeleter())
std::unique_ptr< char, GPUReconstruction::alignedDefaultBufferDeleter > inputmemory(nullptr, GPUReconstruction::alignedDefaultBufferDeleter())
int32_t SetupReconstruction()
std::atomic< uint32_t > nIteration
GPUReconstruction * recPipeline
int32_t nEventsInDirectory
uint32_t syncAsyncDecodedClusters
int32_t ReadConfiguration(int argc, char **argv)
std::unique_ptr< char, GPUReconstruction::alignedDefaultBufferDeleter > outputmemory(nullptr, GPUReconstruction::alignedDefaultBufferDeleter())
int32_t LoadEvent(int32_t iEvent, int32_t x)
int32_t RunBenchmark(GPUReconstruction *recUse, GPUChainTracking *chainTrackingUse, int32_t runs, int32_t iEvent, size_t *nTracksTotal, size_t *nClustersTotal, int32_t threadId=0, HighResTimer *timerPipeline=nullptr)
std::vector< GPUTrackingInOutPointers > ioPtrEvents
GPUChainITS * chainITSPipeline
int32_t ReadEvent(int32_t n)
std::vector< GPUChainTracking::InOutMemory > ioMemEvents
std::unique_ptr< GPUDisplayFrontendInterface > eventDisplay
void OutputStat(GPUChainTracking *t, size_t *nTracksTotal=nullptr, size_t *nClustersTotal=nullptr)
GPUReconstruction * rec
GPUChainITS * chainITS
void CreateTrivialCalibObjects(int64_t timestamp)
GPUChainTracking * chainTrackingAsync
GPUChainITS * chainITSAsync
GPUChainTracking * chainTrackingPipeline
GPUReconstruction * recAsync
std::atomic< uint32_t > nIterationEnd
std::string eventsDir
GPUChainTracking * chainTracking
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::MatLayerCylSet >::type * matLUT
gpudatatypes::RecoStepField steps
gpudatatypes::InOutTypeField inputs
gpudatatypes::RecoStepField stepsGPUMask
gpudatatypes::InOutTypeField outputs
const o2::tpc::ClusterNativeAccess * clustersNative
const o2::tpc::CompressedClustersFlat * tpcCompressedClusters
const AliHLTTPCClusterMCLabel * mcLabelsTPC
const GPUTrackingInOutZS * tpcZS
const AliHLTTPCRawCluster * rawClusters[NSECTORS]
const GPUTPCClusterData * clusterData[NSECTORS]
const GPUTrackingInOutDigits * tpcPackedDigits
const GPUTPCMCInfoCol * mcInfosTPCCol
GPUTPCGMPolynomialField polynomialField
Definition GPUParam.h:58
const int nEvents
Definition test_Fifo.cxx:27
#define main
std::random_device rd
typename std::vector< T, vecpod_allocator< T > > vecpod
Definition vecpod.h:31