forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCAHitQuadrupletGeneratorKernels.h
85 lines (59 loc) · 2.7 KB
/
CAHitQuadrupletGeneratorKernels.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef RecoPixelVertexing_PixelTriplets_plugins_CAHitQuadrupletGeneratorKernels_h
#define RecoPixelVertexing_PixelTriplets_plugins_CAHitQuadrupletGeneratorKernels_h
#include "RecoLocalTracker/SiPixelRecHits/plugins/siPixelRecHitsHeterogeneousProduct.h"
#include "RecoPixelVertexing/PixelTriplets/plugins/pixelTuplesHeterogeneousProduct.h"
#include "GPUCACell.h"
#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h"
#include "HeterogeneousCore/CUDAServices/interface/CUDAService.h"
class CAHitQuadrupletGeneratorKernels {
public:
// counters
struct Counters {
unsigned long long nEvents;
unsigned long long nHits;
unsigned long long nCells;
unsigned long long nTuples;
unsigned long long nGoodTracks;
unsigned long long nUsedHits;
unsigned long long nDupHits;
unsigned long long nKilledCells;
};
using HitsOnGPU = siPixelRecHitsHeterogeneousProduct::HitsOnGPU;
using HitsOnCPU = siPixelRecHitsHeterogeneousProduct::HitsOnCPU;
using TuplesOnGPU = pixelTuplesHeterogeneousProduct::TuplesOnGPU;
using HitToTuple = CAConstants::HitToTuple;
using TupleMultiplicity = CAConstants::TupleMultiplicity;
CAHitQuadrupletGeneratorKernels(uint32_t minHitsPerNtuplet,
bool earlyFishbone, bool lateFishbone,
bool idealConditions, bool doStats) :
minHitsPerNtuplet_(minHitsPerNtuplet),
earlyFishbone_(earlyFishbone),
lateFishbone_(lateFishbone),
idealConditions_(idealConditions),
doStats_(doStats){}
~CAHitQuadrupletGeneratorKernels() { deallocateOnGPU();}
TupleMultiplicity const * tupleMultiplicity() const { return device_tupleMultiplicity_;}
void launchKernels(HitsOnCPU const & hh, TuplesOnGPU & tuples_d, cudaStream_t cudaStream);
void classifyTuples(HitsOnCPU const & hh, TuplesOnGPU & tuples_d, cudaStream_t cudaStream);
void buildDoublets(HitsOnCPU const & hh, cuda::stream_t<>& stream);
void allocateOnGPU();
void deallocateOnGPU();
void cleanup(cudaStream_t cudaStream);
void printCounters() const;
private:
Counters * counters_ = nullptr;
// workspace
cudautils::device::unique_ptr<GPUCACell[]> device_theCells_;
GPUCACell::OuterHitOfCell* device_isOuterHitOfCell_ = nullptr;
uint32_t* device_nCells_ = nullptr;
HitToTuple * device_hitToTuple_ = nullptr;
AtomicPairCounter * device_hitToTuple_apc_ = nullptr;
TupleMultiplicity * device_tupleMultiplicity_ = nullptr;
uint8_t * device_tmws_ = nullptr;
const uint32_t minHitsPerNtuplet_;
const bool earlyFishbone_;
const bool lateFishbone_;
const bool idealConditions_;
const bool doStats_;
};
#endif // RecoPixelVertexing_PixelTriplets_plugins_CAHitQuadrupletGeneratorKernels_h