Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1ca9d90
Move TimeFrame initialisation to traits
mconcas May 10, 2022
17595aa
Improve debug prints with HIP
mconcas May 10, 2022
ad25ab2
Add timeframeGPU init in tracker
mconcas May 12, 2022
c9ece0b
Remove unused buffer
mconcas May 13, 2022
d25fa10
Add used clusters check
mconcas May 13, 2022
b135510
Cleanup TimeFrameGPU apis
mconcas May 16, 2022
4c47a1d
Improve TimeFrameGPU allocations
mconcas May 23, 2022
df5aa3e
Trackleting for L0 produces same indices
mconcas May 25, 2022
c0251bc
Delete stale files
mconcas May 25, 2022
adaa2b3
COmbinatorial part seems working
mconcas Jun 2, 2022
c71951a
Fix trackleting, works with HIP
mconcas Jun 20, 2022
cc8c7a5
Trackleting kernel works after rebase
mconcas Jun 22, 2022
b18ebf1
Checkpoint, investigating missing tracklets
mconcas Jun 23, 2022
243792f
Assess CPU-GPU found tracklets equality
mconcas Jun 27, 2022
aac9cbf
Add MC labels generation
mconcas Jun 29, 2022
1ca18e4
Fix sorting for HIP
mconcas Jun 30, 2022
e537c89
Add MC label creation again
mconcas Jun 30, 2022
91a5b7a
Improve API and add Cell finder kernel skeleton
mconcas Jul 1, 2022
4485680
Add Cell finder on GPU, to be validated
mconcas Jul 2, 2022
63a5c3a
Add Cell finder MClabel association, works on NVIDIA
mconcas Jul 3, 2022
aa63a79
Make Cell finder work with HIP
mconcas Jul 3, 2022
3a4c241
Fix IndexTable init for vertexer
mconcas Jul 7, 2022
45e68e6
Restore CPU and plug GPU vertexer to tracker
mconcas Jul 8, 2022
5299241
Use default streams for the moment
mconcas Jul 8, 2022
e51d4e6
Perform vertex fitting on CPU for consistency
mconcas Jul 8, 2022
f6ccef6
Move TimeFrame checks to traits
mconcas Jul 12, 2022
9e6c2e4
Add TF forwarding overrides
mconcas Jul 12, 2022
7f91349
Add comparison macro and fix bug in maxTracklets
mconcas Jul 25, 2022
a186688
Fix GPU vertexer
mconcas Jul 27, 2022
f07cc5b
Ultimate rebase
mconcas Jul 28, 2022
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
4 changes: 2 additions & 2 deletions Common/MathUtils/include/MathUtils/CartesianGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace detail
template <typename T, int I>
struct GPUPoint2D {
GPUdDefault() GPUPoint2D() = default;
GPUd() GPUPoint2D(T a, T b) : xx(a), yy(b) {}
GPUhd() GPUPoint2D(T a, T b) : xx(a), yy(b) {}
GPUhd() float X() const { return xx; }
GPUhd() float Y() const { return yy; }
GPUd() float R() const { return o2::gpu::CAMath::Sqrt(xx * xx + yy * yy); }
Expand All @@ -38,7 +38,7 @@ struct GPUPoint2D {
template <typename T, int I>
struct GPUPoint3D : public GPUPoint2D<T, I> {
GPUdDefault() GPUPoint3D() = default;
GPUd() GPUPoint3D(T a, T b, T c) : GPUPoint2D<T, I>(a, b), zz(c) {}
GPUhd() GPUPoint3D(T a, T b, T c) : GPUPoint2D<T, I>(a, b), zz(c) {}
GPUhd() float Z() const { return zz; }
GPUd() float R() const { return o2::gpu::CAMath::Sqrt(GPUPoint2D<T, I>::xx * GPUPoint2D<T, I>::xx + GPUPoint2D<T, I>::yy * GPUPoint2D<T, I>::yy + zz * zz); }
GPUd() void SetZ(float v) { zz = v; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class VertexBase
static constexpr int kNCov = 6;
GPUhdDefault() VertexBase() = default;
GPUhdDefault() ~VertexBase() = default;
GPUd() VertexBase(const math_utils::Point3D<float>& pos, const gpu::gpustd::array<float, kNCov>& cov) : mPos(pos), mCov(cov)
GPUhd() VertexBase(const math_utils::Point3D<float>& pos, const gpu::gpustd::array<float, kNCov>& cov) : mPos(pos), mCov(cov)
{
}

Expand Down Expand Up @@ -121,7 +121,7 @@ class Vertex : public VertexBase

GPUhdDefault() Vertex() = default;
GPUhdDefault() ~Vertex() = default;
GPUd() Vertex(const math_utils::Point3D<float>& pos, const gpu::gpustd::array<float, kNCov>& cov, ushort nCont, float chi2)
GPUhd() Vertex(const math_utils::Point3D<float>& pos, const gpu::gpustd::array<float, kNCov>& cov, ushort nCont, float chi2)
: VertexBase(pos, cov), mChi2(chi2), mNContributors(nCont)
{
}
Expand Down
7 changes: 3 additions & 4 deletions Detectors/ITSMFT/ITS/macros/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ o2_add_test_root_macro(CheckTracksCA.C
O2::DataFormatsITSMFT
LABELS its)

o2_add_test_root_macro(RunGPUTracking.C
PUBLIC_LINK_LIBRARIES O2::GPUTracking
LABELS its)

o2_add_test_root_macro(DisplayTrack.C
PUBLIC_LINK_LIBRARIES O2::ITSBase
O2::DataFormatsITSMFT
Expand All @@ -95,3 +91,6 @@ o2_add_test_root_macro(ITSMisaligner.C
PUBLIC_LINK_LIBRARIES O2::CCDB
O2::ITSReconstruction
LABELS its)

o2_add_test_root_macro(CompareArtefacts.C
LABELS its)
164 changes: 164 additions & 0 deletions Detectors/ITSMFT/ITS/macros/test/CompareArtefacts.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "TFile.h"
#include "TTree.h"
#include "TCanvas.h"
#include "TH1F.h"
#include "TLegend.h"
#include "TMath.h"
#include "TString.h"
#include "TStyle.h"

#include <string>
#include <vector>
#endif

using std::string;
using std::vector;

void CompareArtefacts(const string cpu_file = "artefacts_tf.root", const string gpu_file = "artefacts_tf_gpu.root")
{
gStyle->SetOptStat(0);

auto f_cpu = TFile::Open(cpu_file.data(), "r");
auto f_gpu = TFile::Open(gpu_file.data(), "r");

auto tree_cpu_tracklets = (TTree*)f_cpu->Get("tracklets");
auto tree_gpu_tracklets = (TTree*)f_gpu->Get("tracklets");

auto hist_cpu_tracklets0_phi = new TH1F("hist_cpu_tracklets0_phi", "hist_cpu_tracklets0_phi", 100, -TMath::Pi() - 1, TMath::Pi() + 1);
auto hist_gpu_tracklets0_phi = new TH1F("hist_gpu_tracklets0_phi", "hist_gpu_tracklets0_phi", 100, -TMath::Pi() - 1, TMath::Pi() + 1);
auto hist_cpu_tracklets0_tanL = new TH1F("hist_cpu_tracklets0_tanL", "hist_cpu_tracklets0_tanL", 100, -80, 80);
auto hist_gpu_tracklets0_tanL = new TH1F("hist_gpu_tracklets0_tanL", "hist_gpu_tracklets0_tanL", 100, -80, 80);
auto hist_cpu_tracklets0_firstClusterIndex = new TH1F("hist_cpu_tracklets0_firstClusterIndex", "hist_cpu_tracklets0_firstClusterIndex", 200, 0, 600);
auto hist_gpu_tracklets0_firstClusterIndex = new TH1F("hist_gpu_tracklets0_firstClusterIndex", "hist_gpu_tracklets0_firstClusterIndex", 200, 0, 600);

auto hist_cpu_tracklets1_phi = new TH1F("hist_cpu_tracklets1_phi", "hist_cpu_tracklets1_phi", 100, -TMath::Pi() - 1, TMath::Pi() + 1);
auto hist_gpu_tracklets1_phi = new TH1F("hist_gpu_tracklets1_phi", "hist_gpu_tracklets1_phi", 100, -TMath::Pi() - 1, TMath::Pi() + 1);
auto hist_cpu_tracklets1_tanL = new TH1F("hist_cpu_tracklets1_tanL", "hist_cpu_tracklets1_tanL", 100, -80, 80);
auto hist_gpu_tracklets1_tanL = new TH1F("hist_gpu_tracklets1_tanL", "hist_gpu_tracklets1_tanL", 100, -80, 80);
auto hist_cpu_tracklets1_firstClusterIndex = new TH1F("hist_cpu_tracklets1_firstClusterIndex", "hist_cpu_tracklets1_firstClusterIndex", 200, 0, 600);
auto hist_gpu_tracklets1_firstClusterIndex = new TH1F("hist_gpu_tracklets1_firstClusterIndex", "hist_gpu_tracklets1_firstClusterIndex", 200, 0, 600);

hist_cpu_tracklets0_phi->SetLineColor(kRed);
hist_gpu_tracklets0_phi->SetLineColor(kBlue);
hist_cpu_tracklets0_tanL->SetLineColor(kRed);
hist_gpu_tracklets0_tanL->SetLineColor(kBlue);
hist_cpu_tracklets0_firstClusterIndex->SetLineColor(kRed);
hist_gpu_tracklets0_firstClusterIndex->SetLineColor(kBlue);

hist_cpu_tracklets1_phi->SetLineColor(kRed);
hist_gpu_tracklets1_phi->SetLineColor(kBlue);
hist_cpu_tracklets1_tanL->SetLineColor(kRed);
hist_gpu_tracklets1_tanL->SetLineColor(kBlue);
hist_cpu_tracklets1_firstClusterIndex->SetLineColor(kRed);
hist_gpu_tracklets1_firstClusterIndex->SetLineColor(kBlue);

auto c1 = new TCanvas("c1", "c1", 800, 800);
c1->cd();

tree_cpu_tracklets->Draw("Tracklets0.phi >> hist_cpu_tracklets0_phi");
tree_gpu_tracklets->Draw("Tracklets0.phi >> hist_gpu_tracklets0_phi");

hist_gpu_tracklets0_phi->Draw();
hist_cpu_tracklets0_phi->Draw("same");

auto legend = new TLegend(0.4, 0.4, 0.2, 0.2);
legend->SetHeader("Tracklets0 #varphi", "C");
legend->AddEntry(hist_cpu_tracklets0_phi, Form("CPU: %1.f", hist_cpu_tracklets0_phi->GetEntries()), "l");
legend->AddEntry(hist_gpu_tracklets0_phi, Form("GPU: %1.f", hist_gpu_tracklets0_phi->GetEntries()), "l");

legend->Draw();

// // Tan(L)
auto c2 = new TCanvas("c2", "c2", 800, 800);
c2->cd();

tree_cpu_tracklets->Draw("Tracklets0.tanLambda >> hist_cpu_tracklets0_tanL");
tree_gpu_tracklets->Draw("Tracklets0.tanLambda >> hist_gpu_tracklets0_tanL");

hist_gpu_tracklets0_tanL->Draw();
hist_cpu_tracklets0_tanL->Draw("same");

auto legend2 = new TLegend(0.4, 0.4, 0.2, 0.2);
legend2->SetHeader("Tracklets0 tan(#lambda)", "C");
legend2->AddEntry(hist_cpu_tracklets0_tanL, Form("CPU: %1.f", hist_cpu_tracklets0_tanL->GetEntries()), "l");
legend2->AddEntry(hist_gpu_tracklets0_tanL, Form("GPU: %1.f", hist_gpu_tracklets0_tanL->GetEntries()), "l");

legend2->Draw();

// first cluster index
auto c3 = new TCanvas("c3", "c3", 800, 800);
c3->cd();

tree_cpu_tracklets->Draw("Tracklets0.firstClusterIndex >> hist_cpu_tracklets0_firstClusterIndex");
tree_gpu_tracklets->Draw("Tracklets0.firstClusterIndex >> hist_gpu_tracklets0_firstClusterIndex");
auto hist_cpu_tracklets0_firstClusterIndex_clone = (TH1F*)hist_cpu_tracklets0_firstClusterIndex->Clone("hist_cpu_tracklets0_firstClusterIndex_clone");
hist_cpu_tracklets0_firstClusterIndex_clone->Add(hist_gpu_tracklets0_firstClusterIndex, -1);
hist_cpu_tracklets0_firstClusterIndex_clone->SetLineColor(kBlack);

hist_gpu_tracklets0_firstClusterIndex->Draw();
hist_cpu_tracklets0_firstClusterIndex->Draw("same");
hist_cpu_tracklets0_firstClusterIndex_clone->Draw("same");

auto legend3 = new TLegend(0.4, 0.4, 0.2, 0.2);
legend3->SetHeader("Tracklets0 first cluster index", "C");
legend3->AddEntry(hist_cpu_tracklets0_firstClusterIndex, Form("CPU: %1.f", hist_cpu_tracklets0_firstClusterIndex->GetEntries()), "l");
legend3->AddEntry(hist_gpu_tracklets0_firstClusterIndex, Form("GPU: %1.f", hist_gpu_tracklets0_firstClusterIndex->GetEntries()), "l");

legend3->Draw();

// // Tracklets1
auto c4 = new TCanvas("c4", "c4", 800, 800);
c4->cd();

tree_cpu_tracklets->Draw("Tracklets1.phi >> hist_cpu_tracklets1_phi");
tree_gpu_tracklets->Draw("Tracklets1.phi >> hist_gpu_tracklets1_phi");

hist_cpu_tracklets1_phi->Draw();
hist_gpu_tracklets1_phi->Draw("same");

auto legend4 = new TLegend(0.4, 0.4, 0.2, 0.2);
legend4->SetHeader("Tracklets1 #varphi", "C");
legend4->AddEntry(hist_cpu_tracklets1_phi, Form("CPU: %1.f", hist_cpu_tracklets1_phi->GetEntries()), "l");
legend4->AddEntry(hist_gpu_tracklets1_phi, Form("GPU: %1.f", hist_gpu_tracklets1_phi->GetEntries()), "l");

legend4->Draw();

// // Tan(L)
auto c5 = new TCanvas("c5", "c5", 800, 800);
c5->cd();

tree_cpu_tracklets->Draw("Tracklets1.tanLambda >> hist_cpu_tracklets1_tanL");
tree_gpu_tracklets->Draw("Tracklets1.tanLambda >> hist_gpu_tracklets1_tanL");

hist_cpu_tracklets1_tanL->Draw();
hist_gpu_tracklets1_tanL->Draw("same");

auto legend5 = new TLegend(0.4, 0.4, 0.2, 0.2);
legend5->SetHeader("Tracklets1 tan(#lambda)", "C");
legend5->AddEntry(hist_cpu_tracklets1_tanL, Form("CPU: %1.f", hist_cpu_tracklets1_tanL->GetEntries()), "l");
legend5->AddEntry(hist_gpu_tracklets1_tanL, Form("GPU: %1.f", hist_gpu_tracklets1_tanL->GetEntries()), "l");

legend5->Draw();

// first cluster index
auto c6 = new TCanvas("c6", "c6", 800, 800);
c6->cd();

tree_cpu_tracklets->Draw("Tracklets1.firstClusterIndex >> hist_cpu_tracklets1_firstClusterIndex");
tree_gpu_tracklets->Draw("Tracklets1.firstClusterIndex >> hist_gpu_tracklets1_firstClusterIndex");
auto hist_cpu_tracklets1_firstClusterIndex_clone = (TH1F*)hist_cpu_tracklets1_firstClusterIndex->Clone("hist_cpu_tracklets1_firstClusterIndex_clone");
hist_cpu_tracklets1_firstClusterIndex_clone->Add(hist_gpu_tracklets1_firstClusterIndex, -1);
hist_cpu_tracklets1_firstClusterIndex_clone->SetLineColor(kBlack);

hist_cpu_tracklets1_firstClusterIndex->Draw();
hist_gpu_tracklets1_firstClusterIndex->Draw("same");
hist_cpu_tracklets1_firstClusterIndex_clone->Draw("same");
auto legend6 = new TLegend(0.4, 0.4, 0.2, 0.2);

legend6->SetHeader("Tracklets1 first cluster index", "C");
legend6->AddEntry(hist_cpu_tracklets1_firstClusterIndex, Form("CPU: %1.f", hist_cpu_tracklets1_firstClusterIndex->GetEntries()), "l");
legend6->AddEntry(hist_gpu_tracklets1_firstClusterIndex, Form("GPU: %1.f", hist_gpu_tracklets1_firstClusterIndex->GetEntries()), "l");

legend6->Draw();
}
Loading