Skip to content

Commit 8bb935c

Browse files
committed
GPU: Make the tpc refit runable on the GPU
1 parent 6486cf7 commit 8bb935c

23 files changed

+261
-71
lines changed

Detectors/Base/include/DetectorsBase/Propagator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class Propagator
111111
GPUd() const o2::base::MatLayerCylSet* getMatLUT() const { return mMatLUT; }
112112
GPUd() void setGPUField(const o2::gpu::GPUTPCGMPolynomialField* field) { mGPUField = field; }
113113
GPUd() const o2::gpu::GPUTPCGMPolynomialField* getGPUField() const { return mGPUField; }
114+
GPUd() void setBz(float bz) { mBz = bz; }
114115

115116
#ifndef GPUCA_GPUCODE
116117
static Propagator* Instance()

Detectors/Base/src/Propagator.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ int Propagator::initFieldFromGRP(const o2::parameters::GRPObject* grp, bool verb
9898
}
9999
return 0;
100100
}
101-
101+
#elif !defined(GPUCA_GPUCODE)
102+
Propagator::Propagator()
103+
{
104+
} // empty dummy constructor for standalone benchmark
102105
#endif
103106

104107
//_______________________________________________________________________

Detectors/TPC/workflow/src/CATrackerSpec.cxx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
#include "TPCdEdxCalibrationSplines.h"
4040
#include "DPLUtils/DPLRawParser.h"
4141
#include "DetectorsBase/MatLayerCylSet.h"
42+
#include "DetectorsBase/Propagator.h"
43+
#include "DetectorsBase/GeometryManager.h"
44+
#include "DetectorsCommonDataFormats/NameConf.h"
4245
#include "DetectorsRaw/HBFUtils.h"
4346
#include "TPCBase/RDHUtils.h"
4447
#include "GPUO2InterfaceConfiguration.h"
@@ -127,7 +130,9 @@ DataProcessorSpec getCATrackerSpec(CompletionPolicyData* policyData, ca::Config
127130
tracker = std::make_unique<GPUCATracking>();
128131

129132
// Create configuration object and fill settings
130-
const auto grp = o2::parameters::GRPObject::loadFrom("o2sim_grp.root");
133+
const auto grp = o2::parameters::GRPObject::loadFrom(o2::base::NameConf::getGRPFileName());
134+
o2::base::GeometryManager::loadGeometry();
135+
o2::base::Propagator::initFieldFromGRP(o2::base::NameConf::getGRPFileName());
131136
if (grp) {
132137
config.configEvent.solenoidBz = 5.00668f * grp->getL3Current() / 30000.;
133138
config.configEvent.continuousMaxTimeBin = grp->isDetContinuousReadOut(o2::detectors::DetID::TPC) ? -1 : 0; // Number of timebins in timeframe if continuous, 0 otherwise
@@ -216,15 +221,16 @@ DataProcessorSpec getCATrackerSpec(CompletionPolicyData* policyData, ca::Config
216221
if (config.configCalib.fastTransform == nullptr) {
217222
throw std::invalid_argument("GPUCATracking: initialization of the TPC transformation failed");
218223
}
224+
219225
if (confParam.matLUTFile.size()) {
220226
config.configCalib.matLUT = o2::base::MatLayerCylSet::loadFromFile(confParam.matLUTFile.c_str(), "MatBud");
221227
}
228+
222229
if (confParam.dEdxFile.size()) {
223230
processAttributes->dEdxSplines.reset(new TPCdEdxCalibrationSplines(confParam.dEdxFile.c_str()));
224231
} else {
225232
processAttributes->dEdxSplines.reset(new TPCdEdxCalibrationSplines);
226233
}
227-
228234
config.configCalib.dEdxSplines = processAttributes->dEdxSplines.get();
229235

230236
if (boost::filesystem::exists(confParam.gainCalibFile)) {
@@ -239,9 +245,10 @@ DataProcessorSpec getCATrackerSpec(CompletionPolicyData* policyData, ca::Config
239245
}
240246
config.configCalib.tpcPadGain = processAttributes->tpcPadGainCalib.get();
241247

248+
config.configCalib.o2Propagator = Propagator::Instance();
249+
242250
// Sample code what needs to be done for the TRD Geometry, when we extend this to TRD tracking.
243-
/*o2::base::GeometryManager::loadGeometry();
244-
o2::trd::Geometry gm;
251+
/* o2::trd::Geometry gm;
245252
gm.createPadPlaneArray();
246253
gm.createClusterMatrixArray();
247254
std::unique_ptr<o2::trd::GeometryFlat> gf(gm);

GPU/Common/GPUDefGPUParameters.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,12 @@
345345
#ifndef GPUCA_LB_GPUTPCStartHitsSorter
346346
#define GPUCA_LB_GPUTPCStartHitsSorter 256
347347
#endif
348+
#ifndef GPUCA_LB_GPUTrackingRefitKernel_mode0asGPU
349+
#define GPUCA_LB_GPUTrackingRefitKernel_mode0asGPU 256
350+
#endif
351+
#ifndef GPUCA_LB_GPUTrackingRefitKernel_mode1asTrackParCov
352+
#define GPUCA_LB_GPUTrackingRefitKernel_mode1asTrackParCov 256
353+
#endif
348354
#define GPUCA_GET_THREAD_COUNT(...) GPUCA_M_FIRST(__VA_ARGS__)
349355
#else
350356
// The following defaults are needed to compile the host code

GPU/GPUTracking/Base/GPUConstantMem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class GPUTRDTracker_t
4747
#include "GPUTPCCompression.h"
4848
#include "GPUITSFitter.h"
4949
#include "GPUTPCClusterFinder.h"
50+
#include "GPUTrackingRefit.h"
5051
#else
5152
#include "GPUO2FakeClasses.h"
5253
#endif
@@ -71,6 +72,7 @@ struct GPUConstantMem {
7172
GPUTRDTrackerGPU trdTracker;
7273
GPUTPCClusterFinder tpcClusterer[GPUCA_NSLICES];
7374
GPUITSFitter itsFitter;
75+
GPUTrackingRefitProcessor trackingRefit;
7476
GPUTrackingInOutPointers ioPtrs;
7577
GPUCalibObjectsConst calibObjects;
7678
GPUErrors errorCodes;

GPU/GPUTracking/Base/GPUDataTypes.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ namespace o2
4848
class MCCompLabel;
4949
namespace base
5050
{
51+
class Propagator;
5152
class MatLayerCylSet;
5253
} // namespace base
5354
namespace trd
@@ -136,7 +137,7 @@ class GPUDataTypes
136137
TPCRaw = 64 };
137138

138139
#ifdef GPUCA_NOCOMPAT_ALLOPENCL
139-
static constexpr const char* const RECO_STEP_NAMES[] = {"TPC Transformation", "TPC Sector Tracking", "TPC Track Merging and Fit", "TPC Compression", "TRD Tracking", "ITS Tracking", "TPC dEdx Computation", "TPC Cluster Finding", "TPC Decompression"};
140+
static constexpr const char* const RECO_STEP_NAMES[] = {"TPC Transformation", "TPC Sector Tracking", "TPC Track Merging and Fit", "TPC Compression", "TRD Tracking", "ITS Tracking", "TPC dEdx Computation", "TPC Cluster Finding", "TPC Decompression", "Global Refit"};
140141
static constexpr const char* const GENERAL_STEP_NAMES[] = {"Prepare", "QA"};
141142
typedef bitfield<RecoStep, unsigned int> RecoStepField;
142143
typedef bitfield<InOutType, unsigned int> InOutTypeField;
@@ -176,6 +177,7 @@ struct GPUCalibObjectsTemplate {
176177
typename S<o2::trd::GeometryFlat>::type* trdGeometry = nullptr;
177178
typename S<TPCdEdxCalibrationSplines>::type* dEdxSplines = nullptr;
178179
typename S<TPCPadGainCalib>::type* tpcPadGain = nullptr;
180+
typename S<o2::base::Propagator>::type* o2Propagator = nullptr;
179181
};
180182
typedef GPUCalibObjectsTemplate<DefaultPtr> GPUCalibObjects;
181183
typedef GPUCalibObjectsTemplate<ConstPtr> GPUCalibObjectsConst;

GPU/GPUTracking/Base/GPUO2DataTypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "DataFormatsTPC/ClusterNative.h"
2121
#include "DataFormatsTPC/Digit.h"
2222
#include "DetectorsBase/MatLayerCylSet.h"
23+
#include "DetectorsBase/Propagator.h"
2324
#include "TRDBase/GeometryFlat.h"
2425
#else
2526
#include "GPUO2FakeClasses.h"

GPU/GPUTracking/Base/GPUO2FakeClasses.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ class GPUTPCCompression
102102
class GPUTPCClusterFinder
103103
{
104104
};
105+
class GPUTrackingRefitProcessor
106+
{
107+
};
105108
struct GPUTPCCFChainContext {
106109
};
107110
#ifndef __OPENCL__

GPU/GPUTracking/Base/GPUParam.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ using namespace GPUCA_NAMESPACE::gpu;
2727
#endif
2828
#include <cstring>
2929
#include <tuple>
30+
#ifdef HAVE_O2HEADERS
31+
#include "DetectorsBase/Propagator.h"
32+
#endif
3033

3134
#include "utils/qconfigrtc.h"
3235

@@ -244,3 +247,21 @@ std::string GPUParamRTC::generateRTCCode(const GPUParam& param, bool useConstexp
244247
static_assert(alignof(GPUCA_NAMESPACE::gpu::GPUParam) == alignof(GPUCA_NAMESPACE::gpu::GPUSettingsRec));
245248
static_assert(alignof(GPUCA_NAMESPACE::gpu::GPUParam) == alignof(GPUCA_NAMESPACE::gpu::GPUSettingsParam));
246249
static_assert(sizeof(GPUCA_NAMESPACE::gpu::GPUParam) - sizeof(GPUCA_NAMESPACE::gpu::GPUParamRTC) == sizeof(GPUCA_NAMESPACE::gpu::GPUSettingsRec) + sizeof(GPUCA_NAMESPACE::gpu::GPUSettingsParam) - sizeof(GPUCA_NAMESPACE::gpu::gpu_rtc::GPUSettingsRec) - sizeof(GPUCA_NAMESPACE::gpu::gpu_rtc::GPUSettingsParam));
250+
251+
o2::base::Propagator* GPUParam::GetDefaultO2Propagator(bool useGPUField) const
252+
{
253+
o2::base::Propagator* prop = nullptr;
254+
#ifdef HAVE_O2HEADERS
255+
if (useGPUField == false) {
256+
throw std::runtime_error("o2 propagator withouzt gpu field unsupported");
257+
}
258+
prop = o2::base::Propagator::Instance();
259+
if (useGPUField) {
260+
prop->setGPUField(&polynomialField);
261+
prop->setBz(polynomialField.GetNominalBz());
262+
}
263+
#else
264+
throw std::runtime_error("o2 propagator unsupported");
265+
#endif
266+
return prop;
267+
}

GPU/GPUTracking/Base/GPUParam.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
#include "GPUTPCGeometry.h"
2222
#include "GPUTPCGMPolynomialField.h"
2323

24+
namespace o2
25+
{
26+
namespace base
27+
{
28+
class Propagator;
29+
} // namespace base
30+
} // namespace o2
31+
2432
namespace GPUCA_NAMESPACE
2533
{
2634
namespace gpu
@@ -63,6 +71,7 @@ struct GPUParam : public internal::GPUParam_t<GPUSettingsRec, GPUSettingsParam>
6371
void SetDefaults(const GPUSettingsEvent* e, const GPUSettingsRec* r = nullptr, const GPUSettingsProcessing* p = nullptr, const GPURecoStepConfiguration* w = nullptr);
6472
void UpdateEventSettings(const GPUSettingsEvent* e, const GPUSettingsProcessing* p = nullptr);
6573
void LoadClusterErrors(bool Print = 0);
74+
o2::base::Propagator* GetDefaultO2Propagator(bool useGPUField = false) const;
6675
#endif
6776

6877
GPUd() float Alpha(int iSlice) const

0 commit comments

Comments
 (0)