Project
Loading...
Searching...
No Matches
GPUWorkflowSpec.h
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
16
17#ifndef O2_GPU_WORKFLOW_SPEC_H
18#define O2_GPU_WORKFLOW_SPEC_H
19
21#include "Framework/Task.h"
26#include <string>
27#include <array>
28#include <vector>
29#include <mutex>
30#include <functional>
31#include <queue>
32
33class TStopwatch;
34namespace fair::mq
35{
36struct RegionInfo;
37enum class State : int32_t;
38} // namespace fair::mq
39namespace o2
40{
41namespace base
42{
43struct GRPGeomRequest;
44} // namespace base
45namespace tpc
46{
47class CalibdEdxContainer;
48struct ClusterGroupHeader;
49class VDriftHelper;
50class CorrectionMapsLoader;
51class DeadChannelMapCreator;
52} // namespace tpc
53
54namespace trd
55{
56class GeometryFlat;
57} // namespace trd
58
59namespace its
60{
61template <int>
62class TimeFrame;
63class ITSTrackingInterface;
64} // namespace its
65
66namespace itsmft
67{
68class TopologyDictionary;
69} // namespace itsmft
70
71namespace dataformats
72{
74} // namespace dataformats
75
76namespace gpu
77{
78struct GPUO2InterfaceConfiguration;
79class GPUDisplayFrontendInterface;
80class CorrectionMapsHelper;
81class TPCFastTransformPOD;
82struct GPUSettingsTF;
83class GPUO2Interface;
84struct TPCPadGainCalib;
85struct TPCZSLinkMapping;
86struct GPUSettingsO2;
87struct GPUSettingsProcessingNNclusterizer;
88class GPUTRDRecoParam;
89class GPUO2InterfaceQA;
90struct GPUTrackingInOutPointers;
91struct GPUTrackingInOutZS;
92struct GPUInterfaceOutputs;
93struct GPUInterfaceInputUpdate;
94namespace gpurecoworkflow_internals
95{
99} // namespace gpurecoworkflow_internals
100
102{
103 public:
104 using CompletionPolicyData = std::vector<framework::InputSpec>;
105
106 struct Config {
108 bool enableCTPLumi = false;
111 bool tpcUseMCTimeGain = false; // use time gain calibration for MC (true) or from data (false)
112 bool decompressTPC = false;
114 bool caClusterer = false;
115 bool zsDecoder = false;
116 bool zsOnTheFly = false;
117 bool outputTracks = false;
120 bool outputCAClusters = false;
121 bool outputQA = false;
123 bool processMC = false;
125 bool askDISTSTF = true;
126 bool runTPCTracking = false;
127 bool runTRDTracking = false;
128 bool readTRDtracklets = false;
129 bool outputErrorQA = false;
130 bool runITSTracking = false;
131 bool itsStaggered = false;
132 bool itsOverrBeamEst = false;
133 bool tpcTriggerHandling = false;
134 bool isITS3 = false;
136
137 // NN clusterizer
138 bool nnLoadFromCCDB = false;
139 bool nnDumpToFile = false;
140 std::vector<std::string> nnEvalMode;
141 };
142
143 GPURecoWorkflowSpec(CompletionPolicyData* policyData, Config const& specconfig, std::vector<int32_t> const& tpcsectors, uint64_t tpcSectorMask, std::shared_ptr<o2::base::GRPGeomRequest>& ggr, std::function<bool(o2::framework::DataProcessingHeader::StartTime)>** gPolicyOrder = nullptr);
145 void init(o2::framework::InitContext& ic) final;
148 void stop() final;
149 void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final;
153
154 void deinitialize();
155
156 private:
157 struct calibObjectStruct {
158 std::vector<char> mUpdatedTransformBuffer;
159 std::unique_ptr<TPCPadGainCalib> mTPCPadGainCalib;
160 std::unique_ptr<o2::tpc::CalibdEdxContainer> mdEdxCalibContainer;
161 float mInstLumiCTP{-1};
163 };
164
165 void storeConfigs(o2::framework::ProcessingContext& pc);
166
168 void initFunctionTPCCalib(o2::framework::InitContext& ic);
169 void initFunctionITS(o2::framework::InitContext& ic);
171 void finaliseCCDBTPC(o2::framework::ConcreteDataMatcher& matcher, void* obj);
172 void finaliseCCDBITS(o2::framework::ConcreteDataMatcher& matcher, void* obj);
174 template <class T>
175 bool fetchCalibsCCDBTPC(o2::framework::ProcessingContext& pc, T& newCalibObjects, calibObjectStruct& oldCalibObjects);
176 bool fetchCalibsCCDBITS(o2::framework::ProcessingContext& pc);
178 void cleanOldCalibsTPCPtrs(calibObjectStruct& oldCalibObjects);
179
180 void doCalibUpdates(o2::framework::ProcessingContext& pc, calibObjectStruct& oldCalibObjects);
181
182 void doTrackTuneTPC(GPUTrackingInOutPointers& ptrs, char* buffout);
183
184 template <class D, class E, class F, class G, class H, class I, class J, class K>
185 void processInputs(o2::framework::ProcessingContext&, D&, E&, F&, G&, bool&, H&, I&, J&, K&);
186
187 int32_t runMain(o2::framework::ProcessingContext* pc, GPUTrackingInOutPointers* ptrs, GPUInterfaceOutputs* outputRegions, int32_t threadIndex = 0, GPUInterfaceInputUpdate* inputUpdateCallback = nullptr);
188 int32_t runITSTracking(o2::framework::ProcessingContext& pc);
189
190 int32_t handlePipeline(o2::framework::ProcessingContext& pc, GPUTrackingInOutPointers& ptrs, gpurecoworkflow_internals::GPURecoWorkflowSpec_TPCZSBuffers& tpcZSmeta, o2::gpu::GPUTrackingInOutZS& tpcZS, std::unique_ptr<gpurecoworkflow_internals::GPURecoWorkflow_QueueObject>& context);
191 void RunReceiveThread();
192 void RunWorkerThread(int32_t id);
193 void ExitPipeline();
194 void handlePipelineEndOfStream(o2::framework::EndOfStreamContext& ec);
195 void handlePipelineStop();
196 void initPipeline(o2::framework::InitContext& ic);
197 void enqueuePipelinedJob(GPUTrackingInOutPointers* ptrs, GPUInterfaceOutputs* outputRegions, gpurecoworkflow_internals::GPURecoWorkflow_QueueObject* context, bool inputFinal);
198 void finalizeInputPipelinedJob(GPUTrackingInOutPointers* ptrs, GPUInterfaceOutputs* outputRegions, gpurecoworkflow_internals::GPURecoWorkflow_QueueObject* context);
199 void receiveFMQStateCallback(fair::mq::State);
200
201 CompletionPolicyData* mPolicyData;
202 std::function<bool(o2::framework::DataProcessingHeader::StartTime)> mPolicyOrder;
203 std::unique_ptr<GPUO2Interface> mGPUReco;
204 std::unique_ptr<GPUDisplayFrontendInterface> mDisplayFrontend;
205
206 calibObjectStruct mCalibObjects;
207 std::unique_ptr<o2::tpc::DeadChannelMapCreator> mTPCDeadChannelMapCreator;
208 std::unique_ptr<o2::tpc::CalibdEdxContainer> mdEdxCalibContainerBufferNew;
209 std::unique_ptr<TPCPadGainCalib> mTPCPadGainCalibBufferNew;
210 std::queue<calibObjectStruct> mOldCalibObjects;
211 std::unique_ptr<TPCZSLinkMapping> mTPCZSLinkMapping;
212 std::unique_ptr<o2::tpc::VDriftHelper> mTPCVDriftHelper;
213 std::unique_ptr<o2::trd::GeometryFlat> mTRDGeometry;
214 std::unique_ptr<GPUTRDRecoParam> mTRDRecoParam;
215 std::unique_ptr<GPUO2InterfaceConfiguration> mConfig;
216 std::unique_ptr<GPUSettingsO2> mConfParam;
217 std::unique_ptr<TStopwatch> mTimer;
218 std::vector<std::array<uint32_t, 4>> mErrorQA;
219 int32_t mQATaskMask = 0;
220 std::unique_ptr<GPUO2InterfaceQA> mQA;
221 std::vector<int32_t> mClusterOutputIds;
222 std::vector<int32_t> mTPCSectors;
223 std::unique_ptr<o2::its::ITSTrackingInterface> mITSTrackingInterface;
224 std::unique_ptr<gpurecoworkflow_internals::GPURecoWorkflowSpec_PipelineInternals> mPipeline;
225 o2::its::TimeFrame<7>* mITSTimeFrame = nullptr;
226 std::vector<fair::mq::RegionInfo> mRegionInfos;
227 const o2::itsmft::TopologyDictionary* mITSDict = nullptr;
228 const o2::dataformats::MeanVertexObject* mMeanVertex;
229 uint64_t mTPCSectorMask = 0;
230 int64_t mCreationForCalib = -1;
231 int32_t mVerbosity = 0;
232 uint32_t mNTFs = 0;
233 uint32_t mNTFDumps = 0;
234 uint32_t mNDebugDumps = 0;
235 uint32_t mNextThreadIndex = 0;
236 bool mUpdateGainMapCCDB = true;
237 std::unique_ptr<o2::gpu::GPUSettingsTF> mTFSettings;
238 std::map<std::string, std::string> nnCCDBSettings;
239
240 Config mSpecConfig;
241 std::shared_ptr<o2::base::GRPGeomRequest> mGGR;
242 bool mGRPGeomUpdated = false;
243 bool mAutoContinuousMaxTimeBin = false;
244 bool mAutoSolenoidBz = false;
245 bool mMatLUTCreated = false;
246 bool mITSGeometryCreated = false;
247 bool mTRDGeometryCreated = false;
248 bool mTRDRecoParamCreated = false;
249 bool mPropagatorInstanceCreated = false;
250 int32_t mTPCCutAtTimeBin = -1;
251};
252
253} // end namespace gpu
254} // end namespace o2
255
256#endif // O2_GPU_WORKFLOW_SPEC_H
unsigned int uint32_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
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 trd
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
std::vector< InputSpec > CompletionPolicyData
o2::framework::Outputs outputs()
std::vector< framework::InputSpec > CompletionPolicyData
void init(o2::framework::InitContext &ic) final
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
o2::framework::Inputs inputs()
void run(o2::framework::ProcessingContext &pc) final
void stop() final
This is invoked on stop.
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
o2::framework::Options options()
o2::dataformats::MeanVertexObject MeanVertexObject
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< std::string > nnEvalMode