Skip to content

Commit 4952cee

Browse files
f3schdavidrohr
authored andcommitted
ITS3: GPU tracking
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 4c4e004 commit 4952cee

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

Detectors/Upgrades/ITS3/workflow/include/ITS3Workflow/RecoWorkflow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace o2::its3::reco_workflow
2626
framework::WorkflowSpec getWorkflow(bool useMC,
2727
const std::string& trmode,
2828
o2::gpu::GPUDataTypes::DeviceType dtype,
29+
bool useGPUWorkflow,
2930
bool upstreamDigits,
3031
bool upstreamClusters,
3132
bool disableRootOutput,

Detectors/Upgrades/ITS3/workflow/src/RecoWorkflow.cxx

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@
1515
#include "ITSWorkflow/ClusterWriterSpec.h"
1616
#include "ITSWorkflow/TrackWriterSpec.h"
1717
#include "ITS3Workflow/DigitReaderSpec.h"
18-
#include "Framework/Logger.h"
18+
#include "GPUWorkflow/GPUWorkflowSpec.h"
19+
#include "Framework/CCDBParamSpec.h"
20+
21+
// Dummy pointers
22+
using CompletionPolicyData = std::vector<InputSpec>;
23+
static CompletionPolicyData gPolicyData;
24+
static std::shared_ptr<o2::gpu::GPURecoWorkflowSpec> gTask;
1925

2026
namespace o2::its3::reco_workflow
2127
{
2228

23-
framework::WorkflowSpec getWorkflow(bool useMC, const std::string& trmode, o2::gpu::GPUDataTypes::DeviceType dtype,
29+
framework::WorkflowSpec getWorkflow(bool useMC, const std::string& trmode, o2::gpu::GPUDataTypes::DeviceType dtype, bool useGPUWorkflow,
2430
bool upstreamDigits, bool upstreamClusters, bool disableRootOutput, bool useGeom, int useTrig, bool overrideBeamPosition)
2531
{
2632
framework::WorkflowSpec specs;
@@ -38,8 +44,36 @@ framework::WorkflowSpec getWorkflow(bool useMC, const std::string& trmode, o2::g
3844
}
3945

4046
if (trmode != "off") {
41-
specs.emplace_back(o2::its3::getTrackerSpec(useMC, useGeom, useTrig, trmode, overrideBeamPosition, dtype));
47+
if (useGPUWorkflow) {
48+
o2::gpu::GPURecoWorkflowSpec::Config cfg;
49+
cfg.runITSTracking = true;
50+
cfg.isITS3 = true;
51+
cfg.itsTriggerType = useTrig;
52+
cfg.itsOverrBeamEst = overrideBeamPosition;
53+
cfg.processMC = useMC;
54+
Inputs ggInputs;
55+
auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, true, false, true, true,
56+
useGeom ? o2::base::GRPGeomRequest::Aligned : o2::base::GRPGeomRequest::None,
57+
ggInputs, true);
58+
if (!useGeom) {
59+
ggRequest->addInput({"itsTGeo", "ITS", "GEOMTGEO", 0, Lifetime::Condition, framework::ccdbParamSpec("ITS/Config/Geometry")}, ggInputs);
60+
}
61+
62+
auto task = std::make_shared<o2::gpu::GPURecoWorkflowSpec>(&gPolicyData, cfg, std::vector<int>(), 0, ggRequest);
63+
gTask = task;
64+
Inputs taskInputs = task->inputs();
65+
Options taskOptions = task->options();
66+
std::move(ggInputs.begin(), ggInputs.end(), std::back_inserter(taskInputs));
4267

68+
specs.emplace_back(DataProcessorSpec{
69+
"its3-gpu-tracker",
70+
taskInputs,
71+
task->outputs(),
72+
AlgorithmSpec{adoptTask<o2::gpu::GPURecoWorkflowSpec>(task)},
73+
taskOptions});
74+
} else {
75+
specs.emplace_back(o2::its3::getTrackerSpec(useMC, useGeom, useTrig, trmode, overrideBeamPosition, dtype));
76+
}
4377
if (!disableRootOutput) {
4478
specs.emplace_back(o2::its::getTrackWriterSpec(useMC));
4579
}

Detectors/Upgrades/ITS3/workflow/src/its3-reco-workflow.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
4848
{"tracking-mode", o2::framework::VariantType::String, "off", {"off,sync,async,cosmics"}},
4949
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}},
5050
{"use-full-geometry", o2::framework::VariantType::Bool, false, {"use full geometry instead of the light-weight IT3 part"}},
51+
{"use-gpu-workflow", o2::framework::VariantType::Bool, false, {"use GPU workflow (default: false)"}},
5152
{"gpu-device", o2::framework::VariantType::Int, 1, {"use gpu device: CPU=1,CUDA=2,HIP=3 (default: CPU)"}}};
5253
o2::raw::HBFUtilsInitializer::addConfigOption(options);
5354
std::swap(workflowOptions, options);
@@ -67,6 +68,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
6768
auto extClusters = configcontext.options().get<bool>("clusters-from-upstream");
6869
auto disableRootOutput = configcontext.options().get<bool>("disable-root-output");
6970
auto useGeom = configcontext.options().get<bool>("use-full-geometry");
71+
auto useGPUWfx = configcontext.options().get<bool>("use-gpu-workflow");
7072
std::transform(trmode.begin(), trmode.end(), trmode.begin(), [](unsigned char c) { return std::tolower(c); });
7173

7274
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
@@ -80,7 +82,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
8082
LOG(fatal) << "Unknown trigger type requested for events prescaling: " << selTrig;
8183
}
8284
}
83-
auto wf = o2::its3::reco_workflow::getWorkflow(useMC, trmode, gpuDevice, extDigits, extClusters, disableRootOutput, useGeom, trType, beamPosOVerride);
85+
auto wf = o2::its3::reco_workflow::getWorkflow(useMC, trmode, gpuDevice, useGPUWfx, extDigits, extClusters, disableRootOutput, useGeom, trType, beamPosOVerride);
8486

8587
// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
8688
o2::raw::HBFUtilsInitializer hbfIni(configcontext, wf);

0 commit comments

Comments
 (0)