CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes | Static Private Attributes
HelixFitOnGPU Class Reference

#include <HelixFitOnGPU.h>

Public Types

using HitsView = TrackingRecHit2DSOAView
 
using OutputSoA = pixelTrack::TrackSoA
 
using TupleMultiplicity = caConstants::TupleMultiplicity
 
using Tuples = pixelTrack::HitContainer
 

Public Member Functions

void allocateOnGPU (Tuples const *tuples, TupleMultiplicity const *tupleMultiplicity, OutputSoA *outputSoA)
 
void deallocateOnGPU ()
 
 HelixFitOnGPU (float bf, bool fit5as4)
 
void launchBrokenLineKernels (HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream)
 
void launchBrokenLineKernelsOnCPU (HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples)
 
void launchRiemannKernels (HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream)
 
void launchRiemannKernelsOnCPU (HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples)
 
void setBField (double bField)
 
 ~HelixFitOnGPU ()
 

Private Attributes

float bField_
 
const bool fit5as4_
 
OutputSoAoutputSoa_
 
const TupleMultiplicitytupleMultiplicity_ = nullptr
 
const Tuplestuples_ = nullptr
 

Static Private Attributes

static constexpr uint32_t maxNumberOfConcurrentFits_ = riemannFit::maxNumberOfConcurrentFits
 

Detailed Description

Definition at line 34 of file HelixFitOnGPU.h.

Member Typedef Documentation

◆ HitsView

Definition at line 36 of file HelixFitOnGPU.h.

◆ OutputSoA

Definition at line 39 of file HelixFitOnGPU.h.

◆ TupleMultiplicity

Definition at line 41 of file HelixFitOnGPU.h.

◆ Tuples

Definition at line 38 of file HelixFitOnGPU.h.

Constructor & Destructor Documentation

◆ HelixFitOnGPU()

HelixFitOnGPU::HelixFitOnGPU ( float  bf,
bool  fit5as4 
)
inlineexplicit

Definition at line 43 of file HelixFitOnGPU.h.

43 : bField_(bf), fit5as4_(fit5as4) {}

◆ ~HelixFitOnGPU()

HelixFitOnGPU::~HelixFitOnGPU ( )
inline

Definition at line 44 of file HelixFitOnGPU.h.

44 { deallocateOnGPU(); }

References deallocateOnGPU().

Member Function Documentation

◆ allocateOnGPU()

void HelixFitOnGPU::allocateOnGPU ( Tuples const *  tuples,
TupleMultiplicity const *  tupleMultiplicity,
OutputSoA outputSoA 
)

◆ deallocateOnGPU()

void HelixFitOnGPU::deallocateOnGPU ( )

Definition at line 16 of file HelixFitOnGPU.cc.

16 {}

Referenced by ~HelixFitOnGPU().

◆ launchBrokenLineKernels()

void HelixFitOnGPU::launchBrokenLineKernels ( HitsView const *  hv,
uint32_t  nhits,
uint32_t  maxNumberOfTuples,
cudaStream_t  cudaStream 
)

◆ launchBrokenLineKernelsOnCPU()

void HelixFitOnGPU::launchBrokenLineKernelsOnCPU ( HitsView const *  hv,
uint32_t  nhits,
uint32_t  maxNumberOfTuples 
)

Definition at line 3 of file BrokenLineFitOnGPU.cc.

3  {
5 
6  // Fit internals
7  auto hitsGPU_ =
8  std::make_unique<double[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Matrix3xNd<4>) / sizeof(double));
9  auto hits_geGPU_ =
10  std::make_unique<float[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Matrix6x4f) / sizeof(float));
11  auto fast_fit_resultsGPU_ =
12  std::make_unique<double[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Vector4d) / sizeof(double));
13 
15  // fit triplets
16  kernel_BLFastFit<3>(
17  tuples_, tupleMultiplicity_, hv, hitsGPU_.get(), hits_geGPU_.get(), fast_fit_resultsGPU_.get(), 3, offset);
18 
19  kernel_BLFit<3>(tupleMultiplicity_,
20  bField_,
21  outputSoa_,
22  hitsGPU_.get(),
23  hits_geGPU_.get(),
24  fast_fit_resultsGPU_.get(),
25  3,
26  offset);
27 
28  // fit quads
29  kernel_BLFastFit<4>(
30  tuples_, tupleMultiplicity_, hv, hitsGPU_.get(), hits_geGPU_.get(), fast_fit_resultsGPU_.get(), 4, offset);
31 
32  kernel_BLFit<4>(tupleMultiplicity_,
33  bField_,
34  outputSoa_,
35  hitsGPU_.get(),
36  hits_geGPU_.get(),
37  fast_fit_resultsGPU_.get(),
38  4,
39  offset);
40 
41  if (fit5as4_) {
42  // fit penta (only first 4)
43  kernel_BLFastFit<4>(
44  tuples_, tupleMultiplicity_, hv, hitsGPU_.get(), hits_geGPU_.get(), fast_fit_resultsGPU_.get(), 5, offset);
45 
46  kernel_BLFit<4>(tupleMultiplicity_,
47  bField_,
48  outputSoa_,
49  hitsGPU_.get(),
50  hits_geGPU_.get(),
51  fast_fit_resultsGPU_.get(),
52  5,
53  offset);
54  } else {
55  // fit penta (all 5)
56  kernel_BLFastFit<5>(
57  tuples_, tupleMultiplicity_, hv, hitsGPU_.get(), hits_geGPU_.get(), fast_fit_resultsGPU_.get(), 5, offset);
58 
59  kernel_BLFit<5>(tupleMultiplicity_,
60  bField_,
61  outputSoa_,
62  hitsGPU_.get(),
63  hits_geGPU_.get(),
64  fast_fit_resultsGPU_.get(),
65  5,
66  offset);
67  }
68 
69  } // loop on concurrent fits
70 }

References cms::cuda::assert(), bField_, fit5as4_, maxNumberOfConcurrentFits_, caConstants::maxNumberOfTuples, hltrates_dqm_sourceclient-live_cfg::offset, outputSoa_, tupleMultiplicity_, and tuples_.

Referenced by CAHitNtupletGeneratorOnGPU::makeTuples().

◆ launchRiemannKernels()

void HelixFitOnGPU::launchRiemannKernels ( HitsView const *  hv,
uint32_t  nhits,
uint32_t  maxNumberOfTuples,
cudaStream_t  cudaStream 
)

◆ launchRiemannKernelsOnCPU()

void HelixFitOnGPU::launchRiemannKernelsOnCPU ( HitsView const *  hv,
uint32_t  nhits,
uint32_t  maxNumberOfTuples 
)

Definition at line 3 of file RiemannFitOnGPU.cc.

3  {
5 
6  // Fit internals
7  auto hitsGPU =
8  std::make_unique<double[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Matrix3xNd<4>) / sizeof(double));
9  auto hits_geGPU =
10  std::make_unique<float[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Matrix6x4f) / sizeof(float));
11  auto fast_fit_resultsGPU =
12  std::make_unique<double[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::Vector4d) / sizeof(double));
13  auto circle_fit_resultsGPU_holder =
14  std::make_unique<char[]>(maxNumberOfConcurrentFits_ * sizeof(riemannFit::CircleFit));
15  riemannFit::CircleFit *circle_fit_resultsGPU = (riemannFit::CircleFit *)(circle_fit_resultsGPU_holder.get());
16 
18  // triplets
19  kernel_FastFit<3>(
20  tuples_, tupleMultiplicity_, 3, hv, hitsGPU.get(), hits_geGPU.get(), fast_fit_resultsGPU.get(), offset);
21 
22  kernel_CircleFit<3>(tupleMultiplicity_,
23  3,
24  bField_,
25  hitsGPU.get(),
26  hits_geGPU.get(),
27  fast_fit_resultsGPU.get(),
28  circle_fit_resultsGPU,
29  offset);
30 
31  kernel_LineFit<3>(tupleMultiplicity_,
32  3,
33  bField_,
34  outputSoa_,
35  hitsGPU.get(),
36  hits_geGPU.get(),
37  fast_fit_resultsGPU.get(),
38  circle_fit_resultsGPU,
39  offset);
40 
41  // quads
42  kernel_FastFit<4>(
43  tuples_, tupleMultiplicity_, 4, hv, hitsGPU.get(), hits_geGPU.get(), fast_fit_resultsGPU.get(), offset);
44 
45  kernel_CircleFit<4>(tupleMultiplicity_,
46  4,
47  bField_,
48  hitsGPU.get(),
49  hits_geGPU.get(),
50  fast_fit_resultsGPU.get(),
51  circle_fit_resultsGPU,
52  offset);
53 
54  kernel_LineFit<4>(tupleMultiplicity_,
55  4,
56  bField_,
57  outputSoa_,
58  hitsGPU.get(),
59  hits_geGPU.get(),
60  fast_fit_resultsGPU.get(),
61  circle_fit_resultsGPU,
62  offset);
63 
64  if (fit5as4_) {
65  // penta
66  kernel_FastFit<4>(
67  tuples_, tupleMultiplicity_, 5, hv, hitsGPU.get(), hits_geGPU.get(), fast_fit_resultsGPU.get(), offset);
68 
69  kernel_CircleFit<4>(tupleMultiplicity_,
70  5,
71  bField_,
72  hitsGPU.get(),
73  hits_geGPU.get(),
74  fast_fit_resultsGPU.get(),
75  circle_fit_resultsGPU,
76  offset);
77 
78  kernel_LineFit<4>(tupleMultiplicity_,
79  5,
80  bField_,
81  outputSoa_,
82  hitsGPU.get(),
83  hits_geGPU.get(),
84  fast_fit_resultsGPU.get(),
85  circle_fit_resultsGPU,
86  offset);
87 
88  } else {
89  // penta all 5
90  kernel_FastFit<5>(
91  tuples_, tupleMultiplicity_, 5, hv, hitsGPU.get(), hits_geGPU.get(), fast_fit_resultsGPU.get(), offset);
92 
93  kernel_CircleFit<5>(tupleMultiplicity_,
94  5,
95  bField_,
96  hitsGPU.get(),
97  hits_geGPU.get(),
98  fast_fit_resultsGPU.get(),
99  circle_fit_resultsGPU,
100  offset);
101 
102  kernel_LineFit<5>(tupleMultiplicity_,
103  5,
104  bField_,
105  outputSoa_,
106  hitsGPU.get(),
107  hits_geGPU.get(),
108  fast_fit_resultsGPU.get(),
109  circle_fit_resultsGPU,
110  offset);
111  }
112  }
113 }

References cms::cuda::assert(), bField_, fit5as4_, maxNumberOfConcurrentFits_, caConstants::maxNumberOfTuples, hltrates_dqm_sourceclient-live_cfg::offset, outputSoa_, tupleMultiplicity_, and tuples_.

Referenced by CAHitNtupletGeneratorOnGPU::makeTuples().

◆ setBField()

void HelixFitOnGPU::setBField ( double  bField)
inline

Definition at line 46 of file HelixFitOnGPU.h.

46 { bField_ = bField; }

References Calorimetry_cff::bField, and bField_.

Member Data Documentation

◆ bField_

float HelixFitOnGPU::bField_
private

◆ fit5as4_

const bool HelixFitOnGPU::fit5as4_
private

Definition at line 65 of file HelixFitOnGPU.h.

Referenced by launchBrokenLineKernelsOnCPU(), and launchRiemannKernelsOnCPU().

◆ maxNumberOfConcurrentFits_

constexpr uint32_t HelixFitOnGPU::maxNumberOfConcurrentFits_ = riemannFit::maxNumberOfConcurrentFits
staticconstexprprivate

Definition at line 57 of file HelixFitOnGPU.h.

Referenced by launchBrokenLineKernelsOnCPU(), and launchRiemannKernelsOnCPU().

◆ outputSoa_

OutputSoA* HelixFitOnGPU::outputSoa_
private

◆ tupleMultiplicity_

const TupleMultiplicity* HelixFitOnGPU::tupleMultiplicity_ = nullptr
private

◆ tuples_

const Tuples* HelixFitOnGPU::tuples_ = nullptr
private
riemannFit::Vector4d
Eigen::Vector4d Vector4d
Definition: FitResult.h:15
HelixFitOnGPU::tuples_
const Tuples * tuples_
Definition: HelixFitOnGPU.h:60
HelixFitOnGPU::deallocateOnGPU
void deallocateOnGPU()
Definition: HelixFitOnGPU.cc:16
cms::cuda::assert
assert(be >=bs)
riemannFit::CircleFit
Definition: FitResult.h:26
caConstants::maxNumberOfTuples
constexpr uint32_t maxNumberOfTuples
Definition: CAConstants.h:35
tupleMultiplicity
const caConstants::TupleMultiplicity *__restrict__ tupleMultiplicity
Definition: BrokenLineFitOnGPU.h:27
HelixFitOnGPU::tupleMultiplicity_
const TupleMultiplicity * tupleMultiplicity_
Definition: HelixFitOnGPU.h:61
HelixFitOnGPU::outputSoa_
OutputSoA * outputSoa_
Definition: HelixFitOnGPU.h:62
riemannFit::Matrix6x4f
Eigen::Matrix< float, 6, 4 > Matrix6x4f
Definition: HelixFitOnGPU.h:16
riemannFit::Matrix3xNd
Eigen::Matrix< double, 3, N > Matrix3xNd
Definition: FitResult.h:24
HelixFitOnGPU::fit5as4_
const bool fit5as4_
Definition: HelixFitOnGPU.h:65
HelixFitOnGPU::bField_
float bField_
Definition: HelixFitOnGPU.h:63
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:284
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
HelixFitOnGPU::maxNumberOfConcurrentFits_
static constexpr uint32_t maxNumberOfConcurrentFits_
Definition: HelixFitOnGPU.h:57