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"
25#include "Algorithm/Parser.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{
61class TimeFrame;
62class ITSTrackingInterface;
63} // namespace its
64
65namespace itsmft
66{
67class TopologyDictionary;
68} // namespace itsmft
69
70namespace dataformats
71{
73} // namespace dataformats
74
75namespace gpu
76{
77struct GPUO2InterfaceConfiguration;
78class GPUDisplayFrontendInterface;
79class CorrectionMapsHelper;
80class TPCFastTransform;
81struct GPUSettingsTF;
82class GPUO2Interface;
83struct TPCPadGainCalib;
84struct TPCZSLinkMapping;
85struct GPUSettingsO2;
86struct GPUSettingsProcessingNNclusterizer;
87class GPUO2InterfaceQA;
88struct GPUTrackingInOutPointers;
89struct GPUTrackingInOutZS;
90struct GPUInterfaceOutputs;
91struct GPUInterfaceInputUpdate;
92namespace gpurecoworkflow_internals
93{
97} // namespace gpurecoworkflow_internals
98
100{
101 public:
102 using CompletionPolicyData = std::vector<framework::InputSpec>;
103
104 struct Config {
105 int32_t itsTriggerType = 0;
106 int32_t lumiScaleMode = 0;
107 bool enableMShape = false;
108 bool enableCTPLumi = false;
110 int32_t tpcDeadMapSources = -1;
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;
118 bool outputCompClusters = 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 int32_t lumiScaleType = 0; // 0=off, 1=CTP, 2=TPC scalers
130 bool outputErrorQA = false;
131 bool runITSTracking = false;
132 bool itsOverrBeamEst = false;
133 bool tpcTriggerHandling = false;
134 bool isITS3 = false;
135 };
136
137 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);
139 void init(o2::framework::InitContext& ic) final;
142 void stop() final;
143 void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final;
147
148 void deinitialize();
149
150 private:
151 struct calibObjectStruct {
152 std::unique_ptr<TPCFastTransform> mFastTransform;
153 std::unique_ptr<TPCFastTransform> mFastTransformRef;
154 std::unique_ptr<TPCFastTransform> mFastTransformMShape;
155 std::unique_ptr<o2::tpc::CorrectionMapsLoader> mFastTransformHelper;
156 std::unique_ptr<TPCPadGainCalib> mTPCPadGainCalib;
157 std::unique_ptr<o2::tpc::CalibdEdxContainer> mdEdxCalibContainer;
158 };
159
161 void initFunctionTPCCalib(o2::framework::InitContext& ic);
162 void initFunctionITS(o2::framework::InitContext& ic);
164 void finaliseCCDBTPC(o2::framework::ConcreteDataMatcher& matcher, void* obj);
165 void finaliseCCDBITS(o2::framework::ConcreteDataMatcher& matcher, void* obj);
167 template <class T>
168 bool fetchCalibsCCDBTPC(o2::framework::ProcessingContext& pc, T& newCalibObjects, calibObjectStruct& oldCalibObjects);
169 bool fetchCalibsCCDBITS(o2::framework::ProcessingContext& pc);
171 void cleanOldCalibsTPCPtrs(calibObjectStruct& oldCalibObjects);
172
173 void doCalibUpdates(o2::framework::ProcessingContext& pc, calibObjectStruct& oldCalibObjects);
174
175 void doTrackTuneTPC(GPUTrackingInOutPointers& ptrs, char* buffout);
176
177 template <class D, class E, class F, class G, class H, class I, class J, class K>
178 void processInputs(o2::framework::ProcessingContext&, D&, E&, F&, G&, bool&, H&, I&, J&, K&);
179
180 int32_t runMain(o2::framework::ProcessingContext* pc, GPUTrackingInOutPointers* ptrs, GPUInterfaceOutputs* outputRegions, int32_t threadIndex = 0, GPUInterfaceInputUpdate* inputUpdateCallback = nullptr);
181 int32_t runITSTracking(o2::framework::ProcessingContext& pc);
182
183 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);
184 void RunReceiveThread();
185 void RunWorkerThread(int32_t id);
186 void ExitPipeline();
187 void handlePipelineEndOfStream(o2::framework::EndOfStreamContext& ec);
188 void handlePipelineStop();
189 void initPipeline(o2::framework::InitContext& ic);
190 void enqueuePipelinedJob(GPUTrackingInOutPointers* ptrs, GPUInterfaceOutputs* outputRegions, gpurecoworkflow_internals::GPURecoWorkflow_QueueObject* context, bool inputFinal);
191 void finalizeInputPipelinedJob(GPUTrackingInOutPointers* ptrs, GPUInterfaceOutputs* outputRegions, gpurecoworkflow_internals::GPURecoWorkflow_QueueObject* context);
192 void receiveFMQStateCallback(fair::mq::State);
193
194 CompletionPolicyData* mPolicyData;
195 std::function<bool(o2::framework::DataProcessingHeader::StartTime)> mPolicyOrder;
196 std::unique_ptr<GPUO2Interface> mGPUReco;
197 std::unique_ptr<GPUDisplayFrontendInterface> mDisplayFrontend;
198
199 calibObjectStruct mCalibObjects;
200 std::unique_ptr<o2::tpc::DeadChannelMapCreator> mTPCDeadChannelMapCreator;
201 std::unique_ptr<o2::tpc::CalibdEdxContainer> mdEdxCalibContainerBufferNew;
202 std::unique_ptr<TPCPadGainCalib> mTPCPadGainCalibBufferNew;
203 std::queue<calibObjectStruct> mOldCalibObjects;
204 std::unique_ptr<TPCZSLinkMapping> mTPCZSLinkMapping;
205 std::unique_ptr<o2::tpc::VDriftHelper> mTPCVDriftHelper;
206 std::unique_ptr<o2::trd::GeometryFlat> mTRDGeometry;
207 std::unique_ptr<GPUO2InterfaceConfiguration> mConfig;
208 std::unique_ptr<GPUSettingsO2> mConfParam;
209 std::unique_ptr<TStopwatch> mTimer;
210 std::vector<std::array<uint32_t, 4>> mErrorQA;
211 int32_t mQATaskMask = 0;
212 std::unique_ptr<GPUO2InterfaceQA> mQA;
213 std::vector<int32_t> mClusterOutputIds;
214 std::vector<int32_t> mTPCSectors;
215 std::unique_ptr<o2::its::ITSTrackingInterface> mITSTrackingInterface;
216 std::unique_ptr<gpurecoworkflow_internals::GPURecoWorkflowSpec_PipelineInternals> mPipeline;
217 o2::its::TimeFrame* mITSTimeFrame = nullptr;
218 std::vector<fair::mq::RegionInfo> mRegionInfos;
219 const o2::itsmft::TopologyDictionary* mITSDict = nullptr;
220 const o2::dataformats::MeanVertexObject* mMeanVertex;
221 uint64_t mTPCSectorMask = 0;
222 int64_t mCreationForCalib = -1;
223 int32_t mVerbosity = 0;
224 uint32_t mNTFs = 0;
225 uint32_t mNDebugDumps = 0;
226 uint32_t mNextThreadIndex = 0;
227 bool mUpdateGainMapCCDB = true;
228 std::unique_ptr<o2::gpu::GPUSettingsTF> mTFSettings;
229 std::unique_ptr<o2::gpu::GPUSettingsProcessingNNclusterizer> mNNClusterizerSettings;
230
231 Config mSpecConfig;
232 std::shared_ptr<o2::base::GRPGeomRequest> mGGR;
233 bool mGRPGeomUpdated = false;
234 bool mAutoContinuousMaxTimeBin = false;
235 bool mAutoSolenoidBz = false;
236 bool mMatLUTCreated = false;
237 bool mITSGeometryCreated = false;
238 bool mTRDGeometryCreated = false;
239 bool mPropagatorInstanceCreated = false;
240 int32_t mTPCCutAtTimeBin = -1;
241};
242
243} // end namespace gpu
244} // end namespace o2
245
246#endif // O2_GPU_WORKFLOW_SPEC_H
std::vector< InputSpec > CompletionPolicyData
Utilities for parsing of data sequences.
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< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
o2::its::TimeFrame TimeFrame
Definition Vertexer.h:44
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...