CMS 3D CMS Logo

SiPixelRecHits_cfi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
3 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
6 
7 # legacy pixel rechit producer
8 siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter",
9  src = cms.InputTag("siPixelClusters"),
10  CPE = cms.string('PixelCPEGeneric'),
11  VerboseLevel = cms.untracked.int32(0)
12 )
13 
14 # SwitchProducer wrapping the legacy pixel rechit producer
15 siPixelRecHitsPreSplitting = SwitchProducerCUDA(
16  cpu = siPixelRecHits.clone(
17  src = 'siPixelClustersPreSplitting'
18  )
19 )
20 
21 # phase 2 tracker modifier
22 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
23 # HIon modifiers
24 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
25 
26 # convert the pixel rechits from legacy to SoA format on CPU
27 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacyPhase1_cfi import siPixelRecHitSoAFromLegacyPhase1 as _siPixelRecHitsPreSplittingSoA
28 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacyPhase2_cfi import siPixelRecHitSoAFromLegacyPhase2 as _siPixelRecHitsPreSplittingSoAPhase2
29 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacyHIonPhase1_cfi import siPixelRecHitSoAFromLegacyHIonPhase1 as _siPixelRecHitsPreSplittingSoAHIonPhase1
30 
31 siPixelRecHitsPreSplittingCPU = _siPixelRecHitsPreSplittingSoA.clone(convertToLegacy=True)
32 (pp_on_AA & ~phase2_tracker).toReplaceWith(siPixelRecHitsPreSplittingCPU, _siPixelRecHitsPreSplittingSoAHIonPhase1.clone(convertToLegacy=True, CPE = cms.string('PixelCPEFastHIonPhase1')))
33 phase2_tracker.toReplaceWith(siPixelRecHitsPreSplittingCPU, _siPixelRecHitsPreSplittingSoAPhase2.clone(convertToLegacy=True, CPE = cms.string('PixelCPEFastPhase2')))
34 
35 # modifier used to prompt patatrack pixel tracks reconstruction on cpu
36 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
37 pixelNtupletFit.toModify(siPixelRecHitsPreSplitting,
38  cpu = cms.EDAlias(
39  siPixelRecHitsPreSplittingCPU = cms.VPSet(
40  cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
41  cms.PSet(type = cms.string("uintAsHostProduct"))
42  )
43 ))
44 
45 
46 siPixelRecHitsPreSplittingTask = cms.Task(
47  # SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
48  siPixelRecHitsPreSplitting
49 )
50 
51 # reconstruct the pixel rechits on the gpu
52 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDAPhase1_cfi import siPixelRecHitCUDAPhase1 as _siPixelRecHitCUDAPhase1
53 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDAPhase2_cfi import siPixelRecHitCUDAPhase2 as _siPixelRecHitCUDAPhase2
54 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDAHIonPhase1_cfi import siPixelRecHitCUDAHIonPhase1 as _siPixelRecHitCUDAHIonPhase1
55 
56 siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDAPhase1.clone(
57  beamSpot = "offlineBeamSpotToCUDA"
58 )
59 (pp_on_AA & ~phase2_tracker).toReplaceWith(siPixelRecHitsPreSplittingCUDA,_siPixelRecHitCUDAHIonPhase1.clone(
60  beamSpot = "offlineBeamSpotToCUDA"
61 ))
62 phase2_tracker.toReplaceWith(siPixelRecHitsPreSplittingCUDA,_siPixelRecHitCUDAPhase2.clone(
63  beamSpot = "offlineBeamSpotToCUDA"
64 ))
65 
66 #this is an alias for the SoA on GPU or CPU to be used for DQM
67 siPixelRecHitsPreSplittingSoA = SwitchProducerCUDA(
68  cpu = cms.EDAlias(
69  siPixelRecHitsPreSplittingCPU = cms.VPSet(
70  cms.PSet(type = cms.string("pixelTopologyPhase1TrackingRecHitSoAHost")),
71  cms.PSet(type = cms.string("uintAsHostProduct"))
72  )),
73 )
74 
75 (pp_on_AA & ~phase2_tracker).toModify(siPixelRecHitsPreSplittingSoA,
76  cpu = cms.EDAlias(
77  siPixelRecHitsPreSplittingCPU = cms.VPSet(
78  cms.PSet(type = cms.string("pixelTopologyHIonPhase1TrackingRecHitSoAHost")),
79  cms.PSet(type = cms.string("uintAsHostProduct"))
80  )))
81 
82 phase2_tracker.toModify(siPixelRecHitsPreSplittingSoA,
83  cpu = cms.EDAlias(
84  siPixelRecHitsPreSplittingCPU = cms.VPSet(
85  cms.PSet(type = cms.string("pixelTopologyPhase2TrackingRecHitSoAHost")),
86  cms.PSet(type = cms.string("uintAsHostProduct"))
87  )))
88 
89 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDAPhase1_cfi import siPixelRecHitSoAFromCUDAPhase1 as _siPixelRecHitSoAFromCUDA
90 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDAHIonPhase1_cfi import siPixelRecHitSoAFromCUDAHIonPhase1 as _siPixelRecHitSoAFromCUDAHIonPhase1
91 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDAPhase2_cfi import siPixelRecHitSoAFromCUDAPhase2 as _siPixelRecHitSoAFromCUDAPhase2
92 
93 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplittingSoA, cuda = _siPixelRecHitSoAFromCUDA.clone())
94 (gpu & pixelNtupletFit & phase2_tracker).toModify(siPixelRecHitsPreSplittingSoA, cuda = _siPixelRecHitSoAFromCUDAPhase2.clone())
95 
96 # transfer the pixel rechits to the host and convert them from SoA
97 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDAPhase1_cfi import siPixelRecHitFromCUDAPhase1 as _siPixelRecHitFromCUDA
98 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDAHIonPhase1_cfi import siPixelRecHitFromCUDAHIonPhase1 as _siPixelRecHitFromCUDAHIonPhase1
99 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDAPhase2_cfi import siPixelRecHitFromCUDAPhase2 as _siPixelRecHitFromCUDAPhase2
100 
101 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDA.clone())
102 (gpu & pixelNtupletFit & pp_on_AA).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDAHIonPhase1.clone())
103 (gpu & pixelNtupletFit & phase2_tracker).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDAPhase2.clone())
104 
105 
106 pixelNtupletFit.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
107  cms.Task(
108  # reconstruct the pixel rechits on the cpu
109  siPixelRecHitsPreSplittingCPU,
110  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
111  siPixelRecHitsPreSplittingTask.copy(),
112  # producing and converting on cpu (if needed)
113  siPixelRecHitsPreSplittingSoA)
114  )
115  )
116 
117 (gpu & pixelNtupletFit).toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
118  # reconstruct the pixel rechits on the gpu or on the cpu
119  # (normally only one of the two is run because only one is consumed from later stages)
120  siPixelRecHitsPreSplittingCUDA,
121  siPixelRecHitsPreSplittingCPU,
122  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
123  siPixelRecHitsPreSplittingTask.copy(),
124  # producing and converting on cpu (if needed)
125  siPixelRecHitsPreSplittingSoA
126 ))
127 
128 
129 
130 
131 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitAlpakaPhase1_cfi import siPixelRecHitAlpakaPhase1 as _siPixelRecHitAlpakaPhase1
132 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitAlpakaPhase2_cfi import siPixelRecHitAlpakaPhase2 as _siPixelRecHitAlpakaPhase2
133 
134 # Hit SoA producer on the device
135 siPixelRecHitsPreSplittingAlpaka = _siPixelRecHitAlpakaPhase1.clone(
136  src = "siPixelClustersPreSplittingAlpaka"
137 )
138 phase2_tracker.toReplaceWith(siPixelRecHitsPreSplittingAlpaka,_siPixelRecHitAlpakaPhase2.clone(
139  src = "siPixelClustersPreSplittingAlpaka"
140 ))
141 
142 # Hit SoA producer on the cpu, for validation
143 siPixelRecHitsPreSplittingAlpakaSerial = makeSerialClone(siPixelRecHitsPreSplittingAlpaka,
144  src = "siPixelClustersPreSplittingAlpakaSerial"
145 )
146 
147 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromSoAAlpakaPhase1_cfi import siPixelRecHitFromSoAAlpakaPhase1 as _siPixelRecHitFromSoAAlpakaPhase1
148 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromSoAAlpakaPhase2_cfi import siPixelRecHitFromSoAAlpakaPhase2 as _siPixelRecHitFromSoAAlpakaPhase2
149 
150 (alpaka & ~phase2_tracker).toModify(siPixelRecHitsPreSplitting,
151  cpu = _siPixelRecHitFromSoAAlpakaPhase1.clone(
152  pixelRecHitSrc = cms.InputTag('siPixelRecHitsPreSplittingAlpaka'),
153  src = cms.InputTag('siPixelClustersPreSplitting'))
154 )
155 
156 (alpaka & phase2_tracker).toModify(siPixelRecHitsPreSplitting,
157  cpu = _siPixelRecHitFromSoAAlpakaPhase2.clone(
158  pixelRecHitSrc = cms.InputTag('siPixelRecHitsPreSplittingAlpaka'),
159  src = cms.InputTag('siPixelClustersPreSplitting'))
160 )
161 
162 
163 alpaka.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
164  # Reconstruct the pixel hits with alpaka on the device
165  siPixelRecHitsPreSplittingAlpaka,
166  # Reconstruct the pixel hits with alpaka on the cpu (if requested by the validation)
167  siPixelRecHitsPreSplittingAlpakaSerial,
168  # Convert hit soa on host to legacy formats
169  siPixelRecHitsPreSplitting))
def makeSerialClone(module, kwargs)
Definition: functions.py:1