Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the gpu modifier at HLT [12.0.x] #34979

Merged
merged 3 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,12 @@ def condition(self, fragment, stepList, key, hasHarvest):
# - 2021 conditions, TTbar
# - 2021 conditions, Z->mumu,
class PatatrackWorkflow(UpgradeWorkflow):
def __init__(self, reco, harvest, **kwargs):
def __init__(self, digi = {}, reco = {}, harvest = {}, **kwargs):
# adapt the parameters for the UpgradeWorkflow init method
super(PatatrackWorkflow, self).__init__(
steps = [
'Digi',
'DigiTrigger',
'Reco',
'HARVEST',
'RecoFakeHLT',
Expand All @@ -427,6 +429,7 @@ def __init__(self, reco, harvest, **kwargs):
],
PU = [],
**kwargs)
self.__digi = digi
self.__reco = reco
self.__reco.update({
'--datatier': 'GEN-SIM-RECO,DQMIO',
Expand All @@ -451,13 +454,18 @@ def condition(self, fragment, stepList, key, hasHarvest):
return result

def setup_(self, step, stepName, stepDict, k, properties):
if 'Reco' in step:
if 'Digi' in step:
stepDict[stepName][k] = merge([self.__digi, stepDict[step][k]])
elif 'Reco' in step:
stepDict[stepName][k] = merge([self.__reco, stepDict[step][k]])
elif 'HARVEST' in step:
stepDict[stepName][k] = merge([self.__harvest, stepDict[step][k]])


upgradeWFs['PatatrackPixelOnlyCPU'] = PatatrackWorkflow(
digi = {
# there is no customisation for enabling the Patatrack pixel quadruplets running only on the CPU
},
reco = {
'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
'--procModifiers': 'pixelNtupletFit'
Expand All @@ -470,6 +478,9 @@ def setup_(self, step, stepName, stepDict, k, properties):
)

upgradeWFs['PatatrackPixelOnlyGPU'] = PatatrackWorkflow(
digi = {
'--procModifiers': 'gpu'
},
reco = {
'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
'--procModifiers': 'pixelNtupletFit,gpu'
Expand All @@ -482,6 +493,9 @@ def setup_(self, step, stepName, stepDict, k, properties):
)

upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = PatatrackWorkflow(
digi = {
# there is no customisation for enabling the Patatrack pixel triplets running only on the CPU
},
reco = {
'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
'--procModifiers': 'pixelNtupletFit',
Expand All @@ -495,6 +509,10 @@ def setup_(self, step, stepName, stepDict, k, properties):
)

upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = PatatrackWorkflow(
digi = {
'--procModifiers': 'gpu',
'--customise': 'HLTrigger/Configuration/customizeHLTforPatatrack.enablePatatrackPixelTriplets'
},
reco = {
'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
'--procModifiers': 'pixelNtupletFit,gpu',
Expand All @@ -519,6 +537,9 @@ def setup_(self, step, stepName, stepDict, k, properties):
)

upgradeWFs['PatatrackECALOnlyGPU'] = PatatrackWorkflow(
digi = {
'--procModifiers': 'gpu'
},
reco = {
'-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly',
'--procModifiers': 'gpu'
Expand All @@ -542,6 +563,9 @@ def setup_(self, step, stepName, stepDict, k, properties):
)

upgradeWFs['PatatrackHCALOnlyGPU'] = PatatrackWorkflow(
digi = {
'--procModifiers': 'gpu'
},
reco = {
'-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only',
'--procModifiers': 'gpu'
Expand Down
7 changes: 7 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import FWCore.ParameterSet.Config as cms

# modifiers
from Configuration.ProcessModifiers.gpu_cff import gpu

# helper fuctions
from HLTrigger.Configuration.common import *

Expand Down Expand Up @@ -133,6 +136,10 @@ def customiseFor2018Input(process):
# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):

# if the gpu modifier is enabled, make the Pixel, ECAL and HCAL reconstruction offloadable to a GPU
from HLTrigger.Configuration.customizeHLTforPatatrack import customizeHLTforPatatrack
gpu.makeProcessModifier(customizeHLTforPatatrack).apply(process)

# add call to action function in proper order: newest last!
# process = customiseFor12718(process)

Expand Down
59 changes: 29 additions & 30 deletions HLTrigger/Configuration/python/customizeHLTforPatatrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,51 +131,50 @@ def customisePixelLocalReconstruction(process):
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"
)
# reconstruct the pixel digis on the cpu
process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone()

# SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA
# 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 = 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(
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
)
)

# SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
# reconstruct the pixel clusters on the cpu
process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone()

# 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 = process.hltSiPixelClusters,
# alias used to access products from multiple conversion modules
cuda = cms.EDAlias(
hltSiPixelDigisClusters = cms.VPSet(
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,
)
)

Expand All @@ -191,7 +190,7 @@ def customisePixelLocalReconstruction(process):
process.hltSiPixelRecHits = SwitchProducerCUDA(
# legacy producer
cpu = process.hltSiPixelRecHits,
# converter to legacy format
# conversion from SoA to legacy format
cuda = _siPixelRecHitFromCUDA.clone(
pixelRecHitSrc = "hltSiPixelRecHitsCUDA",
src = "hltSiPixelClusters"
Expand All @@ -206,11 +205,11 @@ def customisePixelLocalReconstruction(process):
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.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

Expand Down