Skip to content

Commit ad8cd1d

Browse files
committed
ITS3: GPU tracking
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent b33925b commit ad8cd1d

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-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: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@
1515
#include "ITS3Workflow/TrackerSpec.h"
1616
#include "ITS3Workflow/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,35 @@ 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.runITS3Tracking = true;
50+
cfg.itsTriggerType = useTrig;
51+
cfg.itsOverrBeamEst = overrideBeamPosition;
52+
cfg.processITSMC = useMC;
53+
Inputs ggInputs;
54+
auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, true, false, true, true,
55+
useGeom ? o2::base::GRPGeomRequest::Aligned : o2::base::GRPGeomRequest::None,
56+
ggInputs, true);
57+
if (!useGeom) {
58+
ggRequest->addInput({"itsTGeo", "ITS", "GEOMTGEO", 0, Lifetime::Condition, framework::ccdbParamSpec("ITS/Config/Geometry")}, ggInputs);
59+
}
60+
61+
auto task = std::make_shared<o2::gpu::GPURecoWorkflowSpec>(&gPolicyData, cfg, std::vector<int>(), 0, ggRequest);
62+
gTask = task;
63+
Inputs taskInputs = task->inputs();
64+
Options taskOptions = task->options();
65+
std::move(ggInputs.begin(), ggInputs.end(), std::back_inserter(taskInputs));
4266

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

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)