Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions Detectors/ITSMFT/ITS/tracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

#add_compile_options(-O0 -g -fPIC -fno-omit-frame-pointer)
o2_add_library(ITStracking
TARGETVARNAME targetName
SOURCES src/ClusterLines.cxx
Expand All @@ -35,12 +36,8 @@ o2_add_library(ITStracking
O2::ITSBase
O2::ITSReconstruction
O2::ITSMFTReconstruction
O2::DataFormatsITS)

if (OpenMP_CXX_FOUND)
target_compile_definitions(${targetName} PRIVATE WITH_OPENMP)
target_link_libraries(${targetName} PRIVATE OpenMP::OpenMP_CXX)
endif()
O2::DataFormatsITS
PRIVATE_LINK_LIBRARIES TBB::tbb)

o2_add_library(ITSTrackingInterface
TARGETVARNAME targetName
Expand All @@ -50,11 +47,6 @@ o2_add_library(ITSTrackingInterface
O2::Framework
O2::GPUTracking)

if (OpenMP_CXX_FOUND)
target_compile_definitions(${targetName} PRIVATE WITH_OPENMP)
target_link_libraries(${targetName} PRIVATE OpenMP::OpenMP_CXX)
endif()

o2_target_root_dictionary(ITStracking
HEADERS include/ITStracking/ClusterLines.h
include/ITStracking/Tracklet.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifndef TRACKINGITSGPU_INCLUDE_TIMEFRAMEGPU_H
#define TRACKINGITSGPU_INCLUDE_TIMEFRAMEGPU_H

#include "ITStracking/BoundedAllocator.h"
#include "ITStracking/TimeFrame.h"
#include "ITStracking/Configuration.h"
#include "ITStrackingGPU/Utils.h"
Expand Down Expand Up @@ -62,7 +63,7 @@ class TimeFrameGPU : public TimeFrame<nLayers>
void loadTrackSeedsDevice();
void loadTrackSeedsChi2Device();
void loadRoadsDevice();
void loadTrackSeedsDevice(std::vector<CellSeed>&);
void loadTrackSeedsDevice(bounded_vector<CellSeed>&);
void createTrackletsBuffers();
void createCellsBuffers(const int);
void createCellsDevice();
Expand All @@ -72,10 +73,10 @@ class TimeFrameGPU : public TimeFrame<nLayers>
void createNeighboursDevice(const unsigned int layer, std::vector<std::pair<int, int>>& neighbours);
void createNeighboursLUTDevice(const int, const unsigned int);
void createNeighboursDeviceArray();
void createTrackITSExtDevice(std::vector<CellSeed>&);
void downloadTrackITSExtDevice(std::vector<CellSeed>&);
void downloadCellsNeighboursDevice(std::vector<std::vector<std::pair<int, int>>>&, const int);
void downloadNeighboursLUTDevice(std::vector<int>&, const int);
void createTrackITSExtDevice(bounded_vector<CellSeed>&);
void downloadTrackITSExtDevice(bounded_vector<CellSeed>&);
void downloadCellsNeighboursDevice(std::vector<bounded_vector<std::pair<int, int>>>&, const int);
void downloadNeighboursLUTDevice(bounded_vector<int>&, const int);
void downloadCellsDevice();
void downloadCellsLUTDevice();
void unregisterRest();
Expand All @@ -90,7 +91,7 @@ class TimeFrameGPU : public TimeFrame<nLayers>
int getNClustersInRofSpan(const int, const int, const int) const;
IndexTableUtils* getDeviceIndexTableUtils() { return mIndexTableUtilsDevice; }
int* getDeviceROFramesClusters(const int layer) { return mROFramesClustersDevice[layer]; }
std::vector<o2::its::TrackITSExt>& getTrackITSExt() { return mTrackITSExt; }
auto& getTrackITSExt() { return mTrackITSExt; }
Vertex* getDeviceVertices() { return mPrimaryVerticesDevice; }
int* getDeviceROFramesPV() { return mROFramesPVDevice; }
unsigned char* getDeviceUsedClusters(const int);
Expand Down Expand Up @@ -199,7 +200,7 @@ class TimeFrameGPU : public TimeFrame<nLayers>
bool mFirstInit = true;

// Temporary buffer for storing output tracks from GPU tracking
std::vector<TrackITSExt> mTrackITSExt;
bounded_vector<TrackITSExt> mTrackITSExt;
};

template <int nLayers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ void countTrackletsInROFsHandler(const IndexTableUtils* utils,
gsl::span<int*> trackletsLUTsHost,
const int iteration,
const float NSigmaCut,
std::vector<float>& phiCuts,
bounded_vector<float>& phiCuts,
const float resolutionPV,
std::array<float, nLayers>& minR,
std::array<float, nLayers>& maxR,
std::vector<float>& resolutions,
bounded_vector<float>& resolutions,
std::vector<float>& radii,
std::vector<float>& mulScatAng,
bounded_vector<float>& mulScatAng,
const int nBlocks,
const int nThreads);

Expand All @@ -104,13 +104,13 @@ void computeTrackletsInROFsHandler(const IndexTableUtils* utils,
gsl::span<int*> trackletsLUTsHost,
const int iteration,
const float NSigmaCut,
std::vector<float>& phiCuts,
bounded_vector<float>& phiCuts,
const float resolutionPV,
std::array<float, nLayers>& minR,
std::array<float, nLayers>& maxR,
std::vector<float>& resolutions,
bounded_vector<float>& resolutions,
std::vector<float>& radii,
std::vector<float>& mulScatAng,
bounded_vector<float>& mulScatAng,
const int nBlocks,
const int nThreads);

Expand Down Expand Up @@ -190,7 +190,7 @@ void processNeighboursHandler(const int startLayer,
std::array<int*, nLayers - 2>& neighbours,
gsl::span<int*> neighboursDeviceLUTs,
const TrackingFrameInfo** foundTrackingFrameInfo,
std::vector<CellSeed>& seedsHost,
bounded_vector<CellSeed>& seedsHost,
const float bz,
const float MaxChi2ClusterAttachment,
const float maxChi2NDF,
Expand Down
13 changes: 6 additions & 7 deletions Detectors/ITSMFT/ITS/tracking/GPU/cuda/TimeFrameGPU.cu
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void TimeFrameGPU<nLayers>::loadRoadsDevice()
}

template <int nLayers>
void TimeFrameGPU<nLayers>::loadTrackSeedsDevice(std::vector<CellSeed>& seeds)
void TimeFrameGPU<nLayers>::loadTrackSeedsDevice(bounded_vector<CellSeed>& seeds)
{
START_GPU_STREAM_TIMER(mGpuStreams[0]->get(), "loading track seeds");
LOGP(debug, "gpu-transfer: loading {} track seeds, for {} MB.", seeds.size(), seeds.size() * sizeof(CellSeed) / MB);
Expand Down Expand Up @@ -466,11 +466,10 @@ void TimeFrameGPU<nLayers>::createNeighboursDeviceArray()
}

template <int nLayers>
void TimeFrameGPU<nLayers>::createTrackITSExtDevice(std::vector<CellSeed>& seeds)
void TimeFrameGPU<nLayers>::createTrackITSExtDevice(bounded_vector<CellSeed>& seeds)
{
START_GPU_STREAM_TIMER(mGpuStreams[0]->get(), "reserving tracks");
mTrackITSExt.clear();
mTrackITSExt.resize(seeds.size());
mTrackITSExt = bounded_vector<TrackITSExt>(seeds.size(), {}, this->getMemoryPool().get());
LOGP(debug, "gpu-allocation: reserving {} tracks, for {} MB.", seeds.size(), seeds.size() * sizeof(o2::its::TrackITSExt) / MB);
allocMemAsync(reinterpret_cast<void**>(&mTrackITSExtDevice), seeds.size() * sizeof(o2::its::TrackITSExt), mGpuStreams[0], this->getExtAllocator());
GPUChkErrS(cudaMemsetAsync(mTrackITSExtDevice, 0, seeds.size() * sizeof(o2::its::TrackITSExt), mGpuStreams[0]->get()));
Expand Down Expand Up @@ -503,7 +502,7 @@ void TimeFrameGPU<nLayers>::downloadCellsLUTDevice()
}

template <int nLayers>
void TimeFrameGPU<nLayers>::downloadCellsNeighboursDevice(std::vector<std::vector<std::pair<int, int>>>& neighbours, const int layer)
void TimeFrameGPU<nLayers>::downloadCellsNeighboursDevice(std::vector<bounded_vector<std::pair<int, int>>>& neighbours, const int layer)
{
START_GPU_STREAM_TIMER(mGpuStreams[0]->get(), fmt::format("downloading neighbours from layer {}", layer));
LOGP(debug, "gpu-transfer: downloading {} neighbours, for {} MB.", neighbours[layer].size(), neighbours[layer].size() * sizeof(std::pair<int, int>) / MB);
Expand All @@ -512,7 +511,7 @@ void TimeFrameGPU<nLayers>::downloadCellsNeighboursDevice(std::vector<std::vecto
}

template <int nLayers>
void TimeFrameGPU<nLayers>::downloadNeighboursLUTDevice(std::vector<int>& lut, const int layer)
void TimeFrameGPU<nLayers>::downloadNeighboursLUTDevice(bounded_vector<int>& lut, const int layer)
{
START_GPU_STREAM_TIMER(mGpuStreams[0]->get(), fmt::format("downloading neighbours LUT from layer {}", layer));
LOGP(debug, "gpu-transfer: downloading neighbours LUT for {} elements on layer {}, for {} MB.", lut.size(), layer, lut.size() * sizeof(int) / MB);
Expand All @@ -521,7 +520,7 @@ void TimeFrameGPU<nLayers>::downloadNeighboursLUTDevice(std::vector<int>& lut, c
}

template <int nLayers>
void TimeFrameGPU<nLayers>::downloadTrackITSExtDevice(std::vector<CellSeed>& seeds)
void TimeFrameGPU<nLayers>::downloadTrackITSExtDevice(bounded_vector<CellSeed>& seeds)
{
START_GPU_STREAM_TIMER(mGpuStreams[0]->get(), "downloading tracks");
LOGP(debug, "gpu-transfer: downloading {} tracks, for {} MB.", mTrackITSExt.size(), mTrackITSExt.size() * sizeof(o2::its::TrackITSExt) / MB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
auto& conf = o2::its::ITSGpuTrackingParamConfig::Instance();
for (int startLevel{this->mTrkParams[iteration].CellsPerRoad()}; startLevel >= this->mTrkParams[iteration].CellMinimumLevel(); --startLevel) {
const int minimumLayer{startLevel - 1};
std::vector<CellSeed> trackSeeds;
bounded_vector<CellSeed> trackSeeds(this->getMemoryPool().get());
for (int startLayer{this->mTrkParams[iteration].CellsPerRoad() - 1}; startLayer >= minimumLayer; --startLayer) {
if ((this->mTrkParams[iteration].StartLayerMask & (1 << (startLayer + 2))) == 0) {
continue;
Expand Down
33 changes: 16 additions & 17 deletions Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -862,13 +862,13 @@ void countTrackletsInROFsHandler(const IndexTableUtils* utils,
gsl::span<int*> trackletsLUTsHost,
const int iteration,
const float NSigmaCut,
std::vector<float>& phiCuts,
bounded_vector<float>& phiCuts,
const float resolutionPV,
std::array<float, nLayers>& minRs,
std::array<float, nLayers>& maxRs,
std::vector<float>& resolutions,
bounded_vector<float>& resolutions,
std::vector<float>& radii,
std::vector<float>& mulScatAng,
bounded_vector<float>& mulScatAng,
const int nBlocks,
const int nThreads)
{
Expand Down Expand Up @@ -928,13 +928,13 @@ void computeTrackletsInROFsHandler(const IndexTableUtils* utils,
gsl::span<int*> trackletsLUTsHost,
const int iteration,
const float NSigmaCut,
std::vector<float>& phiCuts,
bounded_vector<float>& phiCuts,
const float resolutionPV,
std::array<float, nLayers>& minRs,
std::array<float, nLayers>& maxRs,
std::vector<float>& resolutions,
bounded_vector<float>& resolutions,
std::vector<float>& radii,
std::vector<float>& mulScatAng,
bounded_vector<float>& mulScatAng,
const int nBlocks,
const int nThreads)
{
Expand Down Expand Up @@ -1139,7 +1139,7 @@ void processNeighboursHandler(const int startLayer,
std::array<int*, nLayers - 2>& neighbours,
gsl::span<int*> neighboursDeviceLUTs,
const TrackingFrameInfo** foundTrackingFrameInfo,
std::vector<CellSeed>& seedsHost,
bounded_vector<CellSeed>& seedsHost,
const float bz,
const float maxChi2ClusterAttachment,
const float maxChi2NDF,
Expand Down Expand Up @@ -1257,9 +1257,8 @@ void processNeighboursHandler(const int startLayer,
thrust::device_vector<CellSeed> outSeeds(updatedCellSeed.size());
auto end = thrust::copy_if(updatedCellSeed.begin(), updatedCellSeed.end(), outSeeds.begin(), gpu::seed_selector(1.e3, maxChi2NDF * ((startLevel + 2) * 2 - 5)));
auto s{end - outSeeds.begin()};
std::vector<CellSeed> outSeedsHost(s);
thrust::copy(outSeeds.begin(), outSeeds.begin() + s, outSeedsHost.begin());
seedsHost.insert(seedsHost.end(), outSeedsHost.begin(), outSeedsHost.end());
seedsHost.reserve(seedsHost.size() + s);
thrust::copy(outSeeds.begin(), outSeeds.begin() + s, std::back_inserter(seedsHost));
}

void trackSeedHandler(CellSeed* trackSeeds,
Expand Down Expand Up @@ -1316,13 +1315,13 @@ template void countTrackletsInROFsHandler<7>(const IndexTableUtils* utils,
gsl::span<int*> trackletsLUTsHost,
const int iteration,
const float NSigmaCut,
std::vector<float>& phiCuts,
bounded_vector<float>& phiCuts,
const float resolutionPV,
std::array<float, 7>& minRs,
std::array<float, 7>& maxRs,
std::vector<float>& resolutions,
bounded_vector<float>& resolutions,
std::vector<float>& radii,
std::vector<float>& mulScatAng,
bounded_vector<float>& mulScatAng,
const int nBlocks,
const int nThreads);

Expand All @@ -1348,13 +1347,13 @@ template void computeTrackletsInROFsHandler<7>(const IndexTableUtils* utils,
gsl::span<int*> trackletsLUTsHost,
const int iteration,
const float NSigmaCut,
std::vector<float>& phiCuts,
bounded_vector<float>& phiCuts,
const float resolutionPV,
std::array<float, 7>& minRs,
std::array<float, 7>& maxRs,
std::vector<float>& resolutions,
bounded_vector<float>& resolutions,
std::vector<float>& radii,
std::vector<float>& mulScatAng,
bounded_vector<float>& mulScatAng,
const int nBlocks,
const int nThreads);

Expand All @@ -1367,7 +1366,7 @@ template void processNeighboursHandler<7>(const int startLayer,
std::array<int*, 5>& neighbours,
gsl::span<int*> neighboursDeviceLUTs,
const TrackingFrameInfo** foundTrackingFrameInfo,
std::vector<CellSeed>& seedsHost,
bounded_vector<CellSeed>& seedsHost,
const float bz,
const float maxChi2ClusterAttachment,
const float maxChi2NDF,
Expand Down
Loading