18#include "GPUChainTrackingGetters.inc"
24#include "GPUParam.inc"
41 std::unique_ptr<GPUReconstruction>
mRec;
61 mNContexts = mConfig->configProcessing.doublePipeline ? 2 : 1;
64 mConfig->configGRP.needsClusterer = 1;
67 mConfig->configGRP.doCompClusterDecode = 1;
71 mConfig->configDeviceBackend.master = mCtx[0].mRec.get();
74 mConfig->configDeviceBackend.master =
nullptr;
75 if (mCtx[
i].mRec ==
nullptr) {
76 GPUError(
"Error obtaining instance of GPUReconstruction");
83 mCtx[
i].mChain = mCtx[
i].mRec->AddChain<
GPUChainTracking>(mConfig->configInterface.maxTPCHits, mConfig->configInterface.maxTRDTracklets);
85 mCtx[
i].mChain->SetQAFromForeignChain(mCtx[0].mChain);
87 mCtx[
i].mChain->mConfigDisplay = &mConfig->configDisplay;
88 mCtx[
i].mChain->mConfigQA = &mConfig->configQA;
89 mCtx[
i].mRec->SetSettings(&mConfig->configGRP, &mConfig->configReconstruction, &mConfig->configProcessing, &mConfig->configWorkflow);
90 mCtx[
i].mChain->SetCalibObjects(mConfig->configCalib);
97 if (mConfig->configInterface.outputToExternalBuffers) {
98 for (
uint32_t j = 0;
j < mCtx[
i].mOutputRegions->count();
j++) {
99 mCtx[
i].mChain->SetSubOutputControl(
j, &mCtx[
i].mOutputRegions->asArray()[
j]);
102 dummy.
set([](
size_t size) ->
void* {
throw std::runtime_error(
"invalid output memory request, no common output buffer set");
return nullptr; });
103 mCtx[
i].mRec->SetOutputControl(dummy);
107 if (
i == 0 && mCtx[
i].mRec->Init()) {
113 mCtx[
i].mRec->MemoryScalers()->scalingFactor *= 2;
116 if (mConfig->configProcessing.doublePipeline) {
117 mInternals->pipelineThread.reset(
new std::thread([
this]() { mCtx[0].mRec->RunPipelineWorker(); }));
125 if (mConfig->configProcessing.doublePipeline) {
126 mCtx[0].mRec->TerminatePipelineWorker();
127 mInternals->pipelineThread->join();
130 mCtx[
i].mRec->Finalize();
132 mCtx[0].mRec->Exit();
133 for (
int32_t i = mNContexts - 1;
i >= 0;
i--) {
134 mCtx[
i].mRec.reset();
142 mCtx[0].mRec->DrainPipeline();
147 const auto oldPtrs = mCtx[iThread].mChain->mIOPtrs;
148 mCtx[iThread].mChain->mIOPtrs = *
data;
150 snprintf(fname, 1024,
"%sevent.%d.dump", dir, nEvent);
151 mCtx[iThread].mChain->DumpData(fname);
154 if (mConfig->configProcessing.runMC) {
155 mCtx[iThread].mChain->ForceInitQA();
156 snprintf(fname, 1024,
"mc.%d.dump", nEvent);
157 mCtx[iThread].mChain->GetQA()->UpdateChain(mCtx[iThread].mChain);
158 mCtx[iThread].mChain->GetQA()->DumpO2MCData(fname);
162 mCtx[iThread].mChain->mIOPtrs = oldPtrs;
167 mCtx[iThread].mChain->DoQueuedUpdates(-1);
168 mCtx[iThread].mRec->DumpSettings(dir);
173 if (mNContexts <= iThread) {
177 mCtx[iThread].mChain->mIOPtrs = *
data;
180 if (mConfig->configInterface.outputToExternalBuffers) {
181 for (
uint32_t i = 0;
i < mCtx[iThread].mOutputRegions->count();
i++) {
187 mCtx[iThread].mOutputRegions->asArray()[
i].reset();
193 auto inputWaitCallback = [
this, iThread, inputUpdateCallback, &
data, &outputs, &setOutputs]() ->
int32_t {
197 if (inputUpdateCallback->
callback) {
198 retVal = inputUpdateCallback->
callback(updatedData, updatedOutputs);
200 mCtx[iThread].mChain->mIOPtrs = *updatedData;
201 outputs = updatedOutputs;
212 if (inputUpdateCallback) {
213 mCtx[iThread].mChain->SetFinalInputCallback(inputWaitCallback);
215 mCtx[iThread].mChain->SetFinalInputCallback(
nullptr);
217 if (!inputUpdateCallback || !inputUpdateCallback->
callback) {
225 if (mConfig->configQA.shipToQC && mCtx[iThread].mChain->QARanForTF()) {
226 outputs->
qa.
hist1 = &mCtx[iThread].mChain->GetQA()->getHistograms1D();
227 outputs->
qa.
hist2 = &mCtx[iThread].mChain->GetQA()->getHistograms2D();
228 outputs->
qa.
hist3 = &mCtx[iThread].mChain->GetQA()->getHistograms1Dd();
229 outputs->
qa.
hist4 = &mCtx[iThread].mChain->GetQA()->getGraphs();
232 *
data = mCtx[iThread].mChain->mIOPtrs;
237void GPUO2Interface::Clear(
bool clearOutputs, uint32_t iThread) { mCtx[iThread].mRec->ClearAllocatedMemory(clearOutputs); }
241 return mCtx[0].mRec->registerMemoryForGPU(
ptr,
size);
246 return mCtx[0].mRec->unregisterMemoryForGPU(
ptr);
252 mCtx[
i].mChain->SetUpdateCalibObjects(newCalib, newVals);
260 mCtx[
i].mRec->setErrorCodeOutput(
v);
273 return mCtx[iThread].mChain->GetDeviceO2Propagator();
278 prop->setGPUField(&mCtx[0].mRec->GetParam().polynomialField);
Class of a TPC cluster in TPC-native coordinates (row, time)
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone proc
o2::its::TimeFrame< 7 > * GetITSTimeframe()
o2::its::TrackerTraits< 7 > * GetITSTrackerTraits()
o2::its::VertexerTraits< 7 > * GetITSVertexerTraits()
static void ApplySyncSettings(GPUSettingsProcessing &proc, GPUSettingsRec &rec, gpudatatypes::RecoStepField &steps, bool syncMode, int32_t dEdxMode=-2)
int32_t unregisterMemoryForGPU(const void *ptr)
const o2::base::Propagator * GetDeviceO2Propagator(int32_t iThread=0) const
int32_t Initialize(const GPUO2InterfaceConfiguration &config)
void GetITSTraits(o2::its::TrackerTraits< 7 > *&trackerTraits, o2::its::VertexerTraits< 7 > *&vertexerTraits, o2::its::TimeFrame< 7 > *&timeFrame)
void DumpSettings(uint32_t iThread, const char *dir="")
void setErrorCodeOutput(std::vector< std::array< uint32_t, 4 > > *v)
void UseGPUPolynomialFieldInPropagator(o2::base::Propagator *prop) const
static void ApplySyncSettings(GPUSettingsProcessing &proc, GPUSettingsRec &rec, gpudatatypes::RecoStepField &steps, bool syncMode, int32_t dEdxMode=-2)
void DumpEvent(int32_t nEvent, GPUTrackingInOutPointers *data, uint32_t iThread, const char *dir="")
int32_t RunTracking(GPUTrackingInOutPointers *data, GPUInterfaceOutputs *outputs=nullptr, uint32_t iThread=0, GPUInterfaceInputUpdate *inputUpdateCallback=nullptr)
int32_t registerMemoryForGPU(const void *ptr, size_t size)
void Clear(bool clearOutputs, uint32_t iThread=0)
int32_t UpdateCalibration(const GPUCalibObjectsConst &newCalib, const GPUNewCalibValues &newVals, uint32_t iThread=0)
static GPUReconstruction * CreateInstance(const GPUSettingsDeviceBackend &cfg)
const std::vector< TH1F > * hist1
const std::vector< TGraphAsymmErrors > * hist4
const std::vector< TH1D > * hist3
const std::vector< TH2F > * hist2
std::unique_ptr< std::thread > pipelineThread
std::unique_ptr< GPUReconstruction > mRec
std::unique_ptr< GPUTrackingOutputs > mOutputRegions
GPUChainTracking * mChain
void set(void *p, size_t s)
std::function< void *(size_t)> allocator
GPUOutputControl * asArray()