Skip to content

Commit 18a3486

Browse files
committed
Further vertexer fixes
1 parent ad8fb84 commit 18a3486

3 files changed

Lines changed: 38 additions & 23 deletions

File tree

Detectors/ITSMFT/ITS/tracking/cuda/include/ITStrackingCUDA/DeviceStoreVertexerGPU.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ class DeviceStoreVertexerGPU final
5656
DeviceStoreVertexerGPU();
5757
~DeviceStoreVertexerGPU() = default;
5858

59-
UniquePointer<DeviceStoreVertexerGPU> initialise(const std::array<std::vector<Cluster>, constants::its2::LayersNumberVertexer>&,
59+
UniquePointer<DeviceStoreVertexerGPU> initialise(const std::array<std::vector<Cluster>, constants::its::LayersNumberVertexer>&,
6060
const std::array<std::array<int, constants::its2::ZBins * constants::its2::PhiBins + 1>,
61-
constants::its2::LayersNumberVertexer>&);
61+
constants::its::LayersNumberVertexer>&);
6262

6363
// RO APIs
64-
GPUd() const Array<Vector<Cluster>, constants::its2::LayersNumberVertexer>& getClusters()
64+
GPUd() const Array<Vector<Cluster>, constants::its::LayersNumberVertexer>& getClusters()
6565
{
6666
return mClusters;
6767
}
@@ -111,7 +111,7 @@ class DeviceStoreVertexerGPU final
111111

112112
private:
113113
VertexerStoreConfigurationGPU mGPUConf;
114-
Array<Vector<Cluster>, constants::its2::LayersNumberVertexer> mClusters;
114+
Array<Vector<Cluster>, constants::its::LayersNumberVertexer> mClusters;
115115
Vector<Line> mTracklets;
116116
Array<Vector<int>, 2> mIndexTables;
117117
Vector<GPUVertex> mGPUVertices;
@@ -121,7 +121,7 @@ class DeviceStoreVertexerGPU final
121121
Vector<int> mNExclusiveFoundLines;
122122
Vector<Tracklet> mDuplets01;
123123
Vector<Tracklet> mDuplets12;
124-
Array<Vector<int>, constants::its2::LayersNumberVertexer - 1> mNFoundDuplets;
124+
Array<Vector<int>, constants::its::LayersNumberVertexer - 1> mNFoundDuplets;
125125
Vector<int> mCUBTmpBuffer;
126126
Vector<float> mXYCentroids;
127127
Vector<float> mZCentroids;
@@ -140,7 +140,7 @@ inline std::vector<int> DeviceStoreVertexerGPU::getNFoundTrackletsFromGPU(const
140140
{
141141
// Careful: this might lead to large allocations, use debug-purpose only
142142
std::vector<int> sizes;
143-
sizes.resize(constants::its2::LayersNumberVertexer);
143+
sizes.resize(constants::its::LayersNumberVertexer);
144144
mSizes.copyIntoSizedVector(sizes);
145145
std::vector<int> nFoundDuplets;
146146
nFoundDuplets.resize(sizes[1]);
@@ -158,7 +158,7 @@ inline std::vector<Tracklet> DeviceStoreVertexerGPU::getRawDupletsFromGPU(const
158158
{
159159
// Careful: this might lead to large allocations, use debug-purpose only
160160
std::vector<int> sizes;
161-
sizes.resize(constants::its2::LayersNumberVertexer);
161+
sizes.resize(constants::its::LayersNumberVertexer);
162162
mSizes.copyIntoSizedVector(sizes);
163163
std::vector<Tracklet> tmpDuplets;
164164
tmpDuplets.resize(static_cast<size_t>(mGPUConf.dupletsCapacity));
@@ -180,7 +180,7 @@ inline std::vector<Tracklet> DeviceStoreVertexerGPU::getDupletsFromGPU(const Ord
180180
{
181181
// Careful: this might lead to large allocations, use debug-purpose only
182182
std::vector<int> sizes;
183-
sizes.resize(constants::its2::LayersNumberVertexer);
183+
sizes.resize(constants::its::LayersNumberVertexer);
184184
mSizes.copyIntoSizedVector(sizes);
185185
std::vector<Tracklet> tmpDuplets;
186186
tmpDuplets.resize(static_cast<size_t>(mGPUConf.dupletsCapacity));

Detectors/ITSMFT/ITS/tracking/cuda/src/TrackerTraitsNV.cu

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@
3333
#include "ITStrackingCUDA/Stream.h"
3434
#include "ITStrackingCUDA/Vector.h"
3535

36-
namespace
36+
namespace o2
37+
{
38+
namespace its
3739
{
40+
41+
using namespace constants::its2;
3842
GPU_DEVICE const int4 getBinsRect(const Cluster& currentCluster, const int layerIndex,
3943
const float z1, const float z2, float maxdeltaz, float maxdeltaphi)
4044
{
@@ -54,12 +58,7 @@ GPU_DEVICE const int4 getBinsRect(const Cluster& currentCluster, const int layer
5458
gpu::GPUCommonMath::Min(ZBins - 1, getZBinIndex(layerIndex + 1, zRangeMax)),
5559
getPhiBinIndex(phiRangeMax)};
5660
}
57-
} // namespace
5861

59-
namespace o2
60-
{
61-
namespace its
62-
{
6362
namespace GPU
6463
{
6564

Detectors/ITSMFT/ITS/tracking/cuda/src/VertexerTraitsGPU.cu

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,31 @@ namespace o2
3737
namespace its
3838
{
3939

40-
using constants::its2::getPhiBinIndex;
41-
using constants::its2::getZBinIndex;
42-
using constants::its2::LayersRCoordinate;
43-
using constants::its2::LayersZCoordinate;
44-
using constants::its2::PhiBins;
45-
using constants::its2::VertexerHistogramVolume;
46-
using constants::its2::ZBins;
40+
using constants::its::VertexerHistogramVolume;
4741
using constants::math::TwoPi;
4842
using math_utils::getNormalizedPhiCoordinate;
4943

44+
using namespace constants::its2;
45+
GPU_DEVICE const int4 getBinsRect(const Cluster& currentCluster, const int layerIndex,
46+
const float z1, const float z2, float maxdeltaz, float maxdeltaphi)
47+
{
48+
const float zRangeMin = gpu::GPUCommonMath::Min(z1, z2) - maxdeltaz;
49+
const float phiRangeMin = currentCluster.phiCoordinate - maxdeltaphi;
50+
const float zRangeMax = gpu::GPUCommonMath::Max(z1, z2) + maxdeltaz;
51+
const float phiRangeMax = currentCluster.phiCoordinate + maxdeltaphi;
52+
53+
if (zRangeMax < -LayersZCoordinate()[layerIndex + 1] ||
54+
zRangeMin > LayersZCoordinate()[layerIndex + 1] || zRangeMin > zRangeMax) {
55+
56+
return getEmptyBinsRect();
57+
}
58+
59+
return int4{gpu::GPUCommonMath::Max(0, getZBinIndex(layerIndex + 1, zRangeMin)),
60+
getPhiBinIndex(phiRangeMin),
61+
gpu::GPUCommonMath::Min(ZBins - 1, getZBinIndex(layerIndex + 1, zRangeMax)),
62+
getPhiBinIndex(phiRangeMax)};
63+
}
64+
5065
GPUh() void gpuThrowOnError()
5166
{
5267
cudaError_t error = cudaGetLastError();
@@ -82,7 +97,8 @@ void VertexerTraitsGPU::initialise(ROframe* event)
8297
{
8398
reset();
8499
arrangeClusters(event);
85-
mStoreVertexerGPUPtr = mStoreVertexerGPU.initialise(mClusters, mIndexTables);
100+
//TODO: restore this
101+
// mStoreVertexerGPUPtr = mStoreVertexerGPU.initialise(mClusters, mIndexTables);
86102
}
87103

88104
namespace GPU
@@ -147,7 +163,7 @@ GPUg() void trackleterKernel(
147163
const size_t stride{currentClusterIndex * store.getConfig().maxTrackletsPerCluster};
148164
const Cluster& currentCluster = store.getClusters()[1][currentClusterIndex]; // assign-constructor may be a problem, check
149165
const VertexerLayerName adjacentLayerIndex{layerOrder == TrackletingLayerOrder::fromInnermostToMiddleLayer ? VertexerLayerName::innermostLayer : VertexerLayerName::outerLayer};
150-
const int4 selectedBinsRect{VertexerTraits::getBinsRect(currentCluster, static_cast<int>(adjacentLayerIndex), 0.f, 50.f, phiCut / 2)};
166+
const int4 selectedBinsRect{getBinsRect(currentCluster, static_cast<int>(adjacentLayerIndex), 0.f, 50.f, phiCut / 2)};
151167
if (selectedBinsRect.x != 0 || selectedBinsRect.y != 0 || selectedBinsRect.z != 0 || selectedBinsRect.w != 0) {
152168
int phiBinsNum{selectedBinsRect.w - selectedBinsRect.y + 1};
153169
if (phiBinsNum < 0) {

0 commit comments

Comments
 (0)