Skip to content

Commit d423f9f

Browse files
committed
ITS: fix gpu compile due change in vertexer types
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 18a8109 commit d423f9f

File tree

7 files changed

+23
-49
lines changed

7 files changed

+23
-49
lines changed

Detectors/ITSMFT/ITS/tracking/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ o2_add_library(ITStracking
1919
src/Tracker.cxx
2020
src/TrackerTraits.cxx
2121
src/TrackingConfigParam.cxx
22-
src/ClusterLines.cxx
2322
src/Vertexer.cxx
2423
src/VertexerTraits.cxx
2524
PUBLIC_LINK_LIBRARIES

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TimeFrameGPU.h

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
namespace o2::its::gpu
2525
{
2626

27-
template <int NLayers = 7>
27+
template <int NLayers>
2828
class TimeFrameGPU final : public TimeFrame<NLayers>
2929
{
3030
using typename TimeFrame<NLayers>::CellSeedN;
@@ -34,7 +34,7 @@ class TimeFrameGPU final : public TimeFrame<NLayers>
3434

3535
public:
3636
TimeFrameGPU() = default;
37-
~TimeFrameGPU() = default;
37+
~TimeFrameGPU() final = default;
3838

3939
/// Most relevant operations
4040
void pushMemoryStack(const int);
@@ -104,7 +104,6 @@ class TimeFrameGPU final : public TimeFrame<NLayers>
104104
/// interface
105105
virtual bool isGPU() const noexcept final { return true; }
106106
virtual const char* getName() const noexcept { return "GPU"; }
107-
int getNClustersInRofSpan(const int, const int, const int) const;
108107
IndexTableUtilsN* getDeviceIndexTableUtils() { return mIndexTableUtilsDevice; }
109108
const auto getDeviceROFOverlapTableView() { return mDeviceROFOverlapTableView; }
110109
const auto getDeviceROFVertexLookupTableView() { return mDeviceROFVertexLookupTableView; }
@@ -144,19 +143,6 @@ class TimeFrameGPU final : public TimeFrame<NLayers>
144143
int* getDeviceNeighboursIndexTables(const int layer) { return mNeighboursIndexTablesDevice[layer]; }
145144
uint8_t* getDeviceMultCutMask() { return mMultMaskDevice; }
146145

147-
// Vertexer
148-
auto& getDeviceNTrackletsPerROF() const noexcept { return mNTrackletsPerROFDevice; }
149-
auto& getDeviceNTrackletsPerCluster() const noexcept { return mNTrackletsPerClusterDevice; }
150-
auto& getDeviceNTrackletsPerClusterSum() const noexcept { return mNTrackletsPerClusterSumDevice; }
151-
int32_t** getDeviceArrayNTrackletsPerROF() const noexcept { return mNTrackletsPerROFDeviceArray; }
152-
int32_t** getDeviceArrayNTrackletsPerCluster() const noexcept { return mNTrackletsPerClusterDeviceArray; }
153-
int32_t** getDeviceArrayNTrackletsPerClusterSum() const noexcept { return mNTrackletsPerClusterSumDeviceArray; }
154-
uint8_t* getDeviceUsedTracklets() const noexcept { return mUsedTrackletsDevice; }
155-
int32_t* getDeviceNLinesPerCluster() const noexcept { return mNLinesPerClusterDevice; }
156-
int32_t* getDeviceNLinesPerClusterSum() const noexcept { return mNLinesPerClusterSumDevice; }
157-
Line* getDeviceLines() const noexcept { return mLinesDevice; }
158-
gsl::span<int*> getDeviceTrackletsPerROFs() { return mNTrackletsPerROFDevice; }
159-
160146
void setDevicePropagator(const o2::base::PropagatorImpl<float>* p) final { this->mPropagatorDevice = p; }
161147

162148
// Host-specific getters
@@ -233,18 +219,6 @@ class TimeFrameGPU final : public TimeFrame<NLayers>
233219
std::array<TrackingFrameInfo*, NLayers> mTrackingFrameInfoDevice;
234220
const TrackingFrameInfo** mTrackingFrameInfoDeviceArray;
235221

236-
/// Vertexer
237-
std::array<int32_t*, 2> mNTrackletsPerROFDevice;
238-
std::array<int32_t*, 2> mNTrackletsPerClusterDevice;
239-
std::array<int32_t*, 2> mNTrackletsPerClusterSumDevice;
240-
uint8_t* mUsedTrackletsDevice;
241-
int32_t* mNLinesPerClusterDevice;
242-
int32_t* mNLinesPerClusterSumDevice;
243-
int32_t** mNTrackletsPerROFDeviceArray;
244-
int32_t** mNTrackletsPerClusterDeviceArray;
245-
int32_t** mNTrackletsPerClusterSumDeviceArray;
246-
Line* mLinesDevice;
247-
248222
// State
249223
Streams mGpuStreams;
250224
std::bitset<NLayers + 1> mPinnedUnsortedClusters{0};
@@ -258,12 +232,6 @@ class TimeFrameGPU final : public TimeFrame<NLayers>
258232
bounded_vector<TrackITSExt> mTrackITSExt;
259233
};
260234

261-
template <int NLayers>
262-
inline int TimeFrameGPU<NLayers>::getNClustersInRofSpan(const int rofIdstart, const int rofSpanSize, const int layerId) const
263-
{
264-
return static_cast<int>(this->mROFramesClusters[layerId][(rofIdstart + rofSpanSize) < this->mROFramesClusters.size() ? rofIdstart + rofSpanSize : this->mROFramesClusters.size() - 1] - this->mROFramesClusters[layerId][rofIdstart]);
265-
}
266-
267235
template <int NLayers>
268236
inline std::vector<unsigned int> TimeFrameGPU<NLayers>::getClusterSizes()
269237
{

Detectors/ITSMFT/ITS/tracking/GPU/cuda/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if(CUDA_ENABLED)
1919
TrackingKernels.cu
2020
PUBLIC_INCLUDE_DIRECTORIES ../
2121
PUBLIC_LINK_LIBRARIES O2::ITStracking
22+
O2::MathUtils
2223
O2::SimConfig
2324
O2::SimulationDataFormat
2425
O2::ReconstructionDataFormats
@@ -29,10 +30,11 @@ if(CUDA_ENABLED)
2930
set_target_gpu_arch("CUDA" ${targetName})
3031
# Enable relocatable device code (needed for separable compilation + debugging)
3132
set_property(TARGET ${targetName} PROPERTY CUDA_SEPARABLE_COMPILATION ON)
32-
# target_compile_options(${targetName} PRIVATE
33+
target_compile_options(${targetName} PRIVATE
34+
$<$<COMPILE_LANGUAGE:CUDA>:-diag-error=20014>
3335
# $<$<COMPILE_LANGUAGE:CUDA>:-G;-O0;-Xptxas=-O0>
3436
# $<$<COMPILE_LANGUAGE:CXX>:-O0;-g>
35-
# )
37+
)
3638
# target_compile_definitions(${targetName} PRIVATE ITS_MEASURE_GPU_TIME ITS_GPU_LOG)
3739
target_compile_definitions(${targetName} PRIVATE $<TARGET_PROPERTY:O2::ITStracking,COMPILE_DEFINITIONS>)
3840
endif()

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616
#include <vector>
1717
#include <Math/SMatrix.h>
1818
#include <Math/SVector.h>
19-
#include "Framework/Logger.h"
2019
#include "ITStracking/Cluster.h"
2120
#include "ITStracking/Constants.h"
2221
#include "ITStracking/Tracklet.h"
22+
#include "GPUCommonRtypes.h"
2323

2424
namespace o2::its
2525
{
2626

2727
struct Line final {
28+
#if !defined(__HIPCC__) && !defined(__CUDACC__) // hide the class completely for gpu-cc
2829
using SVector3f = ROOT::Math::SVector<float, 3>;
2930
using SMatrix3f = ROOT::Math::SMatrix<float, 3, 3, ROOT::Math::MatRepSym<float, 3>>;
3031

@@ -34,23 +35,20 @@ struct Line final {
3435
static float getDistanceFromPoint(const Line& line, const std::array<float, 3>& point);
3536
static SMatrix3f getDCAComponents(const Line& line, const std::array<float, 3>& point);
3637
static float getDCA(const Line&, const Line&, const float precision = constants::Tolerance);
37-
bool isEmpty() const { return ROOT::Math::Dot(originPoint, originPoint) == 0.f &&
38-
ROOT::Math::Dot(cosinesDirector, cosinesDirector) == 0.f; }
38+
bool isEmpty() const noexcept;
3939
bool operator==(const Line&) const = default;
40-
void print() const
41-
{
42-
LOGP(info, "TRKLT: x={} y={} z={} dx={} dy={} dz={} ts:{}+/-{}", originPoint(0), originPoint(1), originPoint(2), cosinesDirector(0), cosinesDirector(1), cosinesDirector(2), mTime.getTimeStamp(), mTime.getTimeStampError());
43-
}
4440

4541
SVector3f originPoint;
4642
SVector3f cosinesDirector;
4743
TimeEstBC mTime;
4844

4945
ClassDefNV(Line, 1);
46+
#endif
5047
};
5148

5249
class ClusterLines final
5350
{
51+
#if !defined(__HIPCC__) && !defined(__CUDACC__) // hide the class completely for gpu-cc
5452
using SMatrix3 = ROOT::Math::SMatrix<double, 3, 3, ROOT::Math::MatRepSym<double, 3>>;
5553
using SMatrix3f = ROOT::Math::SMatrix<float, 3, 3, ROOT::Math::MatRepSym<float, 3>>;
5654
using SVector3 = ROOT::Math::SVector<double, 3>;
@@ -81,6 +79,9 @@ class ClusterLines final
8179
bool mIsValid = false; // true if linear system was solved successfully
8280
TimeEstBC mTime; // time stamp
8381
std::vector<int> mLabels; // contributing labels
82+
83+
ClassDefNV(ClusterLines, 1);
84+
#endif
8485
};
8586

8687
} // namespace o2::its

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace its
3838
{
3939
class TrackITSExt;
4040

41-
template <int NLayers = 7>
41+
template <int NLayers>
4242
class TrackerTraits
4343
{
4444
public:

Detectors/ITSMFT/ITS/tracking/src/ClusterLines.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ Line::SMatrix3f Line::getDCAComponents(const Line& line, const std::array<float,
7171
return m;
7272
}
7373

74+
bool Line::isEmpty() const noexcept
75+
{
76+
return ROOT::Math::Dot(originPoint, originPoint) == 0.f &&
77+
ROOT::Math::Dot(cosinesDirector, cosinesDirector) == 0.f;
78+
}
79+
7480
// Accumulate the weighted normal equation contributions (A matrix and B vector)
7581
// from a single line into the running sums. The covariance is assumed to be
7682
// diagonal and uniform ({1,1,1}) so the weights simplify accordingly.

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ GPUReconstruction* GPUReconstruction_Create_CUDA(const GPUSettingsDeviceBackend&
9494
void GPUReconstructionCUDA::GetITSTraits(std::unique_ptr<o2::its::TrackerTraits<7>>* trackerTraits, std::unique_ptr<o2::its::VertexerTraits<7>>* vertexerTraits, std::unique_ptr<o2::its::TimeFrame<7>>* timeFrame)
9595
{
9696
if (trackerTraits) {
97-
trackerTraits->reset(new o2::its::TrackerTraitsGPU);
97+
trackerTraits->reset(new o2::its::TrackerTraitsGPU<7>);
9898
}
9999
if (vertexerTraits) {
100100
vertexerTraits->reset(new o2::its::VertexerTraits<7>);
101-
// TODO gpu-code to be implemented then remove line above and uncomment line below
102-
// vertexerTraits->reset(new o2::its::VertexerTraitsGPU<7>);
103101
}
104102
if (timeFrame) {
105-
timeFrame->reset(new o2::its::gpu::TimeFrameGPU);
103+
timeFrame->reset(new o2::its::gpu::TimeFrameGPU<7>);
106104
}
107105
}
108106

0 commit comments

Comments
 (0)