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 fitNas4) : bField_(bf), fitNas4_(fitNas4) {}
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 
54  void deallocateOnGPU();
55 
56 private:
58 
59  // fowarded
60  Tuples const *tuples_ = nullptr;
63  float bField_;
64 
65  const bool fitNas4_;
66 };
67 
68 #endif // RecoPixelVertexing_PixelTriplets_plugins_HelixFitOnGPU_h
void setBField(double bField)
Definition: HelixFitOnGPU.h:46
void launchBrokenLineKernelsOnCPU(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples)
caConstants::TupleMultiplicity const *__restrict__ tupleMultiplicity
const bool fitNas4_
Definition: HelixFitOnGPU.h:65
static constexpr uint32_t maxNumberOfConcurrentFits_
Definition: HelixFitOnGPU.h:57
TrackingRecHit2DSOAView HitsView
Definition: HelixFitOnGPU.h:36
TupleMultiplicity const * tupleMultiplicity_
Definition: HelixFitOnGPU.h:61
constexpr uint32_t stride
Definition: HelixFitOnGPU.h:13
Eigen::Matrix< float, 6, 4 > Matrix6x4f
Definition: HelixFitOnGPU.h:16
Eigen::Matrix< float, 6, N > Matrix6xNf
Definition: HelixFitOnGPU.h:26
HitContainer const *__restrict__ tuples
Eigen::Map< Matrix3xNd< N >, 0, Eigen::Stride< 3 *stride, stride > > Map3xNd
Definition: HelixFitOnGPU.h:23
constexpr uint32_t maxNumberOfTuples
Definition: CAConstants.h:36
Eigen::Map< Matrix6x4f, 0, Eigen::Stride< 6 *stride, stride > > Map6x4f
Definition: HelixFitOnGPU.h:17
TrackSoA::HitContainer HitContainer
Eigen::Matrix< double, 3, N > Matrix3xNd
Definition: FitResult.h:24
TrackSoAHeterogeneousT< maxNumber()> TrackSoA
Eigen::Map< Matrix6xNf< N >, 0, Eigen::Stride< 6 *stride, stride > > Map6xNf
Definition: HelixFitOnGPU.h:28
OutputSoA * outputSoa_
Definition: HelixFitOnGPU.h:62
void launchRiemannKernelsOnCPU(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples)
void launchRiemannKernels(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream)
HelixFitOnGPU(float bf, bool fitNas4)
Definition: HelixFitOnGPU.h:43
void launchBrokenLineKernels(HitsView const *hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream)
Eigen::Map< Vector4d, 0, Eigen::InnerStride< stride > > Map4d
Definition: HelixFitOnGPU.h:30
void allocateOnGPU(Tuples const *tuples, TupleMultiplicity const *tupleMultiplicity, OutputSoA *outputSoA)
Definition: HelixFitOnGPU.cc:4
Tuples const * tuples_
Definition: HelixFitOnGPU.h:60
Eigen::Map< Matrix3x4d, 0, Eigen::Stride< 3 *stride, stride > > Map3x4d
Definition: HelixFitOnGPU.h:15
Eigen::Matrix< double, 3, 4 > Matrix3x4d
Definition: HelixFitOnGPU.h:14
cms::cuda::OneToManyAssoc< tindex_type, maxHitsOnTrack+1, maxTuples > TupleMultiplicity
Definition: CAConstants.h:80
void deallocateOnGPU()
constexpr uint32_t maxNumberOfConcurrentFits
Definition: HelixFitOnGPU.h:12