def customiseCommon(process): # Services process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") process.CUDAService.enabled = cudaIsEnabled() process.load("HeterogeneousCore.CUDAServices.NVProfilerService_cfi") # Paths and EndPaths # the hltGetConditions module would force gpu-specific ESProducers to run even if no supported gpu is present if 'hltGetConditions' in process.__dict__: del process.hltGetConditions # produce a boolean to track if the events ar being processed on gpu (true) or cpu (false) process.statusOnGPU = SwitchProducerCUDA( cpu=cms.EDProducer("BooleanProducer", value=cms.bool(False)), cuda=cms.EDProducer("BooleanProducer", value=cms.bool(True))) process.statusOnGPUFilter = cms.EDFilter("BooleanFilter", src=cms.InputTag("statusOnGPU")) if 'Status_OnGPU' in process.__dict__: replace_with(process.Status_OnGPU, cms.Path(process.statusOnGPU + process.statusOnGPUFilter)) else: process.Status_OnGPU = cms.Path(process.statusOnGPU + process.statusOnGPUFilter) # make the ScoutingCaloMuonOutput endpath compatible with using Tasks in the Scouting paths if 'hltOutputScoutingCaloMuon' in process.__dict__ and not 'hltPreScoutingCaloMuonOutputSmart' in process.__dict__: process.hltPreScoutingCaloMuonOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale=cms.bool(False), l1tResults=cms.InputTag(""), hltResults=cms.InputTag('TriggerResults', '', '@currentProcess'), triggerConditions=process.hltOutputScoutingCaloMuon.SelectEvents. SelectEvents, throw=cms.bool(True)) insert_modules_after(process, process.hltPreScoutingCaloMuonOutput, process.hltPreScoutingCaloMuonOutputSmart) # make the ScoutingPFOutput endpath compatible with using Tasks in the Scouting paths if 'hltOutputScoutingPF' in process.__dict__ and not 'hltPreScoutingPFOutputSmart' in process.__dict__: process.hltPreScoutingPFOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale=cms.bool(False), l1tResults=cms.InputTag(""), hltResults=cms.InputTag('TriggerResults', '', '@currentProcess'), triggerConditions=process.hltOutputScoutingPF.SelectEvents. SelectEvents, throw=cms.bool(True)) insert_modules_after(process, process.hltPreScoutingPFOutput, process.hltPreScoutingPFOutputSmart) # done return process
# "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA #Pixel tracks in SoA format on the CPU pixelTracksCPU = _pixelTracksCUDA.clone( pixelRecHitSrc = "siPixelRecHitsPreSplitting", idealConditions = False, onGPU = False ) # SwitchProducer providing the pixel tracks in SoA format on the CPU pixelTracksSoA = SwitchProducerCUDA( # build pixel ntuplets and pixel tracks in SoA format on the CPU cpu = pixelTracksCPU ) # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows run3_common.toModify(pixelTracksSoA.cpu, idealConditions = True ) # convert the pixel tracks from SoA to legacy format from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA (pixelNtupletFit & ~phase2_tracker).toReplaceWith(pixelTracks, _pixelTrackProducerFromSoA.clone( pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting", )) (pixelNtupletFit & ~phase2_tracker).toReplaceWith(pixelTracksTask, cms.Task( #pixelTracksTrackingRegions, #pixelFitterByHelixProjections,
def customiseHcalLocalReconstruction(process): if not 'HLTDoLocalHcalSequence' in process.__dict__: return process # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases process.HLTDoLocalHcalSequence = cms.Sequence() process.HLTStoppedHSCPLocalHcalReco = cms.Sequence() # Event Setup process.load( "EventFilter.HcalRawToDigi.hcalElectronicsMappingGPUESProducer_cfi") process.load("RecoLocalCalo.HcalRecProducers.hcalGainsGPUESProducer_cfi") process.load( "RecoLocalCalo.HcalRecProducers.hcalGainWidthsGPUESProducer_cfi") process.load( "RecoLocalCalo.HcalRecProducers.hcalLUTCorrsGPUESProducer_cfi") process.load( "RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalsGPUESProducer_cfi" ) process.hcalConvertedEffectivePedestalsGPUESProducer.label0 = "withTopoEff" process.load( "RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalWidthsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalWidthsGPUESProducer_cfi" ) process.hcalConvertedEffectivePedestalWidthsGPUESProducer.label0 = "withTopoEff" process.hcalConvertedEffectivePedestalWidthsGPUESProducer.label1 = "withTopoEff" process.load( "RecoLocalCalo.HcalRecProducers.hcalQIECodersGPUESProducer_cfi") process.load( "RecoLocalCalo.HcalRecProducers.hcalRecoParamsWithPulseShapesGPUESProducer_cfi" ) process.load( "RecoLocalCalo.HcalRecProducers.hcalRespCorrsGPUESProducer_cfi") process.load( "RecoLocalCalo.HcalRecProducers.hcalTimeCorrsGPUESProducer_cfi") process.load( "RecoLocalCalo.HcalRecProducers.hcalQIETypesGPUESProducer_cfi") process.load( "RecoLocalCalo.HcalRecProducers.hcalSiPMParametersGPUESProducer_cfi") process.load( "RecoLocalCalo.HcalRecProducers.hcalSiPMCharacteristicsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.HcalRecProducers.hcalMahiPulseOffsetsGPUESProducer_cfi") # Modules and EDAliases # The HCAL unpacker running on the gpu supports only the HB and HE digis. # So, run the legacy unacker on the cpu, then convert the HB and HE digis # to SoA format and copy them to the gpu. process.hltHcalDigisGPU = cms.EDProducer( "HcalDigisProducerGPU", hbheDigisLabel=cms.InputTag("hltHcalDigis"), qie11DigiLabel=cms.InputTag("hltHcalDigis"), digisLabelF01HE=cms.string(""), digisLabelF5HB=cms.string(""), digisLabelF3HB=cms.string(""), maxChannelsF01HE=cms.uint32(10000), maxChannelsF5HB=cms.uint32(10000), maxChannelsF3HB=cms.uint32(10000)) # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu from RecoLocalCalo.HcalRecProducers.hbheRecHitProducerGPU_cfi import hbheRecHitProducerGPU as _hbheRecHitProducerGPU process.hltHbherecoGPU = _hbheRecHitProducerGPU.clone( digisLabelF01HE="hltHcalDigisGPU", digisLabelF5HB="hltHcalDigisGPU", digisLabelF3HB="hltHcalDigisGPU", recHitsLabelM0HBHE="") # transfer the HCAL rechits to the cpu, and convert them to the legacy format from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hcalCPURecHitsProducer process.hltHbherecoFromGPU = _hcalCPURecHitsProducer.clone( recHitsM0LabelIn="hltHbherecoGPU", recHitsM0LabelOut="", recHitsLegacyLabelOut="") # SwitchProducer between the legacy producer and the copy from gpu with conversion process.hltHbhereco = SwitchProducerCUDA( # legacy producer cpu=process.hltHbhereco.clone(), # alias to the rechits converted to legacy format cuda=cms.EDAlias(hltHbherecoFromGPU=cms.VPSet( cms.PSet(type=cms.string("HBHERecHitsSorted"))))) # Tasks and Sequences process.HLTDoLocalHcalTask = cms.Task( process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu process.hltHcalDigisGPU, # copy to gpu and convert to SoA format process. hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu process. hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format process. hltHbhereco, # SwitchProducer between the legacy producer and the copy from gpu with conversion process.hltHfprereco, # legacy producer process.hltHfreco, # legacy producer process.hltHoreco) # legacy producer process.HLTDoLocalHcalSequence = cms.Sequence(process.HLTDoLocalHcalTask) process.HLTStoppedHSCPLocalHcalRecoTask = cms.Task( process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu process.hltHcalDigisGPU, # copy to gpu and convert to SoA format process. hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu process. hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format process.hltHbhereco ) # SwitchProducer between the legacy producer and the copy from gpu with conversion process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.HLTStoppedHSCPLocalHcalRecoTask) # done return process
def customisePixelTrackReconstruction(process): if not 'HLTRecoPixelTracksSequence' in process.__dict__: return process # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases process.HLTRecoPixelTracksSequence = cms.Sequence() process.HLTRecopixelvertexingSequence = cms.Sequence() # Modules and EDAliases # referenced in process.HLTRecoPixelTracksTask # cpu only: convert the pixel rechits from legacy to SoA format from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitSoAFromLegacy process.hltSiPixelRecHitSoA = _siPixelRecHitSoAFromLegacy.clone( src="hltSiPixelClusters", beamSpot="hltOnlineBeamSpot", convertToLegacy=True) # build pixel ntuplets and pixel tracks in SoA format on gpu from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA as _caHitNtupletCUDA process.hltPixelTracksCUDA = _caHitNtupletCUDA.clone( idealConditions=False, pixelRecHitSrc="hltSiPixelRecHitsCUDA", onGPU=True) # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows run3_common.toModify(process.hltPixelTracksCUDA, idealConditions=True) # SwitchProducer providing the pixel tracks in SoA format on cpu process.hltPixelTracksSoA = SwitchProducerCUDA( # build pixel ntuplets and pixel tracks in SoA format on cpu cpu=_caHitNtupletCUDA.clone(idealConditions=False, pixelRecHitSrc="hltSiPixelRecHitSoA", onGPU=False), # transfer the pixel tracks in SoA format to the host cuda=cms.EDProducer("PixelTrackSoAFromCUDA", src=cms.InputTag("hltPixelTracksCUDA"))) # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows run3_common.toModify(process.hltPixelTracksSoA.cpu, idealConditions=True) # convert the pixel tracks from SoA to legacy format from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA process.hltPixelTracks = _pixelTrackProducerFromSoA.clone( beamSpot="hltOnlineBeamSpot", pixelRecHitLegacySrc="hltSiPixelRecHits", trackSrc="hltPixelTracksSoA") # referenced in process.HLTRecopixelvertexingTask # build pixel vertices in SoA format on gpu from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA as _pixelVertexCUDA process.hltPixelVerticesCUDA = _pixelVertexCUDA.clone( pixelTrackSrc="hltPixelTracksCUDA", onGPU=True) # build or transfer pixel vertices in SoA format on cpu process.hltPixelVerticesSoA = SwitchProducerCUDA( # build pixel vertices in SoA format on cpu cpu=_pixelVertexCUDA.clone(pixelTrackSrc="hltPixelTracksSoA", onGPU=False), # transfer the pixel vertices in SoA format to cpu cuda=cms.EDProducer("PixelVertexSoAFromCUDA", src=cms.InputTag("hltPixelVerticesCUDA"))) # convert the pixel vertices from SoA to legacy format from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA process.hltPixelVertices = _pixelVertexFromSoA.clone( src="hltPixelVerticesSoA", TrackCollection="hltPixelTracks", beamSpot="hltOnlineBeamSpot") # Tasks and Sequences process.HLTRecoPixelTracksTask = cms.Task( process.hltPixelTracksTrackingRegions, # from the original sequence process.hltSiPixelRecHitSoA, # pixel rechits on cpu, converted to SoA process.hltPixelTracksCUDA, # pixel ntuplets on gpu, in SoA format process.hltPixelTracksSoA, # pixel ntuplets on cpu, in SoA format process.hltPixelTracks) # pixel tracks on cpu, in legacy format process.HLTRecoPixelTracksSequence = cms.Sequence( process.HLTRecoPixelTracksTask) process.HLTRecopixelvertexingTask = cms.Task( process.HLTRecoPixelTracksTask, process.hltPixelVerticesCUDA, # pixel vertices on gpu, in SoA format process.hltPixelVerticesSoA, # pixel vertices on cpu, in SoA format process.hltPixelVertices, # pixel vertices on cpu, in legacy format process.hltTrimmedPixelVertices) # from the original sequence process.HLTRecopixelvertexingSequence = cms.Sequence( process.hltPixelTracksFitter + # not used here, kept for compatibility with legacy sequences process. hltPixelTracksFilter, # not used here, kept for compatibility with legacy sequences process.HLTRecopixelvertexingTask) # done return process
def customiseHcalLocalReconstruction(process): hasHLTDoLocalHcalSeq = 'HLTDoLocalHcalSequence' in process.__dict__ if not (hasHLTDoLocalHcalSeq or 'HLTStoppedHSCPLocalHcalReco' in process.__dict__): return process # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases if hasHLTDoLocalHcalSeq: process.HLTDoLocalHcalSequence = cms.Sequence() process.HLTStoppedHSCPLocalHcalReco = cms.Sequence() # Event Setup _load_if_missing(process, 'hcalElectronicsMappingGPUESProducer', 'EventFilter.HcalRawToDigi.hcalElectronicsMappingGPUESProducer_cfi') _load_if_missing(process, 'hcalChannelQualityGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalChannelQualityGPUESProducer_cfi') _load_if_missing(process, 'hcalGainsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalGainsGPUESProducer_cfi') _load_if_missing(process, 'hcalGainWidthsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalGainWidthsGPUESProducer_cfi') _load_if_missing(process, 'hcalLUTCorrsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalLUTCorrsGPUESProducer_cfi') _load_if_missing(process, 'hcalConvertedPedestalsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalsGPUESProducer_cfi') _load_if_missing(process, 'hcalConvertedPedestalWidthsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalWidthsGPUESProducer_cfi') _load_if_missing(process, 'hcalQIECodersGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalQIECodersGPUESProducer_cfi') _load_if_missing(process, 'hcalRecoParamsWithPulseShapesGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalRecoParamsWithPulseShapesGPUESProducer_cfi') _load_if_missing(process, 'hcalRespCorrsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalRespCorrsGPUESProducer_cfi') _load_if_missing(process, 'hcalTimeCorrsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalTimeCorrsGPUESProducer_cfi') _load_if_missing(process, 'hcalQIETypesGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalQIETypesGPUESProducer_cfi') _load_if_missing(process, 'hcalSiPMParametersGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalSiPMParametersGPUESProducer_cfi') _load_if_missing(process, 'hcalSiPMCharacteristicsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalSiPMCharacteristicsGPUESProducer_cfi') _load_if_missing(process, 'hcalMahiPulseOffsetsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalMahiPulseOffsetsGPUESProducer_cfi') _clone_if_missing(process, 'hcalConvertedEffectivePedestalsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalsGPUESProducer_cfi', label0 = 'withTopoEff' ) _clone_if_missing(process, 'hcalConvertedEffectivePedestalWidthsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalWidthsGPUESProducer_cfi', label0 = 'withTopoEff', label1 = 'withTopoEff' ) # Modules and EDAliases # The HCAL unpacker running on the gpu supports only the HB and HE digis. # So, run the legacy unacker on the cpu, then convert the HB and HE digis # to SoA format and copy them to the gpu. _clone_if_missing(process, 'hltHcalDigisGPU', 'EventFilter.HcalRawToDigi.hcalDigisProducerGPU_cfi', 'hcalDigisProducerGPU', hbheDigisLabel = 'hltHcalDigis', qie11DigiLabel = 'hltHcalDigis', digisLabelF01HE = '', digisLabelF5HB = '', digisLabelF3HB = '' ) # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu _clone_if_missing(process, 'hltHbherecoGPU', 'RecoLocalCalo.HcalRecProducers.hbheRecHitProducerGPU_cfi', 'hbheRecHitProducerGPU', digisLabelF01HE = 'hltHcalDigisGPU', digisLabelF5HB = 'hltHcalDigisGPU', digisLabelF3HB = 'hltHcalDigisGPU', recHitsLabelM0HBHE = '' ) # transfer the HCAL rechits to the cpu, and convert them to the legacy format _clone_if_missing(process, 'hltHbherecoFromGPU', 'RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi', 'hcalCPURecHitsProducer', recHitsM0LabelIn = 'hltHbherecoGPU', recHitsM0LabelOut = '', recHitsLegacyLabelOut = '' ) # SwitchProducer between the legacy producer and the copy from gpu with conversion if not isinstance(process.hltHbhereco, SwitchProducerCUDA): process.hltHbhereco = SwitchProducerCUDA( # legacy producer cpu = process.hltHbhereco.clone() ) elif not hasattr(process.hltHbhereco, 'cpu'): raise Exception('unsupported configuration: "process.hltHbhereco" is a SwitchProducerCUDA, but does not have a "cpu" branch') if not hasattr(process.hltHbhereco, 'cuda'): # alias to the rechits converted to legacy format process.hltHbhereco.cuda = cms.EDAlias( hltHbherecoFromGPU = cms.VPSet( cms.PSet(type = cms.string('HBHERecHitsSorted')) ) ) # Tasks and Sequences if hasHLTDoLocalHcalSeq: if 'HLTDoLocalHcalTask' not in process.__dict__: process.HLTDoLocalHcalTask = cms.Task( process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu process.hltHcalDigisGPU, # copy to gpu and convert to SoA format process.hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu process.hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format process.hltHbhereco, # SwitchProducer between the legacy producer and the copy from gpu with conversion process.hltHfprereco, # legacy producer process.hltHfreco, # legacy producer process.hltHoreco # legacy producer ) elif not isinstance(process.HLTDoLocalHcalTask, cms.Task): raise Exception('unsupported configuration: "process.HLTDoLocalHcalTask" already exists, but it is not a Task') # redefine HLTDoLocalHcalSequence (it was emptied at the start of this function) process.HLTDoLocalHcalSequence = cms.Sequence(process.HLTDoLocalHcalTask) if 'HLTStoppedHSCPLocalHcalRecoTask' not in process.__dict__: process.HLTStoppedHSCPLocalHcalRecoTask = cms.Task( process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu process.hltHcalDigisGPU, # copy to gpu and convert to SoA format process.hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu process.hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format process.hltHbhereco # SwitchProducer between the legacy producer and the copy from gpu with conversion ) elif not isinstance(process.HLTStoppedHSCPLocalHcalRecoTask, cms.Task): raise Exception('unsupported configuration: "process.HLTStoppedHSCPLocalHcalRecoTask" already exists, but it is not a Task') # redefine HLTStoppedHSCPLocalHcalReco (it was emptied at the start of this function) process.HLTStoppedHSCPLocalHcalReco = cms.Sequence(process.HLTStoppedHSCPLocalHcalRecoTask) # done return process
def customisePixelLocalReconstruction(process): if not 'HLTDoLocalPixelSequence' in process.__dict__: return process # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTDoLocalPixelSequence = cms.Sequence() # Event Setup _load_if_missing(process, 'PixelCPEFastESProducer', 'RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi') # these 2 modules should be used only on GPUs, will crash otherwise _load_if_missing(process, 'siPixelGainCalibrationForHLTGPU', 'CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi') _load_if_missing(process, 'siPixelROCsStatusAndMappingWrapperESProducer', 'CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi') # Modules and EDAliases # referenced in HLTDoLocalPixelTask # transfer the beamspot to the gpu _clone_if_missing(process, 'hltOnlineBeamSpotToCUDA', 'RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi', 'offlineBeamSpotToCUDA', src = 'hltOnlineBeamSpot' ) if 'hltSiPixelClustersCUDA' not in process.__dict__: # reconstruct the pixel digis and clusters on the gpu _hltSiPixelClustersLegacyLabel = 'hltSiPixelClustersLegacy' if 'hltSiPixelClustersLegacy' in process.__dict__ else 'hltSiPixelClusters' _clone(process, 'hltSiPixelClustersCUDA', 'RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi', 'siPixelRawToClusterCUDA', # use the same thresholds as the legacy module clusterThreshold_layer1 = getattr(process, _hltSiPixelClustersLegacyLabel).ClusterThreshold_L1, clusterThreshold_otherLayers = getattr(process, _hltSiPixelClustersLegacyLabel).ClusterThreshold, ) # use the pixel channel calibrations scheme for Run 3 run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2 = False) # copy the pixel digis errors to the host _clone_if_missing(process, 'hltSiPixelDigiErrorsSoA', 'EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi', 'siPixelDigiErrorsSoAFromCUDA', src = 'hltSiPixelClustersCUDA' ) # copy the pixel digis (except errors) and clusters to the host _clone_if_missing(process, 'hltSiPixelDigisSoA', 'EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi', 'siPixelDigisSoAFromCUDA', src = 'hltSiPixelClustersCUDA' ) # SwitchProducer: hltSiPixelDigis if not isinstance(process.hltSiPixelDigis, SwitchProducerCUDA): if 'hltSiPixelDigisLegacy' not in process.__dict__: # reconstruct the pixel digis on the cpu process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone() # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format process.hltSiPixelDigis = SwitchProducerCUDA( # legacy producer cpu = cms.EDAlias( hltSiPixelDigisLegacy = cms.VPSet( cms.PSet(type = cms.string("DetIdedmEDCollection")), cms.PSet(type = cms.string("SiPixelRawDataErroredmDetSetVector")), cms.PSet(type = cms.string("PixelFEDChanneledmNewDetSetVector")) ) ) ) elif not hasattr(process.hltSiPixelDigis, 'cpu'): raise Exception('unsupported configuration: "process.hltSiPixelDigis" is a SwitchProducerCUDA, but does not have a "cpu" branch') # conversion from SoA to legacy format _clone_if_missing(process.hltSiPixelDigis, 'cuda', 'EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi', 'siPixelDigiErrorsFromSoA', digiErrorSoASrc = "hltSiPixelDigiErrorsSoA", UsePhase1 = True ) # SwitchProducer: hltSiPixelClusters if not isinstance(process.hltSiPixelClusters, SwitchProducerCUDA): if 'hltSiPixelClustersLegacy' not in process.__dict__: # reconstruct the pixel clusters on the cpu process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone( src = "hltSiPixelDigisLegacy" ) # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters to the legacy format process.hltSiPixelClusters = SwitchProducerCUDA( # legacy producer cpu = cms.EDAlias( hltSiPixelClustersLegacy = cms.VPSet( cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector")) ) ) ) elif not hasattr(process.hltSiPixelClusters, 'cpu'): raise Exception('unsupported configuration: "process.hltSiPixelClusters" is a SwitchProducerCUDA, but does not have a "cpu" branch') # conversion from SoA to legacy format _clone_if_missing(process.hltSiPixelClusters, 'cuda', 'RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi', 'siPixelDigisClustersFromSoA', src = 'hltSiPixelDigisSoA', produceDigis = False, storeDigis = False, # use the same thresholds as the legacy module clusterThreshold_layer1 = process.hltSiPixelClustersLegacy.ClusterThreshold_L1, clusterThreshold_otherLayers = process.hltSiPixelClustersLegacy.ClusterThreshold ) # reconstruct the pixel rechits on the gpu _clone_if_missing(process, 'hltSiPixelRecHitsCUDA', 'RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi', 'siPixelRecHitCUDA', src = 'hltSiPixelClustersCUDA', beamSpot = 'hltOnlineBeamSpotToCUDA' ) # cpu only: produce the pixel rechits in SoA and legacy format, from the legacy clusters _clone_if_missing(process, 'hltSiPixelRecHitSoA', 'RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi', 'siPixelRecHitSoAFromLegacy', src = 'hltSiPixelClusters', beamSpot = 'hltOnlineBeamSpot', convertToLegacy = True ) # SwitchProducer: hltSiPixelRecHits if not isinstance(process.hltSiPixelRecHits, SwitchProducerCUDA): # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA process.hltSiPixelRecHits = SwitchProducerCUDA( # legacy producer cpu = cms.EDAlias( hltSiPixelRecHitSoA = cms.VPSet( cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")), cms.PSet(type = cms.string("uintAsHostProduct")) ) ) ) elif not hasattr(process.hltSiPixelRecHits, 'cpu'): raise Exception('unsupported configuration: "process.hltSiPixelRecHits" is a SwitchProducerCUDA, but does not have a "cpu" branch') # conversion from SoA to legacy format _clone_if_missing(process.hltSiPixelRecHits, 'cuda', 'RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi', 'siPixelRecHitFromCUDA', pixelRecHitSrc = 'hltSiPixelRecHitsCUDA', src = 'hltSiPixelClusters' ) # Tasks and Sequences if 'HLTDoLocalPixelTask' not in process.__dict__: process.HLTDoLocalPixelTask = cms.Task( process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu process.hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu process.hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu process.hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host process.hltSiPixelDigiErrorsSoA, # copy the pixel digis errors to the host process.hltSiPixelDigisLegacy, # legacy pixel digis producer process.hltSiPixelDigis, # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors from SoA process.hltSiPixelClustersLegacy, # legacy pixel cluster producer process.hltSiPixelClusters, # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters from SoA process.hltSiPixelClustersCache, # legacy module, used by the legacy pixel quadruplet producer process.hltSiPixelRecHitSoA, # pixel rechits on cpu, in SoA & legacy format process.hltSiPixelRecHits, # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA ) elif not isinstance(process.HLTDoLocalPixelTask, cms.Task): raise Exception('unsupported configuration: "process.HLTDoLocalPixelTask" already exists, but it is not a Task') # redefine HLTDoLocalPixelSequence (it was emptied at the start of this function) process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask) # workaround for old version of AlCa_LumiPixelsCounts paths for AlCaPathName in ['AlCa_LumiPixelsCounts_Random_v1', 'AlCa_LumiPixelsCounts_ZeroBias_v1']: if AlCaPathName in process.__dict__: AlCaPath = getattr(process, AlCaPathName) # replace hltSiPixelDigis+hltSiPixelClusters with HLTDoLocalPixelSequence hasSiPixelDigis, hasSiPixelClusters = False, False for (itemLabel, itemName) in AlCaPath.directDependencies(): if itemLabel != 'modules': continue if itemName == 'hltSiPixelDigis': hasSiPixelDigis = True elif itemName == 'hltSiPixelClusters': hasSiPixelClusters = True if hasSiPixelDigis and hasSiPixelClusters: AlCaPath.remove(process.hltSiPixelClusters) AlCaPath.replace(process.hltSiPixelDigis, process.HLTDoLocalPixelSequence) # done return process
def customiseCommon(process): # Services process.load('Configuration.StandardSequences.Accelerators_cff') # # NVProfilerService is broken in CMSSW 12.0.x and later # _load_if_missing(process, 'NVProfilerService', 'HeterogeneousCore.CUDAServices.NVProfilerService_cfi') # Paths and EndPaths # the hltGetConditions module would force gpu-specific ESProducers to run even if no supported gpu is present if 'hltGetConditions' in process.__dict__: del process.hltGetConditions # produce a boolean to track if the events ar being processed on gpu (true) or cpu (false) if 'statusOnGPU' not in process.__dict__: process.statusOnGPU = SwitchProducerCUDA( cpu = cms.EDProducer("BooleanProducer", value = cms.bool(False)) ) if not hasattr(process.statusOnGPU, 'cuda'): process.statusOnGPU.cuda = cms.EDProducer("BooleanProducer", value = cms.bool(True)) if 'statusOnGPUFilter' not in process.__dict__: process.statusOnGPUFilter = cms.EDFilter("BooleanFilter", src = cms.InputTag("statusOnGPU") ) if 'Status_OnCPU' in process.__dict__: replace_with(process.Status_OnCPU, cms.Path(process.statusOnGPU + ~process.statusOnGPUFilter)) else: process.Status_OnCPU = cms.Path(process.statusOnGPU + ~process.statusOnGPUFilter) if process.schedule is not None: process.schedule.append(process.Status_OnCPU) if 'Status_OnGPU' in process.__dict__: replace_with(process.Status_OnGPU, cms.Path(process.statusOnGPU + process.statusOnGPUFilter)) else: process.Status_OnGPU = cms.Path(process.statusOnGPU + process.statusOnGPUFilter) if process.schedule is not None: process.schedule.append(process.Status_OnGPU) # make the ScoutingCaloMuonOutput endpath compatible with using Tasks in the Scouting paths if 'hltOutputScoutingCaloMuon' in process.__dict__ and not 'hltPreScoutingCaloMuonOutputSmart' in process.__dict__: process.hltPreScoutingCaloMuonOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = process.hltOutputScoutingCaloMuon.SelectEvents.SelectEvents, throw = cms.bool( True ) ) insert_modules_after(process, process.hltPreScoutingCaloMuonOutput, process.hltPreScoutingCaloMuonOutputSmart) # make the ScoutingPFOutput endpath compatible with using Tasks in the Scouting paths if 'hltOutputScoutingPF' in process.__dict__ and not 'hltPreScoutingPFOutputSmart' in process.__dict__: process.hltPreScoutingPFOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = process.hltOutputScoutingPF.SelectEvents.SelectEvents, throw = cms.bool( True ) ) insert_modules_after(process, process.hltPreScoutingPFOutput, process.hltPreScoutingPFOutputSmart) # done return process
from HeterogeneousCore.CUDATest.testCUDAProducerGPU_cfi import testCUDAProducerGPU from HeterogeneousCore.CUDATest.testCUDAProducerGPUEW_cfi import testCUDAProducerGPUEW from HeterogeneousCore.CUDATest.testCUDAProducerGPUtoCPU_cfi import testCUDAProducerGPUtoCPU process.prod2CUDA = testCUDAProducerGPU.clone(src="prod1CUDA") process.prod3CUDA = testCUDAProducerGPU.clone(src="prod2CUDA") process.prod4CUDA = testCUDAProducerGPUEW.clone(src="prod1CUDA") # CPU producers, switched with modules to copy data from GPU to CPU # (as "on demand" as any other EDProducer, i.e. according to # consumes() and prefetching). If a separate conversion step is needed # to get the same data formats as the CPU modules, those are then ones # that should be replaced-with here. from HeterogeneousCore.CUDATest.testCUDAProducerCPU_cfi import testCUDAProducerCPU process.prod2 = SwitchProducerCUDA( cpu=testCUDAProducerCPU.clone(src="prod1"), cuda=testCUDAProducerGPUtoCPU.clone(src="prod2CUDA")) process.prod3 = SwitchProducerCUDA( cpu=testCUDAProducerCPU.clone(src="prod2"), cuda=testCUDAProducerGPUtoCPU.clone(src="prod3CUDA")) process.prod4 = SwitchProducerCUDA( cpu=testCUDAProducerCPU.clone(src="prod1"), cuda=testCUDAProducerGPUtoCPU.clone(src="prod4CUDA")) # GPU analyzer (optionally) from HeterogeneousCore.CUDATest.testCUDAAnalyzerGPU_cfi import testCUDAAnalyzerGPU process.anaCUDA = testCUDAAnalyzerGPU.clone(src="prod6CUDA") if args.silent: process.anaCUDA.minValue = 2.3e7 process.anaCUDA.maxValue = 2.5e7
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDATest.prod5CPU_cfi import prod5CPU as _prod5CPU from HeterogeneousCore.CUDATest.prod5CUDA_cfi import prod5CUDA from HeterogeneousCore.CUDATest.prod5FromCUDA_cfi import prod5FromCUDA as _prod5FromCUDA from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA prod5 = SwitchProducerCUDA(cpu=_prod5CPU.clone(), cuda=_prod5FromCUDA.clone()) prod5Task = cms.Task(prod5CUDA, prod5)
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from Configuration.ProcessModifiers.gpu_cff import gpu # ECAL multifit running on CPU from RecoLocalCalo.EcalRecProducers.ecalMultiFitUncalibRecHit_cfi import ecalMultiFitUncalibRecHit as _ecalMultiFitUncalibRecHit ecalMultiFitUncalibRecHit = SwitchProducerCUDA( cpu = _ecalMultiFitUncalibRecHit.clone() ) ecalMultiFitUncalibRecHitTask = cms.Task( # ECAL multifit running on CPU ecalMultiFitUncalibRecHit ) # ECAL conditions used by the multifit running on GPU from RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi import ecalPedestalsGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalGainRatiosGPUESProducer_cfi import ecalGainRatiosGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalPulseShapesGPUESProducer_cfi import ecalPulseShapesGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalPulseCovariancesGPUESProducer_cfi import ecalPulseCovariancesGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalSamplesCorrelationGPUESProducer_cfi import ecalSamplesCorrelationGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalTimeBiasCorrectionsGPUESProducer_cfi import ecalTimeBiasCorrectionsGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalTimeCalibConstantsGPUESProducer_cfi import ecalTimeCalibConstantsGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi import ecalMultifitParametersGPUESProducer # ECAL multifit running on GPU from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitProducerGPU_cfi import ecalUncalibRecHitProducerGPU as _ecalUncalibRecHitProducerGPU ecalMultiFitUncalibRecHitGPU = _ecalUncalibRecHitProducerGPU.clone( digisLabelEB = cms.InputTag('ecalDigisGPU', 'ebDigis'), digisLabelEE = cms.InputTag('ecalDigisGPU', 'eeDigis'), )
import FWCore.ParameterSet.Config as cms from EventFilter.SiPixelRawToDigi.siPixelRawToDigi_cfi import siPixelRawToDigi as _siPixelRawToDigi from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA siPixelDigis = SwitchProducerCUDA(cpu=_siPixelRawToDigi.clone()) from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel phase1Pixel.toModify(siPixelDigis.cpu, UsePhase1=True) from Configuration.ProcessModifiers.gpu_cff import gpu gpu.toModify( siPixelDigis, cuda=cms.EDAlias( siPixelDigiErrors=cms.VPSet( cms.PSet(type=cms.string("DetIdedmEDCollection")), cms.PSet(type=cms.string("SiPixelRawDataErroredmDetSetVector")), cms.PSet(type=cms.string("PixelFEDChanneledmNewDetSetVector"))), siPixelDigisClustersPreSplitting=cms.VPSet( cms.PSet(type=cms.string("PixelDigiedmDetSetVector")))))
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA #--- for Run 1 and Run 2 from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import hbhereco as _phase0_hbhereco hbhereco = SwitchProducerCUDA( cpu = _phase0_hbhereco.clone() ) hcalGlobalRecoTask = cms.Task(hbhereco) hcalGlobalRecoSequence = cms.Sequence(hcalGlobalRecoTask) hcalOnlyGlobalRecoTask = cms.Task() hcalOnlyGlobalRecoSequence = cms.Sequence(hcalOnlyGlobalRecoTask) #--- for Run 3 and later from Configuration.Eras.Modifier_run3_HB_cff import run3_HB from RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi import hbheprereco as _phase1_hbheprereco run3_HB.toReplaceWith(hbhereco.cpu, _phase1_hbheprereco) run3_HB.toReplaceWith(hcalOnlyGlobalRecoTask, cms.Task(hbhereco)) #--- for Run 3 on GPU from Configuration.ProcessModifiers.gpu_cff import gpu from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hbherecoFromCUDA (run3_HB & gpu).toModify(hbhereco, cuda = _hbherecoFromCUDA.clone( produceSoA = False ) )
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from Configuration.ProcessModifiers.gpu_cff import gpu # ECAL calibrated rechit reconstruction on CPU from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import ecalRecHit as _ecalRecHit ecalRecHit = SwitchProducerCUDA(cpu=_ecalRecHit.clone()) ecalCalibratedRecHitTask = cms.Task(ecalRecHit) # ECAL rechit calibrations on GPU from RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi import ecalRechitADCToGeVConstantGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi import ecalRechitChannelStatusGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi import ecalIntercalibConstantsGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi import ecalLaserAPDPNRatiosGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi import ecalLaserAPDPNRatiosRefGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi import ecalLaserAlphasGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi import ecalLinearCorrectionsGPUESProducer from RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi import ecalRecHitParametersGPUESProducer # ECAL rechits running on GPU from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU ecalRecHitGPU = _ecalRecHitGPU.clone( uncalibrecHitsInLabelEB=cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEB'), uncalibrecHitsInLabelEE=cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEE')) # copy the rechits from GPU to CPU from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer ecalRecHitSoA = _ecalCPURecHitProducer.clone(
def customisePixelTrackReconstruction(process): if not 'HLTRecoPixelTracksSequence' in process.__dict__: return process hasHLTPixelVertexReco = 'HLTRecopixelvertexingSequence' in process.__dict__ # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTRecoPixelTracksSequence = cms.Sequence() if hasHLTPixelVertexReco: process.HLTRecopixelvertexingSequence = cms.Sequence() # Modules and EDAliases # referenced in process.HLTRecoPixelTracksTask # build pixel ntuplets and pixel tracks in SoA format on gpu from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA process.hltPixelTracksCUDA = _pixelTracksCUDA.clone( idealConditions=False, pixelRecHitSrc="hltSiPixelRecHitsCUDA", onGPU=True) # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows run3_common.toModify(process.hltPixelTracksCUDA, idealConditions=True) # SwitchProducer providing the pixel tracks in SoA format on cpu from RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi import pixelTracksSoA as _pixelTracksSoA process.hltPixelTracksSoA = SwitchProducerCUDA( # build pixel ntuplets and pixel tracks in SoA format on cpu cpu=_pixelTracksCUDA.clone(idealConditions=False, pixelRecHitSrc="hltSiPixelRecHitSoA", onGPU=False), # transfer the pixel tracks in SoA format to the host cuda=_pixelTracksSoA.clone(src="hltPixelTracksCUDA")) # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows run3_common.toModify(process.hltPixelTracksSoA.cpu, idealConditions=True) # convert the pixel tracks from SoA to legacy format from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA process.hltPixelTracks = _pixelTrackProducerFromSoA.clone( beamSpot="hltOnlineBeamSpot", pixelRecHitLegacySrc="hltSiPixelRecHits", trackSrc="hltPixelTracksSoA") # referenced in process.HLTRecopixelvertexingTask if hasHLTPixelVertexReco: # build pixel vertices in SoA format on gpu from RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi import pixelVerticesCUDA as _pixelVerticesCUDA process.hltPixelVerticesCUDA = _pixelVerticesCUDA.clone( pixelTrackSrc="hltPixelTracksCUDA", onGPU=True) # build or transfer pixel vertices in SoA format on cpu from RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA process.hltPixelVerticesSoA = SwitchProducerCUDA( # build pixel vertices in SoA format on cpu cpu=_pixelVerticesCUDA.clone(pixelTrackSrc="hltPixelTracksSoA", onGPU=False), # transfer the pixel vertices in SoA format to cpu cuda=_pixelVerticesSoA.clone(src="hltPixelVerticesCUDA")) # convert the pixel vertices from SoA to legacy format from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA process.hltPixelVertices = _pixelVertexFromSoA.clone( src="hltPixelVerticesSoA", TrackCollection="hltPixelTracks", beamSpot="hltOnlineBeamSpot") # Tasks and Sequences if 'HLTRecoPixelTracksTask' in process.__dict__ and not isinstance( process.HLTRecoPixelTracksTask, cms.Task): raise Exception( 'unsupported configuration: "process.HLTRecoPixelTracksTask" already exists, but it is not a Task' ) process.HLTRecoPixelTracksTask = cms.Task( process.hltPixelTracksTrackingRegions, # from the original sequence process.hltPixelTracksCUDA, # pixel ntuplets on gpu, in SoA format process.hltPixelTracksSoA, # pixel ntuplets on cpu, in SoA format process.hltPixelTracks) # pixel tracks on cpu, in legacy format process.HLTRecoPixelTracksSequence = cms.Sequence( process.HLTRecoPixelTracksTask) if hasHLTPixelVertexReco: if 'HLTRecopixelvertexingTask' in process.__dict__ and not isinstance( process.HLTRecopixelvertexingTask, cms.Task): raise Exception( 'unsupported configuration: "process.HLTRecopixelvertexingTask" already exists, but it is not a Task' ) process.HLTRecopixelvertexingTask = cms.Task( process.HLTRecoPixelTracksTask, process. hltPixelVerticesCUDA, # pixel vertices on gpu, in SoA format process. hltPixelVerticesSoA, # pixel vertices on cpu, in SoA format process. hltPixelVertices, # pixel vertices on cpu, in legacy format process.hltTrimmedPixelVertices) # from the original sequence process.HLTRecopixelvertexingSequence = cms.Sequence( process.hltPixelTracksFitter + # not used here, kept for compatibility with legacy sequences process. hltPixelTracksFilter, # not used here, kept for compatibility with legacy sequences process.HLTRecopixelvertexingTask) # done return process
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from Configuration.ProcessModifiers.gpu_cff import gpu # legacy pixel rechit producer siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter", src=cms.InputTag("siPixelClusters"), CPE=cms.string('PixelCPEGeneric'), VerboseLevel=cms.untracked.int32(0)) from Configuration.Eras.Modifier_phase2_brickedPixels_cff import phase2_brickedPixels phase2_brickedPixels.toModify(siPixelRecHits, CPE='PixelCPEGenericForBricked') # SwitchProducer wrapping the legacy pixel rechit producer siPixelRecHitsPreSplitting = SwitchProducerCUDA(cpu=siPixelRecHits.clone( src='siPixelClustersPreSplitting')) # convert the pixel rechits from legacy to SoA format from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitsPreSplittingSoA siPixelRecHitsPreSplittingSoA = _siPixelRecHitsPreSplittingSoA.clone( convertToLegacy=True) # phase 2 tracker modifier from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker phase2_tracker.toModify(siPixelRecHitsPreSplittingSoA, 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()) siPixelRecHitsPreSplittingTask = cms.Task( # SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
trackingLowPU.toModify(pixelTracks, SeedingHitSets="pixelTracksHitTriplets") _pixelTracksTask_lowPU = pixelTracksTask.copy() _pixelTracksTask_lowPU.replace(pixelTracksHitQuadruplets, pixelTracksHitTriplets) trackingLowPU.toReplaceWith(pixelTracksTask, _pixelTracksTask_lowPU) # "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA # SwitchProducer providing the pixel tracks in SoA format on the CPU pixelTracksSoA = SwitchProducerCUDA( # build pixel ntuplets and pixel tracks in SoA format on the CPU cpu=_pixelTracksCUDA.clone(pixelRecHitSrc="siPixelRecHitsPreSplittingSoA", idealConditions=False, onGPU=False)) # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows run3_common.toModify(pixelTracksSoA.cpu, idealConditions=True) # convert the pixel tracks from SoA to legacy format from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA pixelNtupletFit.toReplaceWith( pixelTracks, _pixelTrackProducerFromSoA.clone( pixelRecHitLegacySrc="siPixelRecHitsPreSplitting", )) pixelNtupletFit.toReplaceWith( pixelTracksTask, cms.Task(
def customiseEcalLocalReconstruction(process): hasHLTEcalPreshowerSeq = any(seq in process.__dict__ for seq in [ 'HLTDoFullUnpackingEgammaEcalMFSequence', 'HLTDoFullUnpackingEgammaEcalSequence' ]) if not (hasHLTEcalPreshowerSeq or 'HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence' in process.__dict__): return process # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( ) if hasHLTEcalPreshowerSeq: process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence() process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence() # Event Setup process.load( "EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalGainRatiosGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalPulseCovariancesGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalPulseShapesGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalSamplesCorrelationGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalTimeBiasCorrectionsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalTimeCalibConstantsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi") # Modules and EDAliases # ECAL unpacker running on gpu from EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi import ecalRawToDigiGPU as _ecalRawToDigiGPU process.hltEcalDigisGPU = _ecalRawToDigiGPU.clone() # SwitchProducer wrapping the legacy ECAL unpacker or the ECAL digi converter from SoA format on gpu to legacy format on cpu process.hltEcalDigisLegacy = process.hltEcalDigis.clone() from EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi import ecalCPUDigisProducer as _ecalCPUDigisProducer process.hltEcalDigis = SwitchProducerCUDA( # legacy producer cpu=cms.EDAlias(hltEcalDigisLegacy=cms.VPSet( cms.PSet(type=cms.string("EBDigiCollection")), cms.PSet(type=cms.string("EEDigiCollection")), cms.PSet(type=cms.string("EBDetIdedmEDCollection")), cms.PSet(type=cms.string("EEDetIdedmEDCollection")), cms.PSet(type=cms.string("EBSrFlagsSorted")), cms.PSet(type=cms.string("EESrFlagsSorted")), cms.PSet(type=cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance=cms.string( "EcalIntegrityBlockSizeErrors")), cms.PSet(type=cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance=cms.string( "EcalIntegrityTTIdErrors")), cms.PSet(type=cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance=cms.string( "EcalIntegrityZSXtalIdErrors")), cms.PSet(type=cms.string("EcalPnDiodeDigisSorted")), cms.PSet(type=cms.string("EcalPseudoStripInputDigisSorted"), fromProductInstance=cms.string("EcalPseudoStripInputs")), cms.PSet(type=cms.string("EcalTriggerPrimitiveDigisSorted"), fromProductInstance=cms.string("EcalTriggerPrimitives")), )), # convert ECAL digis from SoA format on gpu to legacy format on cpu cuda=_ecalCPUDigisProducer.clone( digisInLabelEB=("hltEcalDigisGPU", "ebDigis"), digisInLabelEE=("hltEcalDigisGPU", "eeDigis"), produceDummyIntegrityCollections=cms.bool(True))) # ECAL multifit running on gpu from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitProducerGPU_cfi import ecalUncalibRecHitProducerGPU as _ecalUncalibRecHitProducerGPU process.hltEcalUncalibRecHitGPU = _ecalUncalibRecHitProducerGPU.clone( digisLabelEB=("hltEcalDigisGPU", "ebDigis"), digisLabelEE=("hltEcalDigisGPU", "eeDigis"), shouldRunTimingComputation=False) # copy the ECAL uncalibrated rechits from gpu to cpu in SoA format from RecoLocalCalo.EcalRecProducers.ecalCPUUncalibRecHitProducer_cfi import ecalCPUUncalibRecHitProducer as _ecalCPUUncalibRecHitProducer process.hltEcalUncalibRecHitSoA = _ecalCPUUncalibRecHitProducer.clone( recHitsInLabelEB=("hltEcalUncalibRecHitGPU", "EcalUncalibRecHitsEB"), recHitsInLabelEE=("hltEcalUncalibRecHitGPU", "EcalUncalibRecHitsEE"), ) # SwitchProducer wrapping the legacy ECAL uncalibrated rechits producer or a converter from SoA to legacy format from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitConvertGPU2CPUFormat_cfi import ecalUncalibRecHitConvertGPU2CPUFormat as _ecalUncalibRecHitConvertGPU2CPUFormat process.hltEcalUncalibRecHit = SwitchProducerCUDA( # legacy producer cpu=process.hltEcalUncalibRecHit, # convert the ECAL uncalibrated rechits from SoA to legacy format cuda=_ecalUncalibRecHitConvertGPU2CPUFormat.clone( recHitsLabelGPUEB=("hltEcalUncalibRecHitSoA", "EcalUncalibRecHitsEB"), recHitsLabelGPUEE=("hltEcalUncalibRecHitSoA", "EcalUncalibRecHitsEE"), )) # Reconstructing the ECAL calibrated rechits on gpu works, but is extremely slow. # Disable it for the time being, until the performance has been addressed. """ from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU process.hltEcalRecHitGPU = _ecalRecHitGPU.clone( uncalibrecHitsInLabelEB = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEB"), uncalibrecHitsInLabelEE = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEE"), ) from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer process.hltEcalRecHitSoA = _ecalCPURecHitProducer.clone( recHitsInLabelEB = ("hltEcalRecHitGPU", "EcalRecHitsEB"), recHitsInLabelEE = ("hltEcalRecHitGPU", "EcalRecHitsEE"), ) # SwitchProducer wrapping the legacy ECAL calibrated rechits producer or a converter from SoA to legacy format from RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi import ecalRecHitConvertGPU2CPUFormat as _ecalRecHitConvertGPU2CPUFormat process.hltEcalRecHit = SwitchProducerCUDA( # legacy producer cpu = process.hltEcalRecHit, # convert the ECAL calibrated rechits from SoA to legacy format cuda = _ecalRecHitConvertGPU2CPUFormat.clone( recHitsLabelGPUEB = ("hltEcalRecHitSoA", "EcalRecHitsEB"), recHitsLabelGPUEE = ("hltEcalRecHitSoA", "EcalRecHitsEE"), ) ) """ # SwitchProducer wrapping the legacy ECAL rechits producer # the gpu unpacker does not produce the TPs used for the recovery, so the SwitchProducer alias does not provide them: # - the cpu uncalibrated rechit producer may mark them for recovery, read the TPs explicitly from the legacy unpacker # - the gpu uncalibrated rechit producer does not flag them for recovery, so the TPs are not necessary process.hltEcalRecHit = SwitchProducerCUDA( cpu=process.hltEcalRecHit.clone( triggerPrimitiveDigiCollection=('hltEcalDigisLegacy', 'EcalTriggerPrimitives')), cuda=process.hltEcalRecHit.clone( triggerPrimitiveDigiCollection='unused')) # Tasks and Sequences process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask = cms.Task( process.hltEcalDigisGPU, # unpack ECAL digis on gpu process. hltEcalDigisLegacy, # legacy producer, referenced in the SwitchProducer process.hltEcalDigis, # SwitchProducer process. hltEcalUncalibRecHitGPU, # run ECAL local reconstruction and multifit on gpu process. hltEcalUncalibRecHitSoA, # needed by hltEcalPhiSymFilter - copy to host process. hltEcalUncalibRecHit, # needed by hltEcalPhiSymFilter - convert to legacy format # process.hltEcalRecHitGPU, # make ECAL calibrated rechits on gpu # process.hltEcalRecHitSoA, # copy to host process.hltEcalDetIdToBeRecovered, # legacy producer process.hltEcalRecHit) # legacy producer process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask) if hasHLTEcalPreshowerSeq: process.HLTPreshowerTask = cms.Task( process. hltEcalPreshowerDigis, # unpack ECAL preshower digis on the host process.hltEcalPreshowerRecHit ) # build ECAL preshower rechits on the host process.HLTPreshowerSequence = cms.Sequence(process.HLTPreshowerTask) process.HLTDoFullUnpackingEgammaEcalTask = cms.Task( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask, process.HLTPreshowerTask) process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalTask) process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalTask) # done return process
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA # SiPixelGainCalibrationServiceParameters from CondTools.SiPixel.SiPixelGainCalibrationService_cfi import * # legacy pixel cluster producer from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizer_cfi import siPixelClusters as _siPixelClusters siPixelClustersPreSplitting = SwitchProducerCUDA(cpu=_siPixelClusters.clone()) from Configuration.ProcessModifiers.gpu_cff import gpu # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA gpu.toModify( siPixelClustersPreSplitting, # ensure the same results when running on GPU (which supports only the 'HLT' payload) and CPU cpu=dict(payloadType='HLT'), cuda=cms.EDAlias(siPixelDigisClustersPreSplitting=cms.VPSet( cms.PSet(type=cms.string("SiPixelClusteredmNewDetSetVector"))))) from Configuration.ProcessModifiers.siPixelDigiMorphing_cff import siPixelDigiMorphing siPixelDigiMorphing.toModify(siPixelClustersPreSplitting, cpu=dict(src='siPixelDigisMorphed'))
def customisePixelTrackReconstruction(process): if not 'HLTRecoPixelTracksSequence' in process.__dict__: return process hasHLTPixelVertexReco = 'HLTRecopixelvertexingSequence' in process.__dict__ # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTRecoPixelTracksSequence = cms.Sequence() if hasHLTPixelVertexReco: process.HLTRecopixelvertexingSequence = cms.Sequence() # Modules and EDAliases # referenced in process.HLTRecoPixelTracksTask # SwitchProducer: hltPixelTracksSoA if not ('hltPixelTracksSoA' in process.__dict__ and isinstance(process.hltPixelTracksSoA, SwitchProducerCUDA)): # build pixel ntuplets and pixel tracks in SoA format on gpu _clone(process, 'hltPixelTracksCUDA', 'RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi', 'pixelTracksCUDA', pixelRecHitSrc = 'hltSiPixelRecHitsCUDA', onGPU = True, idealConditions = False ) # use quality cuts tuned for Run-2 ideal conditions for all Run-3 workflows run3_common.toModify(process.hltPixelTracksCUDA, idealConditions = True) process.hltPixelTracksSoA = SwitchProducerCUDA( # build pixel ntuplets and pixel tracks in SoA format on cpu cpu = process.hltPixelTracksCUDA.clone( pixelRecHitSrc = 'hltSiPixelRecHitSoA', onGPU = False ) ) elif hasattr(process.hltPixelTracksSoA, 'cpu'): # if cpu branch of SwitchProducerCUDA exists, take hltPixelTracksCUDA (gpu) # from hltPixelTracksSoA.cpu (cpu) to enforce same configuration parameters process.hltPixelTracksCUDA = process.hltPixelTracksSoA.cpu.clone( pixelRecHitSrc = "hltSiPixelRecHitsCUDA", onGPU = True ) else: raise Exception('unsupported configuration: "process.hltPixelTracksSoA" is a SwitchProducerCUDA, but does not have a "cpu" branch') # transfer the pixel tracks in SoA format to cpu _clone_if_missing(process.hltPixelTracksSoA, 'cuda', 'RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi', 'pixelTracksSoA', src = 'hltPixelTracksCUDA' ) # convert the pixel tracks from SoA to legacy format if process.hltPixelTracks.type_() != 'PixelTrackProducerFromSoA': _clone(process, 'hltPixelTracks', 'RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi', 'pixelTrackProducerFromSoA', beamSpot = 'hltOnlineBeamSpot', pixelRecHitLegacySrc = 'hltSiPixelRecHits', trackSrc = 'hltPixelTracksSoA' ) # referenced in process.HLTRecopixelvertexingTask if hasHLTPixelVertexReco: # SwitchProducer: hltPixelVerticesSoA if not ('hltPixelVerticesSoA' in process.__dict__ and isinstance(process.hltPixelVerticesSoA, SwitchProducerCUDA)): # build pixel vertices in SoA format on gpu _clone(process, 'hltPixelVerticesCUDA', 'RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi', 'pixelVerticesCUDA', pixelTrackSrc = 'hltPixelTracksCUDA', onGPU = True ) # build or transfer pixel vertices in SoA format on cpu process.hltPixelVerticesSoA = SwitchProducerCUDA( # build pixel vertices in SoA format on cpu cpu = process.hltPixelVerticesCUDA.clone( pixelTrackSrc = 'hltPixelTracksSoA', onGPU = False ) ) elif hasattr(process.hltPixelVerticesSoA, 'cpu'): # if cpu branch of SwitchProducerCUDA exists, take hltPixelVerticesCUDA (gpu) # from hltPixelVerticesSoA.cpu (cpu) to enforce same configuration parameters process.hltPixelVerticesCUDA = process.hltPixelVerticesSoA.cpu.clone( pixelTrackSrc = 'hltPixelTracksCUDA', onGPU = True ) else: raise Exception('unsupported configuration: "process.hltPixelVerticesSoA" is a SwitchProducerCUDA, but does not have a "cpu" branch') # transfer the pixel vertices in SoA format to cpu _clone_if_missing(process.hltPixelVerticesSoA, 'cuda', 'RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi', 'pixelVerticesSoA', src = 'hltPixelVerticesCUDA' ) # convert the pixel vertices from SoA to legacy format if process.hltPixelVertices.type_() != 'PixelVertexProducerFromSoA': _clone(process, 'hltPixelVertices', 'RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi', 'pixelVertexFromSoA', src = 'hltPixelVerticesSoA', TrackCollection = 'hltPixelTracks', beamSpot = 'hltOnlineBeamSpot' ) # Tasks and Sequences if 'HLTRecoPixelTracksTask' not in process.__dict__: process.HLTRecoPixelTracksTask = cms.Task( process.hltPixelTracksTrackingRegions, # from the original sequence process.hltPixelTracksCUDA, # pixel ntuplets on gpu, in SoA format process.hltPixelTracksSoA, # pixel ntuplets on cpu, in SoA format process.hltPixelTracks, # pixel tracks on cpu, in legacy format ) elif not isinstance(process.HLTRecoPixelTracksTask, cms.Task): raise Exception('unsupported configuration: "process.HLTRecoPixelTracksTask" already exists, but it is not a Task') # redefine HLTRecoPixelTracksSequence (it was emptied at the start of this function) process.HLTRecoPixelTracksSequence = cms.Sequence(process.HLTRecoPixelTracksTask) if hasHLTPixelVertexReco: if 'HLTRecopixelvertexingTask' not in process.__dict__: process.HLTRecopixelvertexingTask = cms.Task( process.HLTRecoPixelTracksTask, process.hltPixelVerticesCUDA, # pixel vertices on gpu, in SoA format process.hltPixelVerticesSoA, # pixel vertices on cpu, in SoA format process.hltPixelVertices, # pixel vertices on cpu, in legacy format process.hltTrimmedPixelVertices, # from the original sequence ) elif not isinstance(process.HLTRecopixelvertexingTask, cms.Task): raise Exception('unsupported configuration: "process.HLTRecopixelvertexingTask" already exists, but it is not a Task') # redefine HLTRecopixelvertexingSequence (it was emptied at the start of this function) process.HLTRecopixelvertexingSequence = cms.Sequence( process.hltPixelTracksFitter + # not used here, kept for compatibility with legacy sequences process.hltPixelTracksFilter, # not used here, kept for compatibility with legacy sequences process.HLTRecopixelvertexingTask, ) # done return process
import FWCore.ParameterSet.Config as cms siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter", src = cms.InputTag("siPixelClusters"), CPE = cms.string('PixelCPEGeneric'), VerboseLevel = cms.untracked.int32(0) ) _siPixelRecHitsPreSplitting = siPixelRecHits.clone( src = 'siPixelClustersPreSplitting' ) from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA siPixelRecHitsPreSplitting = SwitchProducerCUDA( cpu = _siPixelRecHitsPreSplitting.clone() ) from Configuration.ProcessModifiers.gpu_cff import gpu from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromSOA_cfi import siPixelRecHitFromSOA as _siPixelRecHitFromSOA gpu.toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromSOA.clone() ) siPixelRecHitsPreSplittingTask = cms.Task(siPixelRecHitsPreSplitting) siPixelRecHitsCUDAPreSplitting = _siPixelRecHitCUDA.clone(
def customiseEcalLocalReconstruction(process): hasHLTEcalPreshowerSeq = any(seq in process.__dict__ for seq in ['HLTDoFullUnpackingEgammaEcalMFSequence', 'HLTDoFullUnpackingEgammaEcalSequence']) if not (hasHLTEcalPreshowerSeq or 'HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence' in process.__dict__): return process # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence() if hasHLTEcalPreshowerSeq: process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence() process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence() # Event Setup _load_if_missing(process, 'ecalElectronicsMappingGPUESProducer', 'EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi') _load_if_missing(process, 'ecalGainRatiosGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalGainRatiosGPUESProducer_cfi') _load_if_missing(process, 'ecalPedestalsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi') _load_if_missing(process, 'ecalPulseCovariancesGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalPulseCovariancesGPUESProducer_cfi') _load_if_missing(process, 'ecalPulseShapesGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalPulseShapesGPUESProducer_cfi') _load_if_missing(process, 'ecalSamplesCorrelationGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalSamplesCorrelationGPUESProducer_cfi') _load_if_missing(process, 'ecalTimeBiasCorrectionsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalTimeBiasCorrectionsGPUESProducer_cfi') _load_if_missing(process, 'ecalTimeCalibConstantsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalTimeCalibConstantsGPUESProducer_cfi') _load_if_missing(process, 'ecalMultifitParametersGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi') _load_if_missing(process, 'ecalRechitADCToGeVConstantGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi') _load_if_missing(process, 'ecalRechitChannelStatusGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi') _load_if_missing(process, 'ecalIntercalibConstantsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi') _load_if_missing(process, 'ecalLaserAPDPNRatiosGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi') _load_if_missing(process, 'ecalLaserAPDPNRatiosRefGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi') _load_if_missing(process, 'ecalLaserAlphasGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi') _load_if_missing(process, 'ecalLinearCorrectionsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi') _load_if_missing(process, 'ecalRecHitParametersGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi') # Modules and EDAliases # ECAL unpacker running on gpu _clone_if_missing(process, 'hltEcalDigisGPU', 'EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi', 'ecalRawToDigiGPU') # SwitchProducer: hltEcalDigis if not isinstance(process.hltEcalDigis, SwitchProducerCUDA): if 'hltEcalDigisLegacy' not in process.__dict__: process.hltEcalDigisLegacy = process.hltEcalDigis.clone() else: raise Exception('unsupported configuration: "process.hltEcalDigis" is not a SwitchProducerCUDA, but "process.hltEcalDigisLegacy" already exists') # SwitchProducer wrapping the legacy ECAL unpacker or the ECAL digi converter from SoA format on gpu to legacy format on cpu process.hltEcalDigis = SwitchProducerCUDA( # legacy producer cpu = cms.EDAlias( hltEcalDigisLegacy = cms.VPSet( cms.PSet(type = cms.string("EBDigiCollection")), cms.PSet(type = cms.string("EEDigiCollection")), cms.PSet(type = cms.string("EBDetIdedmEDCollection")), cms.PSet(type = cms.string("EEDetIdedmEDCollection")), cms.PSet(type = cms.string("EBSrFlagsSorted")), cms.PSet(type = cms.string("EESrFlagsSorted")), cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityBlockSizeErrors")), cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityTTIdErrors")), cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityZSXtalIdErrors")), cms.PSet(type = cms.string("EcalPnDiodeDigisSorted")), cms.PSet(type = cms.string("EcalPseudoStripInputDigisSorted"), fromProductInstance = cms.string("EcalPseudoStripInputs")), cms.PSet(type = cms.string("EcalTriggerPrimitiveDigisSorted"), fromProductInstance = cms.string("EcalTriggerPrimitives")), ) ) ) # convert ECAL digis from SoA format on gpu to legacy format on cpu _clone_if_missing(process.hltEcalDigis, 'cuda', 'EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi', 'ecalCPUDigisProducer', digisInLabelEB = ('hltEcalDigisGPU', 'ebDigis'), digisInLabelEE = ('hltEcalDigisGPU', 'eeDigis'), produceDummyIntegrityCollections = True ) # ECAL multifit running on gpu _clone_if_missing(process, 'hltEcalUncalibRecHitGPU', 'RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitProducerGPU_cfi', 'ecalUncalibRecHitProducerGPU', digisLabelEB = ('hltEcalDigisGPU', 'ebDigis'), digisLabelEE = ('hltEcalDigisGPU', 'eeDigis'), shouldRunTimingComputation = False ) # copy the ECAL uncalibrated rechits from gpu to cpu in SoA format _clone_if_missing(process, 'hltEcalUncalibRecHitSoA', 'RecoLocalCalo.EcalRecProducers.ecalCPUUncalibRecHitProducer_cfi', 'ecalCPUUncalibRecHitProducer', recHitsInLabelEB = ('hltEcalUncalibRecHitGPU', 'EcalUncalibRecHitsEB'), recHitsInLabelEE = ('hltEcalUncalibRecHitGPU', 'EcalUncalibRecHitsEE'), ) # SwitchProducer: hltEcalUncalibRecHit if not isinstance(process.hltEcalUncalibRecHit, SwitchProducerCUDA): # SwitchProducer wrapping the legacy ECAL uncalibrated rechits producer or a converter from SoA to legacy format process.hltEcalUncalibRecHit = SwitchProducerCUDA( # legacy producer cpu = process.hltEcalUncalibRecHit ) # convert the ECAL uncalibrated rechits from SoA to legacy format _clone_if_missing(process.hltEcalUncalibRecHit, 'cuda', 'RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitConvertGPU2CPUFormat_cfi', 'ecalUncalibRecHitConvertGPU2CPUFormat', recHitsLabelGPUEB = ('hltEcalUncalibRecHitSoA', 'EcalUncalibRecHitsEB'), recHitsLabelGPUEE = ('hltEcalUncalibRecHitSoA', 'EcalUncalibRecHitsEE'), ) # Reconstructing the ECAL calibrated rechits on gpu works, but is extremely slow. # Disable it for the time being, until the performance has been addressed. """ _clone_if_missing(process, 'hltEcalRecHitGPU', 'RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi', 'ecalRecHitGPU', uncalibrecHitsInLabelEB = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEB"), uncalibrecHitsInLabelEE = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEE"), ) _clone_if_missing(process, 'hltEcalRecHitSoA', 'RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi', 'ecalCPURecHitProducer', recHitsInLabelEB = ("hltEcalRecHitGPU", "EcalRecHitsEB"), recHitsInLabelEE = ("hltEcalRecHitGPU", "EcalRecHitsEE"), ) # SwitchProducer wrapping the legacy ECAL calibrated rechits producer or a converter from SoA to legacy format if not isinstance(process.hltEcalRecHit, SwitchProducerCUDA): process.hltEcalRecHit = SwitchProducerCUDA( # legacy producer cpu = process.hltEcalRecHit, ) # convert the ECAL calibrated rechits from SoA to legacy format _clone_if_missing(process.hltEcalRecHit, 'cuda', 'RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi', 'ecalRecHitConvertGPU2CPUFormat', recHitsLabelGPUEB = ("hltEcalRecHitSoA", "EcalRecHitsEB"), recHitsLabelGPUEE = ("hltEcalRecHitSoA", "EcalRecHitsEE"), ) """ # SwitchProducer wrapping the legacy ECAL rechits producer # the gpu unpacker does not produce the TPs used for the recovery, so the SwitchProducer alias does not provide them: # - the cpu uncalibrated rechit producer may mark them for recovery, read the TPs explicitly from the legacy unpacker # - the gpu uncalibrated rechit producer does not flag them for recovery, so the TPs are not necessary if not isinstance(process.hltEcalRecHit, SwitchProducerCUDA): process.hltEcalRecHit = SwitchProducerCUDA( cpu = process.hltEcalRecHit.clone( triggerPrimitiveDigiCollection = ('hltEcalDigisLegacy', 'EcalTriggerPrimitives') ) ) elif not hasattr(process.hltEcalRecHit, 'cpu'): raise Exception('unsupported configuration: "process.hltEcalRecHit" is a SwitchProducerCUDA, but does not have a "cpu" branch') if not hasattr(process.hltEcalRecHit, 'cuda'): process.hltEcalRecHit.cuda = process.hltEcalRecHit.cpu.clone( triggerPrimitiveDigiCollection = 'unused' ) # enforce consistent configuration of CPU and GPU modules for timing of ECAL RecHits if process.hltEcalUncalibRecHit.cpu.algoPSet.timealgo == 'RatioMethod': process.hltEcalUncalibRecHitGPU.shouldRunTimingComputation = True process.hltEcalUncalibRecHitSoA.containsTimingInformation = True for _parName in [ 'EBtimeFitLimits_Lower', 'EBtimeFitLimits_Upper', 'EEtimeFitLimits_Lower', 'EEtimeFitLimits_Upper', 'EBtimeConstantTerm', 'EEtimeConstantTerm', 'EBtimeNconst', 'EEtimeNconst', 'outOfTimeThresholdGain12pEB', 'outOfTimeThresholdGain12pEE', 'outOfTimeThresholdGain12mEB', 'outOfTimeThresholdGain12mEE', 'outOfTimeThresholdGain61pEB', 'outOfTimeThresholdGain61pEE', 'outOfTimeThresholdGain61mEB', 'outOfTimeThresholdGain61mEE', ]: setattr(process.hltEcalUncalibRecHitGPU, _parName, getattr(process.hltEcalUncalibRecHit.cpu.algoPSet, _parName)) # note: the "RatioMethod" is the only one available in the GPU implementation elif process.hltEcalUncalibRecHit.cpu.algoPSet.timealgo != 'None': _logMsg = '"process.hltEcalUncalibRecHit.cpu.algoPSet.timealgo = \''+process.hltEcalUncalibRecHit.cpu.algoPSet.timealgo+'\'"' _logMsg += ' has no counterpart in the GPU implementation of the ECAL local reconstruction (use "None" or "RatioMethod")' raise Exception('unsupported configuration: '+_logMsg) # Tasks and Sequences if 'HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask' not in process.__dict__: process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask = cms.Task( process.hltEcalDigisGPU, # unpack ECAL digis on gpu process.hltEcalDigisLegacy, # legacy producer, referenced in the SwitchProducer process.hltEcalDigis, # SwitchProducer process.hltEcalUncalibRecHitGPU, # run ECAL local reconstruction and multifit on gpu process.hltEcalUncalibRecHitSoA, # needed by hltEcalPhiSymFilter - copy to host process.hltEcalUncalibRecHit, # needed by hltEcalPhiSymFilter - convert to legacy format # process.hltEcalRecHitGPU, # make ECAL calibrated rechits on gpu # process.hltEcalRecHitSoA, # copy to host process.hltEcalDetIdToBeRecovered, # legacy producer process.hltEcalRecHit, # legacy producer ) elif not isinstance(process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask, cms.Task): raise Exception('unsupported configuration: "process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask" already exists, but it is not a Task') # redefine HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence (it was emptied at the start of this function) process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask ) if hasHLTEcalPreshowerSeq: if 'HLTPreshowerTask' not in process.__dict__: process.HLTPreshowerTask = cms.Task( process.hltEcalPreshowerDigis, # unpack ECAL preshower digis on the host process.hltEcalPreshowerRecHit, # build ECAL preshower rechits on the host ) elif not isinstance(process.HLTPreshowerTask, cms.Task): raise Exception('unsupported configuration: "process.HLTPreshowerTask" already exists, but it is not a Task') # redefine HLTPreshowerSequence (it was emptied at the start of this function) process.HLTPreshowerSequence = cms.Sequence(process.HLTPreshowerTask) if 'HLTDoFullUnpackingEgammaEcalTask' not in process.__dict__: process.HLTDoFullUnpackingEgammaEcalTask = cms.Task( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask, process.HLTPreshowerTask, ) elif not isinstance(process.HLTDoFullUnpackingEgammaEcalTask, cms.Task): raise Exception('unsupported configuration: "process.HLTDoFullUnpackingEgammaEcalTask" already exists, but it is not a Task') # redefine sequences (they were emptied at the start of this function) process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence(process.HLTDoFullUnpackingEgammaEcalTask) process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence(process.HLTDoFullUnpackingEgammaEcalTask) # done return process
def customisePixelLocalReconstruction(process): if not 'HLTDoLocalPixelSequence' in process.__dict__: return process # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTDoLocalPixelSequence = cms.Sequence() # Event Setup process.load( "CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi" ) # this should be used only on GPUs, will crash otherwise process.load( "CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi" ) # this should be used only on GPUs, will crash otherwise process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi") # Modules and EDAliases # referenced in HLTDoLocalPixelTask # transfer the beamspot to the gpu from RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi import offlineBeamSpotToCUDA as _offlineBeamSpotToCUDA process.hltOnlineBeamSpotToCUDA = _offlineBeamSpotToCUDA.clone( src="hltOnlineBeamSpot") # reconstruct the pixel digis and clusters on the gpu from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone( # use the same thresholds as the legacy module clusterThreshold_layer1=process.hltSiPixelClusters.ClusterThreshold_L1, clusterThreshold_otherLayers=process.hltSiPixelClusters. ClusterThreshold) # use the pixel channel calibrations scheme for Run 3 run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2=False) # copy the pixel digis errors to the host from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone( src="hltSiPixelClustersCUDA") # copy the pixel digis (except errors) and clusters to the host from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone( src="hltSiPixelClustersCUDA") # reconstruct the pixel digis on the cpu process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone() # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA process.hltSiPixelDigis = SwitchProducerCUDA( # legacy producer cpu=cms.EDAlias(hltSiPixelDigisLegacy=cms.VPSet( cms.PSet(type=cms.string("DetIdedmEDCollection")), cms.PSet(type=cms.string("SiPixelRawDataErroredmDetSetVector")), cms.PSet(type=cms.string("PixelFEDChanneledmNewDetSetVector")))), # conversion from SoA to legacy format cuda=_siPixelDigiErrorsFromSoA.clone( digiErrorSoASrc="hltSiPixelDigiErrorsSoA", UsePhase1=True)) # reconstruct the pixel clusters on the cpu process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone( src="hltSiPixelDigisLegacy") # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters to the legacy format from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA process.hltSiPixelClusters = SwitchProducerCUDA( # legacy producer cpu=cms.EDAlias(hltSiPixelClustersLegacy=cms.VPSet( cms.PSet(type=cms.string("SiPixelClusteredmNewDetSetVector")))), # conversion from SoA to legacy format cuda=_siPixelDigisClustersFromSoA.clone( src="hltSiPixelDigisSoA", produceDigis=False, storeDigis=False, # use the same thresholds as the legacy module clusterThreshold_layer1=process.hltSiPixelClusters. ClusterThreshold_L1, clusterThreshold_otherLayers=process.hltSiPixelClusters. ClusterThreshold)) # reconstruct the pixel rechits on the gpu from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone( src="hltSiPixelClustersCUDA", beamSpot="hltOnlineBeamSpotToCUDA") # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA process.hltSiPixelRecHits = SwitchProducerCUDA( # legacy producer cpu=process.hltSiPixelRecHits, # conversion from SoA to legacy format cuda=_siPixelRecHitFromCUDA.clone( pixelRecHitSrc="hltSiPixelRecHitsCUDA", src="hltSiPixelClusters")) # Tasks and Sequences process.HLTDoLocalPixelTask = cms.Task( process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu process. hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu process. hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu process. hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host process. hltSiPixelDigiErrorsSoA, # copy the pixel digis errors to the host process.hltSiPixelDigisLegacy, # legacy pixel digis producer process. hltSiPixelDigis, # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors from SoA process.hltSiPixelClustersLegacy, # legacy pixel cluster producer process. hltSiPixelClusters, # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters from SoA process. hltSiPixelClustersCache, # legacy module, used by the legacy pixel quadruplet producer process.hltSiPixelRecHits ) # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask) # workaround for AlCa paths if 'AlCa_LumiPixelsCounts_Random_v1' in process.__dict__: if "HLTSchedule" in process.__dict__: ind = process.HLTSchedule.index( process.AlCa_LumiPixelsCounts_Random_v1) process.HLTSchedule.remove(process.AlCa_LumiPixelsCounts_Random_v1) # redefine the path to use the HLTDoLocalPixelSequence process.AlCa_LumiPixelsCounts_Random_v1 = cms.Path( process.HLTBeginSequenceRandom + process.hltScalersRawToDigi + process.hltPreAlCaLumiPixelsCountsRandom + process.hltPixelTrackerHVOn + process.HLTDoLocalPixelSequence + process.hltAlcaPixelClusterCounts + process.HLTEndSequence) if "HLTSchedule" in process.__dict__: process.HLTSchedule.insert(ind, process.AlCa_LumiPixelsCounts_Random_v1) if 'AlCa_LumiPixelsCounts_ZeroBias_v1' in process.__dict__: if "HLTSchedule" in process.__dict__: ind = process.HLTSchedule.index( process.AlCa_LumiPixelsCounts_ZeroBias_v1) process.HLTSchedule.remove( process.AlCa_LumiPixelsCounts_ZeroBias_v1) # redefine the path to use the HLTDoLocalPixelSequence process.AlCa_LumiPixelsCounts_ZeroBias_v1 = cms.Path( process.HLTBeginSequence + process.hltScalersRawToDigi + process.hltL1sZeroBias + process.hltPreAlCaLumiPixelsCountsZeroBias + process.hltPixelTrackerHVOn + process.HLTDoLocalPixelSequence + process.hltAlcaPixelClusterCounts + process.HLTEndSequence) if "HLTSchedule" in process.__dict__: process.HLTSchedule.insert( ind, process.AlCa_LumiPixelsCounts_ZeroBias_v1) # done return process
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from Configuration.ProcessModifiers.gpu_cff import gpu # legacy pixel rechit producer siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter", src=cms.InputTag("siPixelClusters"), CPE=cms.string('PixelCPEGeneric'), VerboseLevel=cms.untracked.int32(0)) # SwitchProducer wrapping the legacy pixel rechit producer siPixelRecHitsPreSplitting = SwitchProducerCUDA(cpu=siPixelRecHits.clone( src='siPixelClustersPreSplitting')) # convert the pixel rechits from legacy to SoA format from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitsPreSplittingSoA from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDA_cfi import siPixelRecHitSoAFromCUDA as _siPixelRecHitSoAFromCUDA siPixelRecHitsPreSplittingCPU = _siPixelRecHitsPreSplittingSoA.clone( convertToLegacy=True) # phase 2 tracker modifier 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=cms.EDAlias(siPixelRecHitsPreSplittingCPU=cms.VPSet( cms.PSet(type=cms.string("SiPixelRecHitedmNewDetSetVector")),
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from RecoPixelVertexing.PixelTrackFitting.PixelTracks_cff import * from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cff import * # legacy pixel vertex reconsruction using the divisive vertex finder pixelVerticesTask = cms.Task(pixelVertices) # "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker # build the pixel vertices in SoA format on the CPU from RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi import pixelVerticesCUDA as _pixelVerticesCUDA pixelVerticesSoA = SwitchProducerCUDA( cpu=_pixelVerticesCUDA.clone(pixelTrackSrc="pixelTracksSoA", onGPU=False)) # convert the pixel vertices from SoA to legacy format from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA (pixelNtupletFit & ~phase2_tracker).toReplaceWith( pixelVertices, _pixelVertexFromSoA.clone(src="pixelVerticesSoA")) (pixelNtupletFit & ~phase2_tracker).toReplaceWith( pixelVerticesTask, cms.Task( # build the pixel vertices in SoA format on the CPU pixelVerticesSoA, # convert the pixel vertices from SoA to legacy format pixelVertices)) # "Patatrack" sequence running on the GPU
'alpaka_cuda_async::TestAlpakaTranscriber', source=cms.InputTag('testProducerCuda')) # run the producer on the cpu process.testProducerCpu = cms.EDProducer( 'alpaka_serial_sync::TestAlpakaProducer', size=cms.int32(42)) # extract the cpu product from the heterogeneous wrapper process.testTranscriberFromCpu = cms.EDProducer( 'alpaka_serial_sync::TestAlpakaTranscriber', source=cms.InputTag('testProducerCpu')) # either run the producer on a CUDA gpu (if available) and copy the product to the cpu, or run the producer directly on the cpu process.testProducer = SwitchProducerCUDA( cpu=cms.EDAlias( testTranscriberFromCpu=cms.VPSet(cms.PSet(type=cms.string('*')))), cuda=cms.EDAlias( testTranscriberFromCuda=cms.VPSet(cms.PSet(type=cms.string('*'))))) # analyse the product process.testAnalyzer = cms.EDAnalyzer('TestAlpakaAnalyzer', source=cms.InputTag('testProducer')) # run a second producer explicitly on the cpu process.testProducerSerial = cms.EDProducer( 'alpaka_serial_sync::TestAlpakaProducer', size=cms.int32(99)) # extract the cpu product from the heterogeneous wrapper process.testTranscriberSerial = cms.EDProducer( 'alpaka_serial_sync::TestAlpakaTranscriber', source=cms.InputTag('testProducerSerial'))
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from Configuration.ProcessModifiers.gpu_cff import gpu from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitPhase2_cfi import ecalUncalibRecHitPhase2 as _ecalUncalibRecHitPhase2 ecalUncalibRecHitPhase2 = SwitchProducerCUDA( cpu=_ecalUncalibRecHitPhase2.clone()) # cpu weights ecalUncalibRecHitPhase2Task = cms.Task(ecalUncalibRecHitPhase2) # conditions used on gpu from RecoLocalCalo.EcalRecProducers.ecalPhase2DigiToGPUProducer_cfi import ecalPhase2DigiToGPUProducer as _ecalPhase2DigiToGPUProducer ecalPhase2DigiToGPUProducer = _ecalPhase2DigiToGPUProducer.clone() # gpu weights from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitPhase2GPU_cfi import ecalUncalibRecHitPhase2GPU as _ecalUncalibRecHitPhase2GPU ecalUncalibRecHitPhase2GPU = _ecalUncalibRecHitPhase2GPU.clone( digisLabelEB=('ecalPhase2DigiToGPUProducer', 'ebDigis')) # copy the uncalibrated rechits from GPU to CPU from RecoLocalCalo.EcalRecProducers.ecalCPUUncalibRecHitProducer_cfi import ecalCPUUncalibRecHitProducer as _ecalCPUUncalibRecHitProducer ecalUncalibRecHitSoA = _ecalCPUUncalibRecHitProducer.clone( recHitsInLabelEB=('ecalUncalibRecHitPhase2GPU', 'EcalUncalibRecHitsEB'), isPhase2=True, recHitsInLabelEE=None, # remove unneeded Phase1 parameters recHitsOutLabelEE=None) from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitConvertGPU2CPUFormat_cfi import ecalUncalibRecHitConvertGPU2CPUFormat as _ecalUncalibRecHitConvertGPU2CPUFormat gpu.toModify(
def customiseEcalLocalReconstruction(process): if not 'HLTDoFullUnpackingEgammaEcalSequence' in process.__dict__: return process # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence() process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( ) process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence() # Event Setup process.load( "EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalGainRatiosGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalPulseCovariancesGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalPulseShapesGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalSamplesCorrelationGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalTimeBiasCorrectionsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalTimeCalibConstantsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi") process.load( "RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi" ) process.load( "RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi") # Modules and EDAliases # ECAL unpacker running on gpu process.hltEcalDigisGPU = cms.EDProducer( "EcalRawToDigiGPU", InputLabel=cms.InputTag("rawDataCollector"), FEDs=cms.vint32(601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654), digisLabelEB=cms.string("ebDigis"), digisLabelEE=cms.string("eeDigis"), maxChannelsEB=cms.uint32(61200), maxChannelsEE=cms.uint32(14648), ) # SwitchProducer wrapping the legacy ECAL unpacker or the ECAL digi converter from SoA format on gpu to legacy format on cpu process.hltEcalDigisLegacy = process.hltEcalDigis.clone() process.hltEcalDigis = SwitchProducerCUDA( # legacy producer cpu=cms.EDAlias(hltEcalDigisLegacy=cms.VPSet( cms.PSet(type=cms.string("EBDigiCollection")), cms.PSet(type=cms.string("EEDigiCollection")), cms.PSet(type=cms.string("EBDetIdedmEDCollection")), cms.PSet(type=cms.string("EEDetIdedmEDCollection")), cms.PSet(type=cms.string("EBSrFlagsSorted")), cms.PSet(type=cms.string("EESrFlagsSorted")), cms.PSet(type=cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance=cms.string( "EcalIntegrityBlockSizeErrors")), cms.PSet(type=cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance=cms.string( "EcalIntegrityTTIdErrors")))), # convert ECAL digis from SoA format on gpu to legacy format on cpu cuda=cms.EDProducer( "EcalCPUDigisProducer", digisInLabelEB=cms.InputTag("hltEcalDigisGPU", "ebDigis"), digisInLabelEE=cms.InputTag("hltEcalDigisGPU", "eeDigis"), digisOutLabelEB=cms.string("ebDigis"), digisOutLabelEE=cms.string("eeDigis"), produceDummyIntegrityCollections=cms.bool(True))) # ECAL multifit running on gpu from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitProducerGPU_cfi import ecalUncalibRecHitProducerGPU as _ecalUncalibRecHitProducerGPU process.hltEcalUncalibRecHitGPU = _ecalUncalibRecHitProducerGPU.clone( digisLabelEB=("hltEcalDigisGPU", "ebDigis"), digisLabelEE=("hltEcalDigisGPU", "eeDigis"), shouldRunTimingComputation=False) # copy the ECAL uncalibrated rechits from gpu to cpu in SoA format process.hltEcalUncalibRecHitSoA = cms.EDProducer( "EcalCPUUncalibRecHitProducer", containsTimingInformation=cms.bool(False), recHitsInLabelEB=cms.InputTag("hltEcalUncalibRecHitGPU", "EcalUncalibRecHitsEB"), recHitsInLabelEE=cms.InputTag("hltEcalUncalibRecHitGPU", "EcalUncalibRecHitsEE"), recHitsOutLabelEB=cms.string("EcalUncalibRecHitsEB"), recHitsOutLabelEE=cms.string("EcalUncalibRecHitsEE")) # SwitchProducer wrapping the legacy ECAL uncalibrated rechits producer or a converter from SoA to legacy format process.hltEcalUncalibRecHit = SwitchProducerCUDA( # legacy producer cpu=process.hltEcalUncalibRecHit, # convert the ECAL uncalibrated rechits from SoA to legacy format cuda=cms.EDProducer( "EcalUncalibRecHitConvertGPU2CPUFormat", recHitsLabelGPUEB=cms.InputTag("hltEcalUncalibRecHitSoA", "EcalUncalibRecHitsEB"), recHitsLabelGPUEE=cms.InputTag("hltEcalUncalibRecHitSoA", "EcalUncalibRecHitsEE"), recHitsLabelCPUEB=cms.string("EcalUncalibRecHitsEB"), recHitsLabelCPUEE=cms.string("EcalUncalibRecHitsEE"))) # Reconstructing the ECAL calibrated rechits on gpu works, but is extremely slow. # Disable it for the time being, until the performance has been addressed. """ process.hltEcalRecHitGPU = cms.EDProducer("EcalRecHitProducerGPU", uncalibrecHitsInLabelEB = cms.InputTag("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEB"), uncalibrecHitsInLabelEE = cms.InputTag("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEE"), recHitsLabelEB = cms.string("EcalRecHitsEB"), recHitsLabelEE = cms.string("EcalRecHitsEE"), maxNumberHitsEB = cms.uint32(61200), maxNumberHitsEE = cms.uint32(14648), ChannelStatusToBeExcluded = cms.vstring( "kDAC", "kNoisy", "kNNoisy", "kFixedG6", "kFixedG1", "kFixedG0", "kNonRespondingIsolated", "kDeadVFE", "kDeadFE", "kNoDataNoTP"), killDeadChannels = cms.bool(True), EBLaserMIN = cms.double(0.01), EELaserMIN = cms.double(0.01), EBLaserMAX = cms.double(30.0), EELaserMAX = cms.double(30.0), flagsMapDBReco = cms.PSet( kGood = cms.vstring("kOk","kDAC","kNoLaser","kNoisy"), kNoisy = cms.vstring("kNNoisy","kFixedG6","kFixedG1"), kNeighboursRecovered = cms.vstring("kFixedG0", "kNonRespondingIsolated", "kDeadVFE"), kTowerRecovered = cms.vstring("kDeadFE"), kDead = cms.vstring("kNoDataNoTP") ), recoverEBIsolatedChannels = cms.bool(False), recoverEEIsolatedChannels = cms.bool(False), recoverEBVFE = cms.bool(False), recoverEEVFE = cms.bool(False), recoverEBFE = cms.bool(True), recoverEEFE = cms.bool(True), ) process.hltEcalRecHitSoA = cms.EDProducer("EcalCPURecHitProducer", recHitsInLabelEB = cms.InputTag("hltEcalRecHitGPU", "EcalRecHitsEB"), recHitsInLabelEE = cms.InputTag("hltEcalRecHitGPU", "EcalRecHitsEE"), recHitsOutLabelEB = cms.string("EcalRecHitsEB"), recHitsOutLabelEE = cms.string("EcalRecHitsEE"), containsTimingInformation = cms.bool(False), ) # SwitchProducer wrapping the legacy ECAL calibrated rechits producer or a converter from SoA to legacy format process.hltEcalRecHit = SwitchProducerCUDA( # legacy producer cpu = process.hltEcalRecHit, # convert the ECAL calibrated rechits from SoA to legacy format cuda = cms.EDProducer("EcalRecHitConvertGPU2CPUFormat", recHitsLabelGPUEB = cms.InputTag("hltEcalRecHitSoA", "EcalRecHitsEB"), recHitsLabelGPUEE = cms.InputTag("hltEcalRecHitSoA", "EcalRecHitsEE"), recHitsLabelCPUEB = cms.string("EcalRecHitsEB"), recHitsLabelCPUEE = cms.string("EcalRecHitsEE"), ) """ # SwitchProducer wrapping the legacy ECAL rechits producer # the gpu unpacker does not produce the TPs used for the recovery, so the SwitchProducer alias does not provide them: # - the cpu uncalibrated rechit producer may mark them for recovery, read the TPs explicitly from the legacy unpacker # - the gpu uncalibrated rechit producer does not flag them for recovery, so the TPs are not necessary process.hltEcalRecHit = SwitchProducerCUDA( cpu=process.hltEcalRecHit.clone( triggerPrimitiveDigiCollection=cms.InputTag( 'hltEcalDigisLegacy', 'EcalTriggerPrimitives')), cuda=process.hltEcalRecHit.clone( triggerPrimitiveDigiCollection=cms.InputTag('unused'))) # Tasks and Sequences process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask = cms.Task( process.hltEcalDigisGPU, # unpack ECAL digis on gpu process. hltEcalDigisLegacy, # legacy producer, referenced in the SwitchProducer process.hltEcalDigis, # SwitchProducer process. hltEcalUncalibRecHitGPU, # run ECAL local reconstruction and multifit on gpu process. hltEcalUncalibRecHitSoA, # needed by hltEcalPhiSymFilter - copy to host process. hltEcalUncalibRecHit, # needed by hltEcalPhiSymFilter - convert to legacy format # process.hltEcalRecHitGPU, # make ECAL calibrated rechits on gpu # process.hltEcalRecHitSoA, # copy to host process.hltEcalDetIdToBeRecovered, # legacy producer process.hltEcalRecHit) # legacy producer process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask) process.HLTPreshowerTask = cms.Task( process. hltEcalPreshowerDigis, # unpack ECAL preshower digis on the host process.hltEcalPreshowerRecHit ) # build ECAL preshower rechits on the host process.HLTPreshowerSequence = cms.Sequence(process.HLTPreshowerTask) process.HLTDoFullUnpackingEgammaEcalTask = cms.Task( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask, process.HLTPreshowerTask) process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalTask) process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalTask) # done return process
import FWCore.ParameterSet.Config as cms from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA # ECAL unpacker running on CPU from EventFilter.EcalRawToDigi.EcalUnpackerData_cfi import ecalEBunpacker as _ecalEBunpacker ecalDigis = SwitchProducerCUDA(cpu=_ecalEBunpacker.clone()) ecalDigisTask = cms.Task( # ECAL unpacker running on CPU ecalDigis) # process modifier to run on GPUs from Configuration.ProcessModifiers.gpu_cff import gpu # ECAL conditions used by the unpacker running on GPU from EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi import ecalElectronicsMappingGPUESProducer # ECAL unpacker running on GPU from EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi import ecalRawToDigiGPU as _ecalRawToDigiGPU ecalDigisGPU = _ecalRawToDigiGPU.clone() # disable the ECAL unpacker collections that are not available in the GPU unpacker gpu.toModify(ecalDigis.cpu, headerUnpacking=False, memUnpacking=False) # extend the SwitchProducer to add a case to copy the ECAL digis from GPU to CPU and covert them from SoA to legacy format from EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi import ecalCPUDigisProducer as _ecalCPUDigisProducer gpu.toModify( ecalDigis, # copy the ECAL digis from GPU to CPU and covert them from SoA to legacy format cuda=_ecalCPUDigisProducer.clone(digisInLabelEB=('ecalDigisGPU', 'ebDigis'),
def customisePixelLocalReconstruction(process): if not 'HLTDoLocalPixelSequence' in process.__dict__: return process # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases process.HLTDoLocalPixelSequence = cms.Sequence() # Event Setup process.load( "CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi" ) # this should be used only on GPUs, will crash otherwise process.load( "CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi" ) # this should be used only on GPUs, will crash otherwise process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi") # Modules and EDAliases # referenced in HLTDoLocalPixelTask # transfer the beamspot to the gpu from RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi import offlineBeamSpotToCUDA as _offlineBeamSpotToCUDA process.hltOnlineBeamSpotToCUDA = _offlineBeamSpotToCUDA.clone( src="hltOnlineBeamSpot") # reconstruct the pixel digis and clusters on the gpu from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone() # use the pixel channel calibrations scheme for Run 3 run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2=False) # copy the pixel digis errors to the host from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone( src="hltSiPixelClustersCUDA") # convert the pixel digis errors to the legacy format from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA process.hltSiPixelDigiErrors = _siPixelDigiErrorsFromSoA.clone( digiErrorSoASrc="hltSiPixelDigiErrorsSoA", UsePhase1=True) # copy the pixel digis (except errors) and clusters to the host from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone( src="hltSiPixelClustersCUDA") # convert the pixel digis (except errors) and clusters to the legacy format from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA process.hltSiPixelDigisClusters = _siPixelDigisClustersFromSoA.clone( src="hltSiPixelDigisSoA") # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA process.hltSiPixelDigis = SwitchProducerCUDA( # legacy producer cpu=process.hltSiPixelDigis, # alias used to access products from multiple conversion modules cuda=cms.EDAlias( hltSiPixelDigisClusters=cms.VPSet( cms.PSet(type=cms.string("PixelDigiedmDetSetVector"))), hltSiPixelDigiErrors=cms.VPSet( cms.PSet(type=cms.string("DetIdedmEDCollection")), cms.PSet( type=cms.string("SiPixelRawDataErroredmDetSetVector")), cms.PSet( type=cms.string("PixelFEDChanneledmNewDetSetVector"))))) # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA process.hltSiPixelClusters = SwitchProducerCUDA( # legacy producer cpu=process.hltSiPixelClusters, # alias used to access products from multiple conversion modules cuda=cms.EDAlias(hltSiPixelDigisClusters=cms.VPSet( cms.PSet(type=cms.string("SiPixelClusteredmNewDetSetVector"))))) # reconstruct the pixel rechits on the gpu from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone( src="hltSiPixelClustersCUDA", beamSpot="hltOnlineBeamSpotToCUDA") # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA process.hltSiPixelRecHits = SwitchProducerCUDA( # legacy producer cpu=process.hltSiPixelRecHits, # converter to legacy format cuda=_siPixelRecHitFromCUDA.clone( pixelRecHitSrc="hltSiPixelRecHitsCUDA", src="hltSiPixelClusters")) # Tasks and Sequences process.HLTDoLocalPixelTask = cms.Task( process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu process. hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu process. hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu process. hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host process. hltSiPixelDigisClusters, # convert the pixel digis (except errors) and clusters to the legacy format process. hltSiPixelDigiErrorsSoA, # copy the pixel digis errors to the host process. hltSiPixelDigiErrors, # convert the pixel digis errors to the legacy format process. hltSiPixelDigis, # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA process. hltSiPixelClusters, # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA process. hltSiPixelClustersCache, # legacy module, used by the legacy pixel quadruplet producer process.hltSiPixelRecHits ) # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask) # done return process
def customisePixelLocalReconstruction(process): if not 'HLTDoLocalPixelSequence' in process.__dict__: return process # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTDoLocalPixelSequence = cms.Sequence() # Event Setup process.load( "CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi" ) # this should be used only on GPUs, will crash otherwise process.load( "CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi" ) # this should be used only on GPUs, will crash otherwise process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi") # Modules and EDAliases # referenced in HLTDoLocalPixelTask # transfer the beamspot to the gpu from RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi import offlineBeamSpotToCUDA as _offlineBeamSpotToCUDA process.hltOnlineBeamSpotToCUDA = _offlineBeamSpotToCUDA.clone( src="hltOnlineBeamSpot") # reconstruct the pixel digis and clusters on the gpu from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone( # use the same thresholds as the legacy module clusterThreshold_layer1=process.hltSiPixelClusters.ClusterThreshold_L1, clusterThreshold_otherLayers=process.hltSiPixelClusters. ClusterThreshold) # use the pixel channel calibrations scheme for Run 3 run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2=False) # copy the pixel digis errors to the host from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone( src="hltSiPixelClustersCUDA") # copy the pixel digis (except errors) and clusters to the host from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone( src="hltSiPixelClustersCUDA") # reconstruct the pixel digis on the cpu process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone() # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA process.hltSiPixelDigis = SwitchProducerCUDA( # legacy producer cpu=cms.EDAlias(hltSiPixelDigisLegacy=cms.VPSet( cms.PSet(type=cms.string("DetIdedmEDCollection")), cms.PSet(type=cms.string("SiPixelRawDataErroredmDetSetVector")), cms.PSet(type=cms.string("PixelFEDChanneledmNewDetSetVector")))), # conversion from SoA to legacy format cuda=_siPixelDigiErrorsFromSoA.clone( digiErrorSoASrc="hltSiPixelDigiErrorsSoA", UsePhase1=True)) # reconstruct the pixel clusters on the cpu process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone( src="hltSiPixelDigisLegacy") # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters to the legacy format from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA process.hltSiPixelClusters = SwitchProducerCUDA( # legacy producer cpu=cms.EDAlias(hltSiPixelClustersLegacy=cms.VPSet( cms.PSet(type=cms.string("SiPixelClusteredmNewDetSetVector")))), # conversion from SoA to legacy format cuda=_siPixelDigisClustersFromSoA.clone( src="hltSiPixelDigisSoA", produceDigis=False, storeDigis=False, # use the same thresholds as the legacy module clusterThreshold_layer1=process.hltSiPixelClusters. ClusterThreshold_L1, clusterThreshold_otherLayers=process.hltSiPixelClusters. ClusterThreshold)) # reconstruct the pixel rechits on the gpu from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone( src="hltSiPixelClustersCUDA", beamSpot="hltOnlineBeamSpotToCUDA") # cpu only: produce the pixel rechits in SoA and legacy format, from the legacy clusters from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitSoAFromLegacy process.hltSiPixelRecHitSoA = _siPixelRecHitSoAFromLegacy.clone( src="hltSiPixelClusters", beamSpot="hltOnlineBeamSpot", convertToLegacy=True) # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA process.hltSiPixelRecHits = SwitchProducerCUDA( # legacy producer cpu=cms.EDAlias(hltSiPixelRecHitSoA=cms.VPSet( cms.PSet(type=cms.string("SiPixelRecHitedmNewDetSetVector")), cms.PSet(type=cms.string("uintAsHostProduct")))), # conversion from SoA to legacy format cuda=_siPixelRecHitFromCUDA.clone( pixelRecHitSrc="hltSiPixelRecHitsCUDA", src="hltSiPixelClusters")) # Tasks and Sequences process.HLTDoLocalPixelTask = cms.Task( process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu process. hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu process. hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu process. hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host process. hltSiPixelDigiErrorsSoA, # copy the pixel digis errors to the host process.hltSiPixelDigisLegacy, # legacy pixel digis producer process. hltSiPixelDigis, # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors from SoA process.hltSiPixelClustersLegacy, # legacy pixel cluster producer process. hltSiPixelClusters, # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters from SoA process. hltSiPixelClustersCache, # legacy module, used by the legacy pixel quadruplet producer process. hltSiPixelRecHitSoA, # pixel rechits on cpu, in SoA & legacy format process.hltSiPixelRecHits ) # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask) # workaround for AlCa paths for AlCaPathName in [ 'AlCa_LumiPixelsCounts_Random_v1', 'AlCa_LumiPixelsCounts_ZeroBias_v1' ]: if AlCaPathName in process.__dict__: AlCaPath = getattr(process, AlCaPathName) # replace hltSiPixelDigis+hltSiPixelClusters with HLTDoLocalPixelSequence hasSiPixelDigis, hasSiPixelClusters = False, False for (itemLabel, itemName) in AlCaPath.directDependencies(): if itemLabel != 'modules': continue if itemName == 'hltSiPixelDigis': hasSiPixelDigis = True elif itemName == 'hltSiPixelClusters': hasSiPixelClusters = True if hasSiPixelDigis and hasSiPixelClusters: AlCaPath.remove(process.hltSiPixelClusters) AlCaPath.replace(process.hltSiPixelDigis, process.HLTDoLocalPixelSequence) # done return process