13#ifndef TRACKINGITSGPU_INCLUDE_TIMEFRAMEGPU_H
14#define TRACKINGITSGPU_INCLUDE_TIMEFRAMEGPU_H
37 static constexpr int MaxLinks = TrackingTopologyN::MaxLinks;
38 static constexpr int MaxCells = TrackingTopologyN::MaxCells;
39 static constexpr int MaxStreams = MaxCells > NLayers ? MaxCells : NLayers;
101 virtual
bool isGPU() const noexcept final {
return true; }
102 virtual const char*
getName() const noexcept override final {
return "GPU"; }
160 enum class SlotInit {
165 template <
typename T>
167 template <
typename T>
169 template <
typename SlotPtr>
170 SlotPtr* allocSlotArray(
size_t n);
171 template <
typename T>
172 void copyToDevice(T*
dst,
const T*
src,
size_t n);
173 template <
typename T>
174 void copyFromDevice(T*
dst,
const T*
src,
size_t n);
175 template <
typename T,
typename ArrayT>
176 void publishSlot(ArrayT deviceArray,
int slot, T*
const& devicePtr,
Stream&);
177 template <
typename T,
size_t N,
typename ArrayT>
179 template <
typename T,
size_t N,
typename ArrayT,
typename Container>
180 void uploadSlot(std::array<T*, N>& slots, ArrayT deviceArray,
int slot,
const Container& host,
const char* what);
181 template <
typename ArrayT,
typename T,
size_t N>
182 void createPinnedSlotArray(ArrayT& deviceArray, std::array<T*, N>& slots, std::bitset<NLayers + 1>& pinned);
183 template <
typename Layers>
184 void pinHostLayers(Layers& layers, std::bitset<NLayers + 1>& pinned,
int maxLayers);
185 template <
typename Table>
186 typename Table::View uploadNavigationTable(
const Table& table,
const typename Table::View& hostView);
189 std::array<int, MaxLinks> mNTracklets{};
190 std::array<int, MaxCells> mNCells{};
191 std::array<int, MaxCells> mNNeighbours{};
195 float* mIterationParametersDevice{
nullptr};
196 const float* mLayerRadiiDevice{
nullptr};
197 const float* mMinPtsDevice{
nullptr};
198 const float* mLayerxX0Device{
nullptr};
200 ROFOverlapTableN::View mDeviceROFOverlapTableView;
201 ROFVertexLookupTableN::View mDeviceROFVertexLookupTableView;
202 ROFMaskTableN::View mDeviceROFMaskTableView;
203 std::vector<typename TrackingTopologyN::View> mDeviceTrackerTopologyViews;
204 typename TrackingTopologyN::View mDeviceTrackingTopologyView;
207 Vertex* mPrimaryVerticesDevice{
nullptr};
208 std::array<Cluster*, NLayers> mClustersDevice{};
209 std::array<Cluster*, NLayers> mUnsortedClustersDevice{};
210 std::array<int*, NLayers> mClustersIndexTablesDevice{};
211 std::array<unsigned char*, NLayers> mUsedClustersDevice{};
212 std::array<int*, NLayers> mROFramesClustersDevice{};
213 const Cluster** mClustersDeviceArray{
nullptr};
214 const Cluster** mUnsortedClustersDeviceArray{
nullptr};
215 const int** mClustersIndexTablesDeviceArray{
nullptr};
216 uint8_t** mUsedClustersDeviceArray{
nullptr};
217 const int** mROFramesClustersDeviceArray{
nullptr};
218 std::array<Tracklet*, MaxLinks> mTrackletsDevice{};
219 std::array<int*, MaxLinks> mTrackletsLUTDevice{};
220 std::array<int*, MaxCells> mCellsLUTDevice{};
221 std::array<int*, MaxCells> mNeighboursLUTDevice{};
223 Tracklet** mTrackletsDeviceArray{
nullptr};
224 int** mCellsLUTDeviceArray{
nullptr};
225 int** mNeighboursCellLUTDeviceArray{
nullptr};
226 int** mTrackletsLUTDeviceArray{
nullptr};
227 std::array<CellSeed*, MaxCells> mCellsDevice{};
228 CellSeed** mCellsDeviceArray{
nullptr};
230 int* mTrackSeedIndicesDevice{
nullptr};
231 int* mTrackCounterDevice{
nullptr};
232 unsigned int mNTracks{0};
234 TrackITSExt* mTrackITSExtDevice{
nullptr};
235 int* mTrackIndicesDevice{
nullptr};
236 TrackExtensionHypothesis<NLayers>* mActiveTrackExtensionHypothesesDevice{
nullptr};
237 TrackExtensionHypothesis<NLayers>* mNextTrackExtensionHypothesesDevice{
nullptr};
238 std::array<CellNeighbour*, MaxCells> mNeighboursDevice{};
239 CellNeighbour** mNeighboursDeviceArray{
nullptr};
240 std::array<TrackingFrameInfo*, NLayers> mTrackingFrameInfoDevice{};
241 const TrackingFrameInfo** mTrackingFrameInfoDeviceArray{
nullptr};
245 std::bitset<NLayers + 1> mPinnedUnsortedClusters{0};
246 std::bitset<NLayers + 1> mPinnedClusters{0};
247 std::bitset<NLayers + 1> mPinnedClustersIndexTables{0};
248 std::bitset<NLayers + 1> mPinnedUsedClusters{0};
249 std::bitset<NLayers + 1> mPinnedROFramesClusters{0};
250 std::bitset<NLayers + 1> mPinnedTrackingFrameInfo{0};
253 bounded_vector<TrackITSExt> mTrackITSExt;
254 bounded_vector<int> mTrackIndices;
257template <
int NLayers>
260 std::vector<unsigned int>
sizes(this->mUnsortedClusters.size());
261 std::transform(this->mUnsortedClusters.begin(), this->mUnsortedClusters.end(),
sizes.begin(),
262 [](
const auto&
v) { return static_cast<unsigned int>(v.size()); });
266template <
int NLayers>
269 return std::accumulate(mNTracklets.begin(), mNTracklets.begin() + this->mTrackingTopologyView.nLinks, 0);
272template <
int NLayers>
275 return std::accumulate(mNCells.begin(), mNCells.begin() + this->mTrackingTopologyView.nCells, 0);
278template <
int NLayers>
281 return std::accumulate(mNNeighbours.begin(), mNNeighbours.begin() + this->mTrackingTopologyView.nCells, 0);
HMPID cluster implementation.
CellSeed: connections of three clusters.
gsl::span< Tracklet * > getDeviceTracklets()
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)
void loadROFOverlapTable()
void createCellsLUTDeviceArray()
TrackExtensionHypothesis< NLayers > * getDeviceActiveTrackExtensionHypotheses()
void pushMemoryStack(const int)
Most relevant operations.
void createROFrameClustersDeviceArray(const int=NLayers)
void loadTrackingTopologies()
const auto getDeviceROFOverlapTableView()
void loadClustersIndexTables(const int)
TrackITSExt * getDeviceTrackITSExt()
void unregisterHostMemory()
TrackSeedN * getDeviceTrackSeeds()
int * getDeviceTrackIndices()
void createTrackletsBuffers(const int, size_t capacity)
void initialise(const TrackingParameters &, int maxLayers, int iteration)
const auto getDeviceROFMaskTableView()
virtual void wipe() final
cleanup
void createTrackITSExtHost(const size_t nTracks)
size_t getNumberOfNeighbours() const final
void createTrackletsLUTDevice(bool, const int)
uint8_t ** getDeviceArrayUsedClusters() const
const int ** getDeviceArrayClustersIndexTables() const
const float * getDeviceMinPts() const
void createTrackExtensionScratchDevice(const int nThreads, const int maxHypotheses)
void recordEvent(const int)
int ** getDeviceArrayCellsLUT() const
auto getNTrackSeeds() const
CellSeed ** getDeviceArrayCells()
gsl::span< CellSeed * > getDeviceCells()
Vertex * getDeviceVertices()
int * getDeviceTrackCounter()
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()
~TimeFrameGPU() override=default
int * getDeviceNeighboursLUT(const int layer)
const int ** getDeviceROFrameClusters() const
void loadTrackingFrameInfoDevice(const int)
void loadClustersDevice(const int)
void createUnsortedClustersDeviceArray(const int=NLayers)
const auto getDeviceROFVertexLookupTableView()
Tracklet ** getDeviceArrayTracklets()
size_t getNumberOfCells() const final
auto & getStream(const size_t stream)
synchronization
void createTrackingFrameInfoDeviceArray(const int=NLayers)
void loadUnsortedClustersDevice(const int)
const float * getDeviceLayerxX0() const
void createTrackletsLUTDeviceArray()
void loadROFCutMask(const int)
void createClustersDeviceArray(const int=NLayers)
void createCellsLUTDevice(const int)
const Cluster ** getDeviceArrayUnsortedClusters() const
void loadIterationParameters(const TrackingParameters &)
CellNeighbour ** getDeviceArrayNeighbours()
CellNeighbour * getDeviceNeighbours(const int layer)
void createCellsBuffersArray()
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 createClustersIndexTablesArray(const int=NLayers)
int ** getDeviceArrayNeighboursCellLUT() const
const Cluster ** getDeviceArrayClusters() const
TrackExtensionHypothesis< NLayers > * getDeviceNextTrackExtensionHypotheses()
gsl::span< int > getNNeighbours()
const TrackingFrameInfo ** getDeviceArrayTrackingFrameInfo() const
IndexTableUtilsN * getDeviceIndexTableUtils()
void createNeighboursLUTDevice(const int, const unsigned int)
void loadROFVertexLookupTable()
void loadROFrameClustersDevice(const int)
void loadUsedClustersDevice()
void createUsedClustersDeviceArray(const int=NLayers)
gsl::span< int * > getDeviceCellLUTs()
void initialise(const TrackingParameters &, int maxLayers)
void createNeighboursDevice(const unsigned int layer, size_t capacity)
const float * getDeviceLayerRadii() const
void createTrackSeedsDevice(const size_t capacity)
gsl::span< int > getNTracklets()
void loadIndexTableUtils()
std::vector< unsigned int > getClusterSizes()
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
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
TrackingTopologyN::View mTrackingTopologyView
TrackingTopology< NLayers > TrackingTopologyN
ROFOverlapTable< NLayers > ROFOverlapTableN
ROFMaskTable< NLayers > ROFMaskTableN