CMS 3D CMS Logo

HelixFitOnGPU.h
Go to the documentation of this file.
1 #ifndef RecoPixelVertexing_PixelTriplets_plugins_HelixFitOnGPU_h
2 #define RecoPixelVertexing_PixelTriplets_plugins_HelixFitOnGPU_h
3 
7 
8 #include "CAConstants.h"
9 
10 namespace riemannFit {
11  // in case of memory issue can be made smaller
13  constexpr uint32_t stride = maxNumberOfConcurrentFits;
14  using Matrix3x4d = Eigen::Matrix<double, 3, 4>;
15  using Map3x4d = Eigen::Map<Matrix3x4d, 0, Eigen::Stride<3 * stride, stride> >;
16  using Matrix6x4f = Eigen::Matrix<float, 6, 4>;
17  using Map6x4f = Eigen::Map<Matrix6x4f, 0, Eigen::Stride<6 * stride, stride> >;
18 
19  // hits
20  template <int N>
21  using Matrix3xNd = Eigen::Matrix<double, 3, N>;
22  template <int N>
23  using Map3xNd = Eigen::Map<Matrix3xNd<N>, 0, Eigen::Stride<3 * stride, stride> >;
24  // errors
25  template <int N>
26  using Matrix6xNf = Eigen::Matrix<float, 6, N>;
27  template <int N>
28  using Map6xNf = Eigen::Map<Matrix6xNf<N>, 0, Eigen::Stride<6 * stride, stride> >;
29  // fast fit
30  using Map4d = Eigen::Map<Vector4d, 0, Eigen::InnerStride<stride> >;
31 
32 } // namespace riemannFit
33 
35 public:
37 
40 
42 
43  explicit HelixFitOnGPU(float bf, bool fit5as4) : bField_(bf), fit5as4_(fit5as4) {}
45 
46  void setBField(double bField) { bField_ = bField; }
47  void launchRiemannKernels(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream);
48  void launchBrokenLineKernels(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream);
49 
50  void launchRiemannKernelsOnCPU(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples);
51  void launchBrokenLineKernelsOnCPU(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples);
52 
53  void allocateOnGPU(Tuples const *tuples, TupleMultiplicity const *tupleMultiplicity, OutputSoA *outputSoA);
54  void deallocateOnGPU();
55 
56 private:
58 
59  // fowarded
60  Tuples const *tuples_ = nullptr;
63  float bField_;
64 
65  const bool fit5as4_;
66 };
67 
68 #endif // RecoPixelVertexing_PixelTriplets_plugins_HelixFitOnGPU_h
HelixFitOnGPU::allocateOnGPU
void allocateOnGPU(Tuples const *tuples, TupleMultiplicity const *tupleMultiplicity, OutputSoA *outputSoA)
Definition: HelixFitOnGPU.cc:4
HelixFitOnGPU::setBField
void setBField(double bField)
Definition: HelixFitOnGPU.h:46
riemannFit::Map6x4f
Eigen::Map< Matrix6x4f, 0, Eigen::Stride< 6 *stride, stride > > Map6x4f
Definition: HelixFitOnGPU.h:17
riemannFit::stride
constexpr uint32_t stride
Definition: HelixFitOnGPU.h:13
HelixFitOnGPU::HelixFitOnGPU
HelixFitOnGPU(float bf, bool fit5as4)
Definition: HelixFitOnGPU.h:43
TrackingRecHit2DHeterogeneous.h
riemannFit::Matrix6xNf
Eigen::Matrix< float, 6, N > Matrix6xNf
Definition: HelixFitOnGPU.h:26
HelixFitOnGPU::tuples_
const Tuples * tuples_
Definition: HelixFitOnGPU.h:60
HelixFitOnGPU::deallocateOnGPU
void deallocateOnGPU()
Definition: HelixFitOnGPU.cc:16
HelixFitOnGPU::HitsView
TrackingRecHit2DSOAView HitsView
Definition: HelixFitOnGPU.h:36
riemannFit::Matrix3x4d
Eigen::Matrix< double, 3, 4 > Matrix3x4d
Definition: HelixFitOnGPU.h:14
TrackingRecHit2DSOAView
Definition: TrackingRecHit2DSOAView.h:15
HelixFitOnGPU::launchRiemannKernelsOnCPU
void launchRiemannKernelsOnCPU(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples)
Definition: RiemannFitOnGPU.cc:3
caConstants::maxNumberOfTuples
constexpr uint32_t maxNumberOfTuples
Definition: CAConstants.h:35
riemannFit::maxNumberOfConcurrentFits
constexpr uint32_t maxNumberOfConcurrentFits
Definition: HelixFitOnGPU.h:12
caConstants::TupleMultiplicity
cms::cuda::OneToManyAssoc< tindex_type, 8, maxTuples > TupleMultiplicity
Definition: CAConstants.h:79
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
nhits
Definition: HIMultiTrackSelector.h:42
riemannFit::Matrix6x4f
Eigen::Matrix< float, 6, 4 > Matrix6x4f
Definition: HelixFitOnGPU.h:16
TrackSoAHeterogeneousT
Definition: TrackSoAHeterogeneousT.h:14
HelixFitOnGPU::launchRiemannKernels
void launchRiemannKernels(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream)
riemannFit::Map6xNf
Eigen::Map< Matrix6xNf< N >, 0, Eigen::Stride< 6 *stride, stride > > Map6xNf
Definition: HelixFitOnGPU.h:28
riemannFit::Matrix3xNd
Eigen::Matrix< double, 3, N > Matrix3xNd
Definition: FitResult.h:24
HelixFitOnGPU::~HelixFitOnGPU
~HelixFitOnGPU()
Definition: HelixFitOnGPU.h:44
HelixFitOnGPU::launchBrokenLineKernels
void launchBrokenLineKernels(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream)
HelixFitOnGPU::fit5as4_
const bool fit5as4_
Definition: HelixFitOnGPU.h:65
HelixFitOnGPU::bField_
float bField_
Definition: HelixFitOnGPU.h:63
HelixFitOnGPU::launchBrokenLineKernelsOnCPU
void launchBrokenLineKernelsOnCPU(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples)
Definition: BrokenLineFitOnGPU.cc:3
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:284
riemannFit::Map3xNd
Eigen::Map< Matrix3xNd< N >, 0, Eigen::Stride< 3 *stride, stride > > Map3xNd
Definition: HelixFitOnGPU.h:23
riemannFit
Definition: FitResult.h:11
PixelTrackHeterogeneous.h
pixelTrack::HitContainer
TrackSoA::HitContainer HitContainer
Definition: TrackSoAHeterogeneousT.h:69
pixelTrack::TrackSoA
TrackSoAHeterogeneousT< maxNumber()> TrackSoA
Definition: TrackSoAHeterogeneousT.h:67
cms::cuda::HistoContainer
Definition: HistoContainer.h:152
FitResult.h
CAConstants.h
riemannFit::Map3x4d
Eigen::Map< Matrix3x4d, 0, Eigen::Stride< 3 *stride, stride > > Map3x4d
Definition: HelixFitOnGPU.h:15
riemannFit::Map4d
Eigen::Map< Vector4d, 0, Eigen::InnerStride< stride > > Map4d
Definition: HelixFitOnGPU.h:30
HelixFitOnGPU::maxNumberOfConcurrentFits_
static constexpr uint32_t maxNumberOfConcurrentFits_
Definition: HelixFitOnGPU.h:57
HelixFitOnGPU
Definition: HelixFitOnGPU.h:34