13#ifndef TRACKINGITSGPU_INCLUDE_TIMEFRAMEGPU_H
14#define TRACKINGITSGPU_INCLUDE_TIMEFRAMEGPU_H
39 static constexpr int MaxLinks = TrackingTopologyN::MaxLinks;
40 static constexpr int MaxCells = TrackingTopologyN::MaxCells;
41 static constexpr int MaxStreams = MaxCells > NLayers ? MaxCells : NLayers;
121 virtual
bool isGPU() const noexcept final {
return true; }
122 virtual const char*
getName() const noexcept override final {
return "GPU"; }
183 const bounded_vector<o2::MCCompLabel>&
getLineLabelFlat()
const {
return mLineLabelFlatHost; }
228 enum class SlotInit {
233 template <
typename T>
235 template <
typename T>
237 template <
typename SlotPtr>
238 SlotPtr* allocSlotArray(
size_t n);
239 template <
typename T>
240 void copyToDevice(T*
dst,
const T*
src,
size_t n);
241 template <
typename T>
242 void copyFromDevice(T*
dst,
const T*
src,
size_t n);
243 template <
typename T,
typename ArrayT>
244 void publishSlot(ArrayT deviceArray,
int slot, T*
const& devicePtr,
Stream&);
245 template <
typename T,
size_t N,
typename ArrayT>
247 template <
typename T,
size_t N,
typename ArrayT,
typename Container>
248 void uploadSlot(std::array<T*, N>& slots, ArrayT deviceArray,
int slot,
const Container& host,
const char* what);
249 template <
typename ArrayT,
typename T,
size_t N>
250 void createPinnedSlotArray(ArrayT& deviceArray, std::array<T*, N>& slots, std::bitset<NLayers + 1>& pinned);
251 template <
typename Layers>
252 void pinHostLayers(Layers& layers, std::bitset<NLayers + 1>& pinned,
int maxLayers);
253 template <
typename Table>
254 typename Table::View uploadNavigationTable(
const Table& table,
const typename Table::View& hostView);
257 std::array<int, MaxLinks> mNTracklets{};
258 std::array<int, MaxCells> mNCells{};
259 std::array<int, MaxCells> mNNeighbours{};
263 float* mIterationParametersDevice{
nullptr};
264 const float* mLayerRadiiDevice{
nullptr};
265 const float* mMinPtsDevice{
nullptr};
266 const float* mLayerxX0Device{
nullptr};
268 ROFOverlapTableN::View mDeviceROFOverlapTableView;
269 ROFVertexLookupTableN::View mDeviceROFVertexLookupTableView;
270 ROFMaskTableN::View mDeviceROFMaskTableView;
271 std::vector<typename TrackingTopologyN::View> mDeviceTrackerTopologyViews;
272 typename TrackingTopologyN::View mDeviceTrackingTopologyView;
275 Vertex* mPrimaryVerticesDevice{
nullptr};
276 std::array<Cluster*, NLayers> mClustersDevice{};
277 std::array<Cluster*, NLayers> mUnsortedClustersDevice{};
278 std::array<int*, NLayers> mClustersIndexTablesDevice{};
279 std::array<unsigned char*, NLayers> mUsedClustersDevice{};
280 std::array<int*, NLayers> mROFramesClustersDevice{};
281 const Cluster** mClustersDeviceArray{
nullptr};
282 const Cluster** mUnsortedClustersDeviceArray{
nullptr};
283 const int** mClustersIndexTablesDeviceArray{
nullptr};
284 uint8_t** mUsedClustersDeviceArray{
nullptr};
285 const int** mROFramesClustersDeviceArray{
nullptr};
286 int* mROFramesPVDevice;
287 std::array<int*, NLayers> mClusterSortKeysDevice{};
288 std::array<int*, NLayers> mClusterSortPermDevice{};
289 float* mClusterMinRDevice{
nullptr};
290 float* mClusterMaxRDevice{
nullptr};
291 std::array<Tracklet*, MaxLinks> mTrackletsDevice{};
292 std::array<int*, MaxLinks> mTrackletsLUTDevice{};
293 std::array<int*, MaxCells> mCellsLUTDevice{};
294 std::array<int*, MaxCells> mNeighboursLUTDevice{};
296 Tracklet** mTrackletsDeviceArray{
nullptr};
297 int** mCellsLUTDeviceArray{
nullptr};
298 int** mNeighboursCellLUTDeviceArray{
nullptr};
299 int** mTrackletsLUTDeviceArray{
nullptr};
300 std::array<CellSeed*, MaxCells> mCellsDevice{};
301 CellSeed** mCellsDeviceArray{
nullptr};
303 int* mTrackSeedIndicesDevice{
nullptr};
304 int* mTrackCounterDevice{
nullptr};
305 unsigned int mNTracks{0};
307 TrackITSExt* mTrackITSExtDevice{
nullptr};
308 int* mTrackIndicesDevice{
nullptr};
309 TrackExtensionHypothesis<NLayers>* mActiveTrackExtensionHypothesesDevice{
nullptr};
310 TrackExtensionHypothesis<NLayers>* mNextTrackExtensionHypothesesDevice{
nullptr};
311 std::array<CellNeighbour*, MaxCells> mNeighboursDevice{};
312 CellNeighbour** mNeighboursDeviceArray{
nullptr};
313 std::array<TrackingFrameInfo*, NLayers> mTrackingFrameInfoDevice{};
314 const TrackingFrameInfo** mTrackingFrameInfoDeviceArray{
nullptr};
315 std::array<unsigned long long*, 3> mClusterOwnersDevice{};
316 unsigned long long** mClusterOwnersDeviceArray{
nullptr};
317 int* mLineSlotsDevice{
nullptr};
319 int* mLineRofDevice{
nullptr};
320 int* mLineClustersDevice{
nullptr};
321 float* mLineChi2Device{
nullptr};
322 float* mLinePtDevice{
nullptr};
323 float* mLineZsDevice{
nullptr};
325 float* mLineZsSortedDevice{
nullptr};
327 int* mLinesSortedIdx{
nullptr};
328 int* mLineRofSortedDevice{
nullptr};
329 int* mRofLineOffsetsDevice{
nullptr};
330 int* mLineDensityDevice{
nullptr};
332 uint8_t* mLineIsPeakDevice{
nullptr};
333 int* mLineDensityFineDevice{
nullptr};
335 uint8_t* mLineIsPeakFineDevice{
nullptr};
336 int* mPeakScanDevice{
nullptr};
337 int* mPeakLineIdxDevice{
nullptr};
338 int* mPeakOffsetsDevice{
nullptr};
339 VertexCand* mVertexCandsDevice{
nullptr};
340 int mNLinesCapacity{0};
341 bounded_vector<o2::its::Line> mLinesHost;
342 bounded_vector<int> mLineRofHost;
343 bounded_vector<int> mLineClustersHost;
344 bounded_vector<VertexCand> mVertexCandsHost;
345 bounded_vector<int> mPeakOffsetsHost;
346 bounded_vector<o2::MCCompLabel> mLineLabelFlatHost;
347 PeakMembershipHost mPeakMembershipHost;
348 Vertex* mDiamondDevice{
nullptr};
352 std::bitset<NLayers + 1> mPinnedUnsortedClusters{0};
353 std::bitset<NLayers + 1> mPinnedClusters{0};
354 std::bitset<NLayers + 1> mPinnedClustersIndexTables{0};
355 std::bitset<NLayers + 1> mPinnedUsedClusters{0};
356 std::bitset<NLayers + 1> mPinnedROFramesClusters{0};
357 std::bitset<NLayers + 1> mPinnedTrackingFrameInfo{0};
360 bounded_vector<TrackITSExt> mTrackITSExt;
361 bounded_vector<int> mTrackIndices;
364template <
int NLayers>
367 std::vector<unsigned int>
sizes(this->mUnsortedClusters.size());
368 std::transform(this->mUnsortedClusters.begin(), this->mUnsortedClusters.end(),
sizes.begin(),
369 [](
const auto&
v) { return static_cast<unsigned int>(v.size()); });
373template <
int NLayers>
376 return std::accumulate(mNTracklets.begin(), mNTracklets.begin() + this->mTrackingTopologyView.nLinks, 0);
379template <
int NLayers>
382 return std::accumulate(mNCells.begin(), mNCells.begin() + this->mTrackingTopologyView.nCells, 0);
385template <
int NLayers>
388 return std::accumulate(mNNeighbours.begin(), mNNeighbours.begin() + this->mTrackingTopologyView.nCells, 0);
small types shared by the host and device seeding vertexers, describing lines projected onto the beam...
HMPID cluster implementation.
CellSeed: connections of three clusters.
unsigned int downloadLinesDevice()
gsl::span< Tracklet * > getDeviceTracklets()
int * getDeviceClustersIndexTable(const int layer)
size_t getNumberOfTracklets() const final
virtual const char * getName() const noexcept override final
virtual bool isGPU() const noexcept final
interface
void downloadTrackITSExtDevice()
void createUsedClustersDevice(const int)
int * getDeviceROFramesClusters(const int layer)
void createClusterRadiiDevice()
void loadROFOverlapTable()
uint8_t * getDeviceLineIsPeak()
void prepareClusters(const TrackingParameters &trkParam, const int maxLayers) override
void createClustersIndexTables(const int)
int * getDevicePeakScan()
void createCellsLUTDeviceArray()
TrackExtensionHypothesis< NLayers > * getDeviceActiveTrackExtensionHypotheses()
const int * getDeviceNPeaks()
void pushMemoryStack(const int)
Most relevant operations.
int * getDeviceLineSlots()
int * getDeviceLineSortedIdx()
void createROFrameClustersDeviceArray(const int=NLayers)
const float * getDeviceMinRs() const
void loadTrackingTopologies()
int * getDeviceClusterSortPerm(const int layer)
const auto getDeviceROFOverlapTableView()
LineProjSoA getLineProjSoA()
void loadClustersIndexTables(const int)
TrackITSExt * getDeviceTrackITSExt()
void unregisterHostMemory()
TrackSeedN * getDeviceTrackSeeds()
int * getDeviceTrackIndices()
void createTrackletsBuffers(const int, size_t capacity)
void downloadPeakMembershipInputs()
void initialise(const TrackingParameters &, int maxLayers, int iteration)
float * getDeviceLinePt()
const auto & getHostLines() const
const auto getDeviceROFMaskTableView()
unsigned char * getDeviceUsedClusters(const int)
virtual void wipe() final
cleanup
void createTrackITSExtHost(const size_t nTracks)
size_t getNumberOfNeighbours() const final
void createTrackletsLUTDevice(bool, const int)
gpu::LineWindow * getDeviceLineWin()
uint8_t ** getDeviceArrayUsedClusters() const
const auto & getHostLineClusters() const
const int ** getDeviceArrayClustersIndexTables() const
const float * getDeviceMinPts() const
void createTrackExtensionScratchDevice(const int nThreads, const int maxHypotheses)
gpu::LineWindow * getDeviceLineWinFine()
void recordEvent(const int)
int ** getDeviceArrayCellsLUT() const
auto getNTrackSeeds() const
CellSeed ** getDeviceArrayCells()
gsl::span< CellSeed * > getDeviceCells()
Vertex * getDeviceVertices()
int * getDeviceTrackCounter()
o2::its::Line * getDeviceLines()
const auto getDeviceTrackingTopologyView() const
void waitEvent(const int, const int)
gsl::span< int * > getDeviceTrackletsLUTs()
void popMemoryStack(const int)
void createCellsBuffers(const int, size_t capacity)
void syncStreams(const bool=true)
void createTrackletsBuffersArray()
int * getDeviceTrackSeedIndices()
int * getDeviceLineClusters()
~TimeFrameGPU() override=default
int * getDeviceNeighboursLUT(const int layer)
const int ** getDeviceROFrameClusters() const
uint8_t * getDeviceLineIsPeakFine()
int * getDeviceROFramesPV()
int * getDeviceLineDensityFine()
VertexCand * getDeviceVertexCands()
void loadTrackingFrameInfoDevice(const int)
int * getDeviceLineDensity()
void createUnsortedClustersDeviceArray(const int=NLayers)
o2::its::TimeEstBC * getDeviceLineTimes()
const auto getDeviceROFVertexLookupTableView()
Tracklet ** getDeviceArrayTracklets()
void createClustersDevice(const int)
size_t getNumberOfCells() const final
float * getDeviceLineZs()
auto & getStream(const size_t stream)
synchronization
void createTrackingFrameInfoDeviceArray(const int=NLayers)
Cluster * getDeviceUnsortedClusters(const int layer)
LineProjSoA getLineProjSortedSoA()
const auto & getHostLineRof() const
const auto & getHostPeakOffsets() const
void loadUnsortedClustersDevice(const int)
void createDiamondDevice(const Vertex &diamond)
const float * getDeviceLayerxX0() const
Cluster * getDeviceClusters(const int layer)
void createTrackletsLUTDeviceArray()
void loadROFCutMask(const int)
void createClustersDeviceArray(const int=NLayers)
void createCellsLUTDevice(const int)
void sortClustersDevice(const int layer, const TrackingParameters &trkParam)
const Cluster ** getDeviceArrayUnsortedClusters() const
void uploadClusterRadii()
void loadIterationParameters(const TrackingParameters &)
int * getDeviceClusterSortKeys(const int layer)
CellNeighbour ** getDeviceArrayNeighbours()
CellNeighbour * getDeviceNeighbours(const int layer)
void createCellsBuffersArray()
void resetClusterOwnersDevice()
const auto & getHostPeakMembership() const
void uploadROFVertexLookupTable()
void setDevicePropagator(const o2::base::PropagatorImpl< float > *p) final
void createTrackITSExtDevice(const size_t capacity)
int ** getDeviceArrayTrackletsLUT() const
gsl::span< int > getNCells()
void createLinesDevice(const int nCells)
const float * getDeviceMaxRs() const
void createClustersIndexTablesArray(const int=NLayers)
int ** getDeviceArrayNeighboursCellLUT() const
const o2::base::Propagator * getChainPropagator()
int downloadVertexCandsDevice()
const Cluster ** getDeviceArrayClusters() const
TrackExtensionHypothesis< NLayers > * getDeviceNextTrackExtensionHypotheses()
int * getDevicePeakLineIdx()
void createClusterOwnersDevice()
gsl::span< int > getNNeighbours()
const TrackingFrameInfo ** getDeviceArrayTrackingFrameInfo() const
IndexTableUtilsN * getDeviceIndexTableUtils()
void createNeighboursLUTDevice(const int, const unsigned int)
Vertex * getDeviceDiamond()
void loadROFVertexLookupTable()
const auto & getHostVertexCands() const
float * getDeviceLineChi2()
void loadROFrameClustersDevice(const int)
void createClusterSortScratchDevice(const int layer)
void loadUsedClustersDevice()
std::array< CellNeighbour *, MaxCells > & getDeviceNeighboursAll()
unsigned long long ** getDeviceArrayClusterOwners()
void createUsedClustersDeviceArray(const int=NLayers)
gsl::span< int * > getDeviceCellLUTs()
int * getDeviceRofLineOffsets()
void initialise(const TrackingParameters &, int maxLayers)
void createNeighboursDevice(const unsigned int layer, size_t capacity)
void allocateClusterSortStorage(const TrackingParameters &trkParam, const int maxLayers) override
const float * getDeviceLayerRadii() const
void createTrackSeedsDevice(const size_t capacity)
bounded_vector< o2::MCCompLabel > & getLineLabelFlat()
int * getDevicePeakOffsets()
gsl::span< int > getNTracklets()
void loadIndexTableUtils()
void createClusterOwnersDeviceArray()
std::vector< unsigned int > getClusterSizes()
const bounded_vector< o2::MCCompLabel > & getLineLabelFlat() const
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
GLint GLint GLsizei GLint GLenum GLenum type
GLenum GLuint GLint GLint layer
uint8_t itsSharedClusterMap uint8_t
o2::its::LineWindow LineWindow
TrackExtensionHypothesis< NLayers > int const int maxHypotheses
o2::dataformats::Vertex< o2::its::TimeEstBC > Vertex
ROFVertexLookupTable< NLayers > ROFVertexLookupTableN
TrackSeed< NLayers > TrackSeedN
IndexTableUtils< NLayers > IndexTableUtilsN
const o2::base::PropagatorImpl< float > * mPropagatorDevice
int getNrof(int layer) const
TrackingTopologyN::View mTrackingTopologyView
TrackingTopology< NLayers > TrackingTopologyN
ROFOverlapTable< NLayers > ROFOverlapTableN
ROFMaskTable< NLayers > ROFMaskTableN