Project
Loading...
Searching...
No Matches
WorkflowSpec.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.
15
16#include <cstddef>
17#include <functional>
18#include <string>
19
20namespace o2::framework
21{
22
24 size_t maxIndex,
25 std::function<void(DataProcessorSpec&, size_t)> amendCallback)
26{
27 WorkflowSpec results;
28 results.reserve(maxIndex);
29 for (size_t i = 0; i < maxIndex; ++i) {
30 results.push_back(original);
31 results.back().name = original.name + "_" + std::to_string(i);
32 results.back().rank = i;
33 results.back().nSlots = maxIndex;
34 amendCallback(results.back(), i);
35 }
36 return results;
37}
38
40 size_t maxIndex,
41 std::function<void(DataProcessorSpec&, size_t)> amendCallback)
42{
43 WorkflowSpec results;
44 results.reserve(specs.size() * maxIndex);
45 for (auto& spec : specs) {
46 auto result = parallel(spec, maxIndex, amendCallback);
47 results.insert(results.end(), result.begin(), result.end());
48 }
49
50 return results;
51}
52
54 size_t nPipelines,
55 std::function<size_t()> getNumberOfSubspecs,
56 std::function<size_t(size_t)> getSubSpec)
57{
59 size_t numberOfSubspecs = getNumberOfSubspecs();
60 if (numberOfSubspecs < nPipelines) {
61 // no need to create more pipelines than the number of parallel Ids, in that case
62 // each pipeline serves one id
63 nPipelines = numberOfSubspecs;
64 }
65 for (auto process : specs) {
66 size_t channels = numberOfSubspecs;
67 size_t inputMultiplicity = numberOfSubspecs / nPipelines;
68 if (numberOfSubspecs % nPipelines) {
69 // some processes will get one more channel to handle all channels
70 inputMultiplicity += 1;
71 }
72 auto amendProcess = [numberOfSubspecs, nPipelines, &channels, &inputMultiplicity, getSubSpec](DataProcessorSpec& spec, size_t pipeline) {
73 auto inputs = std::move(spec.inputs);
74 auto outputs = std::move(spec.outputs);
75 spec.inputs.reserve(inputMultiplicity);
76 spec.outputs.reserve(inputMultiplicity);
77 for (size_t inputNo = 0; inputNo < inputMultiplicity; ++inputNo) {
78 for (auto& input : inputs) {
79 spec.inputs.push_back(input);
80 spec.inputs.back().binding += std::to_string(inputNo);
81 DataSpecUtils::updateMatchingSubspec(spec.inputs.back(), getSubSpec(pipeline + inputNo * nPipelines));
82 }
83 for (auto& output : outputs) {
84 spec.outputs.push_back(output);
85 spec.outputs.back().binding.value += std::to_string(inputNo);
86 // FIXME: this will be unneeded once we have a subSpec-less variant...
87 DataSpecUtils::updateMatchingSubspec(spec.outputs.back(), getSubSpec(pipeline + inputNo * nPipelines));
88 }
89 }
90 channels -= inputMultiplicity;
91 if (inputMultiplicity > numberOfSubspecs / nPipelines &&
92 (channels % (nPipelines - (pipeline + 1))) == 0) {
93 // if the remaining ids can be distributed equally among the remaining pipelines
94 // we can decrease multiplicity
95 inputMultiplicity = numberOfSubspecs / nPipelines;
96 }
97 };
98
99 if (nPipelines > 1) {
100 // add multiple processes and distribute inputs among them
101 auto amendedProcessors = parallel(process, nPipelines, amendProcess);
102 result.insert(result.end(), amendedProcessors.begin(), amendedProcessors.end());
103 } else if (nPipelines == 1) {
104 // add one single process with all the inputs
105 amendProcess(process, 0);
106 result.push_back(process);
107 }
108 }
109 return result;
110}
111
113 size_t maxIndex,
114 std::function<void(InputSpec&, size_t)> amendCallback)
115{
116 Inputs results;
117 results.reserve(maxIndex);
118 for (size_t i = 0; i < maxIndex; ++i) {
119 results.push_back(original);
120 amendCallback(results.back(), i);
121 }
122 return results;
123}
124
126 size_t maxIndex,
127 std::function<void(InputSpec&, size_t)> amendCallback)
128{
129 Inputs results;
130 results.reserve(inputs.size() * maxIndex);
131 for (size_t i = 0; i < maxIndex; ++i) {
132 for (auto const& original : inputs) {
133 results.push_back(original);
134 amendCallback(results.back(), i);
135 }
136 }
137 return results;
138}
139
141 size_t count)
142{
143 if (original.maxInputTimeslices != 1) {
144 std::runtime_error("You can time slice only once");
145 }
146 original.maxInputTimeslices = count;
147 return original;
148}
149
152std::vector<InputSpec> select(const char* matcher)
153{
154 return DataDescriptorQueryBuilder::parse(matcher);
155}
156
157namespace workflow
158{
159WorkflowSpec combine(char const* name, std::vector<DataProcessorSpec> const& specs, bool doIt)
160{
161 if (!doIt) {
162 return specs;
163 }
164
165 DataProcessorSpec combined;
166 combined.name = name;
167 // add all the inputs to combined
168 for (auto& spec : specs) {
169 for (auto& input : spec.inputs) {
170 combined.inputs.push_back(input);
171 }
172 for (auto& output : spec.outputs) {
173 combined.outputs.push_back(output);
174 }
175 for (auto& option : spec.options) {
176 combined.options.push_back(option);
177 }
178 for (auto& label : spec.labels) {
179 combined.labels.push_back(label);
180 }
181 for (auto& metadatum : spec.metadata) {
182 combined.metadata.push_back(metadatum);
183 }
184 for (auto& service : spec.requiredServices) {
185 // Insert in the final list of services
186 // only if a spec with the same name is not there
187 // already.
188 bool found = false;
189 for (auto& existing : combined.requiredServices) {
190 if (existing.name == service.name) {
191 found = true;
192 break;
193 }
194 }
195 if (!found) {
196 combined.requiredServices.push_back(service);
197 }
198 }
199 }
200
201 combined.algorithm = AlgorithmSpec{[specs](InitContext& ctx) {
202 std::vector<AlgorithmSpec::ProcessCallback> callbacks;
203 for (auto& spec : specs) {
204 if (spec.algorithm.onInit) {
205 callbacks.push_back(spec.algorithm.onInit(ctx));
206 } else if (spec.algorithm.onProcess) {
207 callbacks.push_back(spec.algorithm.onProcess);
208 }
209 }
210 return [callbacks](ProcessingContext& context) {
211 for (auto& callback : callbacks) {
212 callback(context);
213 }
214 };
215 }};
216 return {combined};
217}
218} // namespace workflow
219
220} // namespace o2::framework
int32_t i
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 process
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 Print launch bounds used for RTC code as debugging option
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
GLint GLsizei count
Definition glcorearb.h:399
GLuint64EXT * result
Definition glcorearb.h:5662
GLuint const GLchar * name
Definition glcorearb.h:781
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
WorkflowSpec combine(const char *name, std::vector< DataProcessorSpec > const &specs, bool doIt)
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
WorkflowSpec parallelPipeline(const WorkflowSpec &specs, size_t nPipelines, std::function< size_t()> getNumberOfSubspecs, std::function< size_t(size_t)> getSubSpec)
WorkflowSpec parallel(DataProcessorSpec original, size_t maxIndex, std::function< void(DataProcessorSpec &, size_t id)> amendCallback)
Inputs mergeInputs(InputSpec original, size_t maxIndex, std::function< void(InputSpec &, size_t)> amendCallback)
std::vector< DataProcessorSpec > WorkflowSpec
DataProcessorSpec timePipeline(DataProcessorSpec original, size_t count)
std::vector< InputSpec > select(char const *matcher="")
std::vector< InputSpec > Inputs
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
static std::vector< InputSpec > parse(const char *s="")
std::vector< DataProcessorMetadata > metadata
std::vector< ServiceSpec > requiredServices
std::vector< DataProcessorLabel > labels
static void updateMatchingSubspec(InputSpec &in, header::DataHeader::SubSpecificationType subSpec)
size_t nPipelines
std::vector< ChannelData > channels