Skip to content

Commit

Permalink
Backport of PR 37798
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianoDee committed May 12, 2022
1 parent 535df23 commit 604f84e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
from DQM.SiPixelPhase1Heterogeneous.siPixelPhase1MonitorVertexSoA_cfi import *
from DQM.SiPixelPhase1Heterogeneous.siPixelPhase1MonitorRecHitsSoA_cfi import *

from Configuration.ProcessModifiers.gpu_cff import gpu
gpu.toModify(siPixelPhase1MonitorRecHitsSoA, pixelHitsSrc = "siPixelRecHitsPreSplittingSoA")

from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
pixelNtupletFit.toModify(siPixelPhase1MonitorRecHitsSoA, pixelHitsSrc = "siPixelRecHitsPreSplittingSoA")

monitorpixelSoASource = cms.Sequence(siPixelPhase1MonitorRecHitsSoA * siPixelPhase1MonitorTrackSoA * siPixelPhase1MonitorVertexSoA)


#Define the sequence for GPU vs CPU validation
#This should run:- individual monitor for the 2 collections + comparison module
from DQM.SiPixelPhase1Heterogeneous.siPixelPhase1CompareTrackSoA_cfi import *
Expand All @@ -35,8 +33,19 @@
topFolderName = 'SiPixelHeterogeneous/PixelVertexSoAGPU',
)

siPixelPhase1MonitorRecHitsSoACPU = siPixelPhase1MonitorRecHitsSoA.clone(
pixelHitsSrc = "siPixelRecHitsPreSplittingSoA@cpu",
TopFolderName = "SiPixelHeterogeneous/PixelRecHitsSoACPU"
)

siPixelPhase1MonitorRecHitsSoAGPU = siPixelPhase1MonitorRecHitsSoA.clone(
pixelHitsSrc = "siPixelRecHitsPreSplittingSoA@cuda",
TopFolderName = "SiPixelHeterogeneous/PixelRecHitsSoAGPU"
)

monitorpixelSoACompareSource = cms.Sequence(siPixelPhase1MonitorTrackSoAGPU *
monitorpixelSoACompareSource = cms.Sequence(siPixelPhase1MonitorRecHitsSoACPU *
siPixelPhase1MonitorRecHitsSoAGPU *
siPixelPhase1MonitorTrackSoAGPU *
siPixelPhase1MonitorTrackSoACPU *
siPixelPhase1CompareTrackSoA *
siPixelPhase1MonitorVertexSoACPU *
Expand Down
33 changes: 22 additions & 11 deletions RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@
from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
phase2_tracker.toModify(siPixelRecHitsPreSplittingCPU,
isPhase2 = True)

# modifier used to prompt patatrack pixel tracks reconstruction on cpu
from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
pixelNtupletFit.toModify(siPixelRecHitsPreSplitting,
cpu = _siPixelRecHitsPreSplittingSoA.clone(convertToLegacy=True)
)
cpu = cms.EDAlias(
siPixelRecHitsPreSplittingCPU = cms.VPSet(
cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
cms.PSet(type = cms.string("uintAsHostProduct"))
)
))


siPixelRecHitsPreSplittingTask = cms.Task(
# SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
Expand All @@ -58,17 +64,22 @@
cms.PSet(type = cms.string("cmscudacompatCPUTraitsTrackingRecHit2DHeterogeneous")),
cms.PSet(type = cms.string("uintAsHostProduct"))
)),
cuda = _siPixelRecHitSoAFromCUDA.clone()
)

(gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting,
cpu = cms.EDAlias(
siPixelRecHitsPreSplittingCPU = cms.VPSet(
cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
cms.PSet(type = cms.string("uintAsHostProduct"))
)
),
cuda = _siPixelRecHitFromCUDA.clone())
(gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplittingSoA,cuda = _siPixelRecHitSoAFromCUDA.clone())

(gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDA.clone())

pixelNtupletFit.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
cms.Task(
# reconstruct the pixel rechits on the cpu
siPixelRecHitsPreSplittingCPU,
# SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
siPixelRecHitsPreSplittingTask.copy(),
# producing and converting on cpu (if needed)
siPixelRecHitsPreSplittingSoA)
)
)

(gpu & pixelNtupletFit).toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
# reconstruct the pixel rechits on the gpu or on the cpu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
pixelTracksSoA = SwitchProducerCUDA(
# build pixel ntuplets and pixel tracks in SoA format on the CPU
cpu = _pixelTracksCUDA.clone(
pixelRecHitSrc = "siPixelRecHitsPreSplitting",
pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA",
idealConditions = False,
onGPU = False
)
Expand All @@ -124,9 +124,6 @@
# "Patatrack" sequence running on GPU (or CPU if not available)
from Configuration.ProcessModifiers.gpu_cff import gpu

(pixelNtupletFit & gpu).toModify(pixelTracksSoA.cpu,
pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA")

# build the pixel ntuplets and pixel tracks in SoA format on the GPU
pixelTracksCUDA = _pixelTracksCUDA.clone(
pixelRecHitSrc = "siPixelRecHitsPreSplittingCUDA",
Expand Down

0 comments on commit 604f84e

Please sign in to comment.