Skip to content

Commit

Permalink
ITS-GPU: various fixes + separate vertexing kernels (AliceO2Group#13473)
Browse files Browse the repository at this point in the history
* Staging

* Move vertexer kernels away from the traits

* Fix GPU APIs compatibility

* Fix Hybrid interfaces for CPU

* Checkpoint work

* Unregister memory in sync and async when iteration == par.size()-1

* Fix USEMatCorrNONE case in gpu fit

* Update usage

* Make TrackingFrameInfo array const

* Update methods
  • Loading branch information
mconcas authored Sep 4, 2024
1 parent 5215528 commit 64c47f6
Show file tree
Hide file tree
Showing 12 changed files with 509 additions and 456 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ class GpuTimeFrameChunk
template <int nLayers = 7>
class TimeFrameGPU : public TimeFrame
{
public:
friend class GpuTimeFrameChunk<nLayers>;

public:
TimeFrameGPU();
~TimeFrameGPU();

Expand All @@ -185,7 +185,7 @@ class TimeFrameGPU : public TimeFrame
void unregisterHostMemory(const int);
void initialise(const int, const TrackingParameters&, const int, IndexTableUtils* utils = nullptr, const TimeFrameGPUParameters* pars = nullptr);
void initialiseHybrid(const int, const TrackingParameters&, const int, IndexTableUtils* utils = nullptr, const TimeFrameGPUParameters* pars = nullptr);
void initDevice(const int, IndexTableUtils*, const TrackingParameters& trkParam, const TimeFrameGPUParameters&, const int, const int);
void initDevice(IndexTableUtils*, const TrackingParameters& trkParam, const TimeFrameGPUParameters&, const int, const int);
void initDeviceSAFitting();
void loadTrackingFrameInfoDevice(const int);
void loadUnsortedClustersDevice();
Expand Down Expand Up @@ -227,7 +227,8 @@ class TimeFrameGPU : public TimeFrame
TrackITSExt* getDeviceTrackITSExt() { return mTrackITSExtDevice; }
gpuPair<int, int>* getDeviceNeighbours(const int layer) { return mNeighboursDevice[layer]; }
TrackingFrameInfo* getDeviceTrackingFrameInfo(const int);
TrackingFrameInfo** getDeviceArrayTrackingFrameInfo() { return mTrackingFrameInfoDeviceArray; }
// TrackingFrameInfo** getDeviceArrayTrackingFrameInfo() { return mTrackingFrameInfoDeviceArray; }
const TrackingFrameInfo** getDeviceArrayTrackingFrameInfo() const { return mTrackingFrameInfoDeviceArray; }
Cluster** getDeviceArrayClusters() const { return mClustersDeviceArray; }
Cluster** getDeviceArrayUnsortedClusters() const { return mUnsortedClustersDeviceArray; }
Tracklet** getDeviceArrayTracklets() const { return mTrackletsDeviceArray; }
Expand Down Expand Up @@ -275,7 +276,7 @@ class TimeFrameGPU : public TimeFrame
TrackITSExt* mTrackITSExtDevice;
std::array<gpuPair<int, int>*, nLayers - 2> mNeighboursDevice;
std::array<TrackingFrameInfo*, nLayers> mTrackingFrameInfoDevice;
TrackingFrameInfo** mTrackingFrameInfoDeviceArray;
const TrackingFrameInfo** mTrackingFrameInfoDeviceArray;

// State
std::vector<Stream> mGpuStreams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
#include "DetectorsBase/Propagator.h"
#include "GPUCommonDef.h"

namespace o2
{
namespace its
namespace o2::its
{
class CellSeed;
namespace gpu
Expand All @@ -40,9 +38,9 @@ GPUd() bool fitTrack(TrackITSExt& track,
template <int nLayers = 7>
GPUg() void fitTrackSeedsKernel(
CellSeed* trackSeeds,
TrackingFrameInfo** foundTrackingFrameInfo,
const TrackingFrameInfo** foundTrackingFrameInfo,
o2::its::TrackITSExt* tracks,
const size_t nSeeds,
const unsigned int nSeeds,
const float Bz,
const int startLevel,
float maxChi2ClusterAttachment,
Expand All @@ -53,15 +51,14 @@ GPUg() void fitTrackSeedsKernel(
} // namespace gpu

void trackSeedHandler(CellSeed* trackSeeds,
TrackingFrameInfo** foundTrackingFrameInfo,
const TrackingFrameInfo** foundTrackingFrameInfo,
o2::its::TrackITSExt* tracks,
const size_t nSeeds,
const unsigned int nSeeds,
const float Bz,
const int startLevel,
float maxChi2ClusterAttachment,
float maxChi2NDF,
const o2::base::Propagator* propagator,
const o2::base::PropagatorF::MatCorrType matCorrType);
} // namespace its
} // namespace o2
} // namespace o2::its
#endif // ITSTRACKINGGPU_TRACKINGKERNELS_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
///

#ifndef ITSTRACKINGGPU_VERTEXINGKERNELS_H_
#define ITSTRACKINGGPU_VERTEXINGKERNELS_H_
#include "ITStracking/MathUtils.h"
#include "ITStracking/Configuration.h"
#include "ITStracking/ClusterLines.h"
#include "ITStracking/Tracklet.h"

#include "ITStrackingGPU/Utils.h"
#include "ITStrackingGPU/ClusterLinesGPU.h"
#include "ITStrackingGPU/VertexerTraitsGPU.h"
#include "ITStrackingGPU/TracerGPU.h"

#include "GPUCommonArray.h"

namespace o2::its::gpu
{
#ifdef GPUCA_GPUCODE // GPUg() global kernels must only when compiled by GPU compiler
template <TrackletMode Mode>
GPUg() void trackleterKernelMultipleRof(
const Cluster* clustersNextLayer, // 0 2
const Cluster* clustersCurrentLayer, // 1 1
const int* sizeNextLClusters,
const int* sizeCurrentLClusters,
const int* nextIndexTables,
Tracklet* Tracklets,
int* foundTracklets,
const IndexTableUtils* utils,
const unsigned int startRofId,
const unsigned int rofSize,
const float phiCut,
const size_t maxTrackletsPerCluster);
#endif
template <TrackletMode Mode>
void trackletFinderHandler(const Cluster* clustersNextLayer, // 0 2
const Cluster* clustersCurrentLayer, // 1 1
const int* sizeNextLClusters,
const int* sizeCurrentLClusters,
const int* nextIndexTables,
Tracklet* Tracklets,
int* foundTracklets,
const IndexTableUtils* utils,
const unsigned int startRofId,
const unsigned int rofSize,
const float phiCut,
const size_t maxTrackletsPerCluster = 1e2);
} // namespace o2::its::gpu
#endif
3 changes: 2 additions & 1 deletion Detectors/ITSMFT/ITS/tracking/GPU/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ o2_add_library(ITStrackingCUDA
TimeFrameGPU.cu
TracerGPU.cu
TrackingKernels.cu
VertexerTraitsGPU.cu
VertexingKernels.cu
VertexerTraitsGPU.cxx
Utils.cu
PUBLIC_INCLUDE_DIRECTORIES ../
PUBLIC_LINK_LIBRARIES O2::ITStracking
Expand Down
Loading

0 comments on commit 64c47f6

Please sign in to comment.