Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-29 02:26:04

0001 import FWCore.ParameterSet.Config as cms
0002 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
0003 from Configuration.ProcessModifiers.gpu_cff import gpu
0004 
0005 # legacy pixel rechit producer
0006 siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter",
0007     src = cms.InputTag("siPixelClusters"),
0008     CPE = cms.string('PixelCPEGeneric'),
0009     VerboseLevel = cms.untracked.int32(0)
0010 )
0011 
0012 # SwitchProducer wrapping the legacy pixel rechit producer
0013 siPixelRecHitsPreSplitting = SwitchProducerCUDA(
0014     cpu = siPixelRecHits.clone(
0015         src = 'siPixelClustersPreSplitting'
0016     )
0017 )
0018 
0019 # convert the pixel rechits from legacy to SoA format
0020 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitsPreSplittingSoA
0021 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDA_cfi import siPixelRecHitSoAFromCUDA as _siPixelRecHitSoAFromCUDA
0022 
0023 siPixelRecHitsPreSplittingCPU = _siPixelRecHitsPreSplittingSoA.clone(convertToLegacy=True)
0024 
0025 # phase 2 tracker modifier
0026 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
0027 phase2_tracker.toModify(siPixelRecHitsPreSplittingCPU,
0028     isPhase2 = True)
0029 
0030 # modifier used to prompt patatrack pixel tracks reconstruction on cpu
0031 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
0032 pixelNtupletFit.toModify(siPixelRecHitsPreSplitting,
0033     cpu = cms.EDAlias(
0034             siPixelRecHitsPreSplittingCPU = cms.VPSet(
0035                  cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
0036                  cms.PSet(type = cms.string("uintAsHostProduct"))
0037              )
0038 ))
0039 
0040 
0041 siPixelRecHitsPreSplittingTask = cms.Task(
0042     # SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
0043     siPixelRecHitsPreSplitting
0044 )
0045 
0046 # reconstruct the pixel rechits on the gpu
0047 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
0048 siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDA.clone(
0049     beamSpot = "offlineBeamSpotToCUDA"
0050 )
0051 
0052 # transfer the pixel rechits to the host and convert them from SoA
0053 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA
0054 
0055 #this is an alias for the SoA on GPU or CPU to be used for DQM
0056 siPixelRecHitsPreSplittingSoA = SwitchProducerCUDA(
0057     cpu = cms.EDAlias(
0058             siPixelRecHitsPreSplittingCPU = cms.VPSet(
0059                  cms.PSet(type = cms.string("cmscudacompatCPUTraitsTrackingRecHit2DHeterogeneous")),
0060                  cms.PSet(type = cms.string("uintAsHostProduct"))
0061              )),
0062 )
0063 
0064 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplittingSoA,cuda = _siPixelRecHitSoAFromCUDA.clone())
0065 
0066 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDA.clone())
0067 
0068 pixelNtupletFit.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
0069     cms.Task(
0070         # reconstruct the pixel rechits on the cpu
0071         siPixelRecHitsPreSplittingCPU,
0072         # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
0073         siPixelRecHitsPreSplittingTask.copy(),
0074         # producing and converting on cpu (if needed)
0075         siPixelRecHitsPreSplittingSoA)
0076         )
0077         )
0078 
0079 (gpu & pixelNtupletFit).toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
0080     # reconstruct the pixel rechits on the gpu or on the cpu
0081     # (normally only one of the two is run because only one is consumed from later stages)
0082     siPixelRecHitsPreSplittingCUDA,
0083     siPixelRecHitsPreSplittingCPU,
0084     # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
0085     siPixelRecHitsPreSplittingTask.copy(),
0086     # producing and converting on cpu (if needed)
0087     siPixelRecHitsPreSplittingSoA
0088 ))