Skip to content

Commit 25b923d

Browse files
authored
Merge 2c36399 into sapling-pr-archive-ktf
2 parents 55711b6 + 2c36399 commit 25b923d

File tree

11 files changed

+80
-17
lines changed

11 files changed

+80
-17
lines changed

Detectors/GlobalTracking/src/MatchTPCITS.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ bool MatchTPCITS::prepareITSData()
671671
auto pattID = clus.getPatternID();
672672
unsigned int npix;
673673
#ifdef ENABLE_UPGRADES
674-
if ((pattID == o2::itsmft::CompCluster::InvalidPatternID) || ((withITS3) ? mIT3Dict->isGroup(pattID) : mITSDict->isGroup(pattID))) { // braces guarantee evaluation order
674+
auto ib = o2::its3::constants::detID::isDetITS3(clus.getChipID());
675+
if ((pattID == o2::itsmft::CompCluster::InvalidPatternID) || ((withITS3) ? mIT3Dict->isGroup(pattID, ib) : mITSDict->isGroup(pattID))) { // braces guarantee evaluation order
675676
#else
676677
if (pattID == o2::itsmft::CompCluster::InvalidPatternID || mITSDict->isGroup(pattID)) {
677678
#endif
@@ -681,7 +682,7 @@ bool MatchTPCITS::prepareITSData()
681682
} else {
682683
#ifdef ENABLE_UPGRADES
683684
if (withITS3) {
684-
npix = mIT3Dict->getNpixels(pattID);
685+
npix = mIT3Dict->getNpixels(pattID, ib);
685686
} else {
686687
npix = mITSDict->getNpixels(pattID);
687688
}
@@ -1444,8 +1445,7 @@ void MatchTPCITS::refitWinners(pmr::vector<o2::dataformats::TrackTPCITS>& matche
14441445

14451446
#ifdef WITH_OPENMP
14461447
#pragma omp parallel for schedule(dynamic) num_threads(mNThreads) \
1447-
reduction(+ \
1448-
: nFailedRefit)
1448+
reduction(+ : nFailedRefit)
14491449
#endif
14501450
for (int ifit = 0; ifit < nToFit; ifit++) {
14511451
int iTPC = tpcToFit[ifit], iITS;

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class CellSeed final : public o2::track::TrackParCovF
9797
GPUhd() void setFirstTrackletIndex(int trkl) { mTracklets[0] = trkl; };
9898
GPUhd() int getSecondTrackletIndex() const { return mTracklets[1]; };
9999
GPUhd() void setSecondTrackletIndex(int trkl) { mTracklets[1] = trkl; };
100-
GPUhd() int getChi2() const { return mChi2; };
100+
GPUhd() float getChi2() const { return mChi2; };
101101
GPUhd() void setChi2(float chi2) { mChi2 = chi2; };
102102
GPUhd() int getLevel() const { return mLevel; };
103103
GPUhd() void setLevel(int level) { mLevel = level; };

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);

Detectors/Vertexing/StrangenessTracking/include/StrangenessTracking/StrangenessTracker.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,20 +279,20 @@ class StrangenessTracker
279279
for (unsigned int iClus{0}; iClus < ITSclus.size(); ++iClus) {
280280
auto& clus = ITSclus[iClus];
281281
auto pattID = clus.getPatternID();
282+
auto ib = o2::its3::constants::detID::isDetITS3(clus.getChipID());
282283
int npix;
283284
o2::itsmft::ClusterPattern patt;
284285

285-
if (pattID == o2::itsmft::CompCluster::InvalidPatternID || mdict->isGroup(pattID)) {
286+
if (pattID == o2::itsmft::CompCluster::InvalidPatternID || mdict->isGroup(pattID, ib)) {
286287
patt.acquirePattern(pattIt);
287288
npix = patt.getNPixels();
288289
} else {
289290

290-
npix = mdict->getNpixels(pattID);
291-
patt = mdict->getPattern(pattID);
291+
npix = mdict->getNpixels(pattID, ib);
292+
patt = mdict->getPattern(pattID, ib);
292293
}
293294
clusSizeVec[iClus] = npix;
294295
}
295-
// LOG(info) << " Patt Npixel: " << pattVec[0].getNPixels();
296296
}
297297
#endif
298298

Framework/Core/src/CommonServices.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "Framework/DeviceConfig.h"
4545
#include "Framework/DefaultsHelpers.h"
4646
#include "Framework/Signpost.h"
47+
#include "Framework/DriverConfig.h"
4748

4849
#include "TextDriverClient.h"
4950
#include "WSDriverClient.h"
@@ -800,6 +801,9 @@ auto sendRelayerMetrics(ServiceRegistryRef registry, DataProcessingStats& stats)
800801

801802
auto flushStates(ServiceRegistryRef registry, DataProcessingStates& states) -> void
802803
{
804+
if (!registry.get<DriverConfig const>().driverHasGUI) {
805+
return;
806+
}
803807
states.flushChangedStates([&states, registry](std::string const& spec, int64_t timestamp, std::string_view value) mutable -> void {
804808
auto& client = registry.get<ControlService>();
805809
client.push(spec, value, timestamp);

GPU/Workflow/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ o2_add_library(GPUWorkflow
2727
O2::DataFormatsGlobalTracking
2828
O2::DataFormatsTRD
2929
PRIVATE_LINK_LIBRARIES O2::GPUTracking
30-
O2::ITSTrackingInterface)
30+
O2::ITSTrackingInterface
31+
$<$<BOOL:${ENABLE_UPGRADES}>:O2::ITS3TrackingInterface>)
3132

3233
o2_add_executable(reco-workflow
3334
COMPONENT_NAME gpu

GPU/Workflow/include/GPUWorkflow/GPUWorkflowSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ class GPURecoWorkflowSpec : public o2::framework::Task
130130
bool runITSTracking = false;
131131
bool itsOverrBeamEst = false;
132132
bool tpcTriggerHandling = false;
133+
bool isITS3 = false;
133134
};
134135

135136
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);

GPU/Workflow/src/GPUWorkflowITS.cxx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
#include "ITStracking/TrackingInterface.h"
2222

23+
#ifdef ENABLE_UPGRADES
24+
#include "ITS3Reconstruction/TrackingInterface.h"
25+
#endif
26+
2327
namespace o2::gpu
2428
{
2529

@@ -35,6 +39,18 @@ void GPURecoWorkflowSpec::initFunctionITS(o2::framework::InitContext& ic)
3539
{
3640
o2::its::VertexerTraits* vtxTraits = nullptr;
3741
o2::its::TrackerTraits* trkTraits = nullptr;
42+
#ifdef ENABLE_UPGRADES
43+
if (mSpecConfig.isITS3) {
44+
mITSTrackingInterface = std::make_unique<o2::its3::ITS3TrackingInterface>(mSpecConfig.processMC,
45+
mSpecConfig.itsTriggerType,
46+
mSpecConfig.itsOverrBeamEst);
47+
} else
48+
#endif
49+
{
50+
mITSTrackingInterface = std::make_unique<o2::its::ITSTrackingInterface>(mSpecConfig.processMC,
51+
mSpecConfig.itsTriggerType,
52+
mSpecConfig.itsOverrBeamEst);
53+
}
3854
mITSTrackingInterface = std::make_unique<o2::its::ITSTrackingInterface>(mSpecConfig.processMC,
3955
mSpecConfig.itsTriggerType,
4056
mSpecConfig.itsOverrBeamEst);

0 commit comments

Comments
 (0)