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

updates to customizeHLTforPatatrack to limit overwriting of HLT modules #36721

Merged

Conversation

missirol
Copy link
Contributor

PR description:

This PR updates customizeHLTforPatatrack to limit cases where the customisation overwrites modules that may already exist in the HLT menu (e.g. the cpu 'branch' of certain SwitchProducers).

Reminder : currently, the HLT menu in cmssw:master contains the CPU part of the Patatrack developments (in other words, it contains SwitchProducers that only have a cpu branch, not a cuda one).

With this update, if a certain object exists already, it is not overwritten anymore, giving precedence to what is in the input configuration (usually, the HLT menu from ConfDB).

In particular, this resolves an action item from CMSHLT-2187, regarding the value of the parameter hltPixelTracksSoA.cpu.idealConditions; the latter is set to False in ConfDB, but is currently changed to True in customizeHLTforPatatrack; with this PR, the parameter remains as in the HLT menu if it is already present (i.e. False with the latest menus).

The PR also includes

  • an addition to customisePixelGainForRun2Input, to ensure that the parameter (SiPixelRawToClusterCUDA).isRun2 is set to True when Run-2 inputs are used (this would be needed once instances of SiPixelRawToClusterCUDA will come directly from the HLT config in ConfDB, with isRun2 set to False);
  • a bugfix for the handling of process.hltEcalRecHit.cuda (the bug was introduced in make customizeHLTforPatatrack even more robust #36536).

Changes in outputs are expected for wfs where customizeHLTforPatatrack is applied to the GRun menu, e.g. wf 11634.{506,512,522} (for example, because of hltPixelTracksSoA.cpu.idealConditions changing from True to False).

Profited from suggestions by @fwyzard.

FYI: @silviodonato

PR validation:

runTheMatrix.py -w gpu -l 11634.506,11634.512,11634.522, plus manual tests with hltGetConfiguration [..] --customise [..].

If this PR is a backport, please specify the original PR and why you need to backport that PR:

N/A

@missirol
Copy link
Contributor Author

type bugfix

a bugfix for the handling of process.hltEcalRecHit.cuda (the bug was introduced in #36536).

process.hltEcalRecHit.cuda = process.hltEcalRecHit.cpu.clone(
triggerPrimitiveDigiCollection = 'unused'
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bugfix for the handling of process.hltEcalRecHit.cuda (the bug was introduced in #36536).

After #36536, process.hltEcalRecHit.cuda would be added only if process.hltEcalRecHit was not a SwitchProducer in the input configuration. This condition is false in the latest menus, so for those process.hltEcalRecHit.cuda was not being added.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36721/27818

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @missirol (Marino Missiroli) for master.

It involves the following packages:

  • HLTrigger/Configuration (hlt)

@cmsbuild, @missirol, @Martin-Grunewald can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @silviodonato this is something you requested to watch as well.
@perrotta, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

Comment on lines +347 to +359
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
)
Copy link
Contributor Author

@missirol missirol Jan 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relates to the treatment of the value of process.hltPixelTracksSoA.idealConditions. If process.hltPixelTracksSoA.cpu already exists, it is not modified, and the GPU module (hltPixelTracksCUDA) is configured based on process.hltPixelTracksSoA.cpu.

@fwyzard
Copy link
Contributor

fwyzard commented Jan 28, 2022

You could define some helper functions to simplify the customisation:

def load_if_mising(process, label, config):
if label not in process.__dict__:
    process.load(config)

def load_if_missing_and_clone(_process, _config, _label, _alias = None, **kwargs):
    if _alias is None:
        _alias = _label
    if _alias not in _process.__dict__:
        module = __import__(_config, globals(), locals(), [ _label ], 0)
        setattr(_process, _alias, getattr(module, _label).clone(**kwargs)

to be used as

# these should be used only on GPUs, will crash otherwise
load_if_mising(process, 'siPixelGainCalibrationForHLTGPU', 'CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi')
load_if_mising(process, 'siPixelROCsStatusAndMappingWrapperESProducer', 'CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi')
...

# transfer the beamspot to the gpu
load_if_missing_and_clone(process, 'RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi', 'offlineBeamSpotToCUDA', 'hltOnlineBeamSpotToCUDA',
    src = "hltOnlineBeamSpot"
)

Please note that I did not test that they actually work... and maybe you can find more compact names :-)

I didn't try to come up with something that support a SwitchProducer, but I can look into it if needed.

@missirol
Copy link
Contributor Author

Thanks for the suggestion, @fwyzard . I'm trying to implement it.

What do you think about the following?

# Utility to load file "config" in the process,
# if the process does not already hold a module named "label"
# Example:
#   _load_if_missing(process, 'SomeESProducer', 'SubSystem.Package.SomeESProducer_cfi')
def _load_if_missing(process, label, config, check = True):
    if label not in process.__dict__:
        process.load(config)
    if check and label not in process.__dict__:
        raise Exception('process does not have a module labelled "'+label+'" after loading "'+config+'"')

# Utility to add "member" to "obj" (if "member" is missing),
# using a clone of module "label" from file "config"
# (if "label" is not specified, it is set equal to "member")
# Example:
#   _clone_if_missing(process, 'hltMyFilter', 'SubSystem.Package.hltSomeFilter_cfi', 'hltSomeFilter', src = 'mySrc')
def _clone_if_missing(obj, member, config, label = None, **kwargs):
    if label is None:
        label = member
    if not hasattr(obj, member):
        module = __import__(config, globals(), locals(), [ label ], 0)
        setattr(obj, member, getattr(module, label).clone(**kwargs))

The last function is slightly changed wrt to the original suggestion (also, from your snippet I didn't grasp if starting the function arguments with _ is important). It would allow to do both

_clone_if_missing(process, 'hltOnlineBeamSpotToCUDA', 'RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi', 'offlineBeamSpotToCUDA',
    src = "hltOnlineBeamSpot"
)

and

_clone_if_missing(process.hltSiPixelDigis, 'cuda', 'EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi', 'siPixelDigiErrorsFromSoA',
    digiErrorSoASrc = "hltSiPixelDigiErrorsSoA",
    UsePhase1 = True
)

.. so, one part of the SwitchProducer customisations.

@fwyzard
Copy link
Contributor

fwyzard commented Jan 28, 2022

from your snippet I didn't grasp if starting the function arguments with _ is important

that's to make it less likely that a function argument would clash with an argument intended for clone()

@fwyzard
Copy link
Contributor

fwyzard commented Jan 28, 2022

I'd suggest

def _clone_if_missing(_obj, _label, _config, _original_label = None, **kwargs):

to make the naming more consistent among the two functions.

@missirol missirol force-pushed the devel_hltCustomPatatrackLimitOverrides2 branch from 1556946 to e3f38a0 Compare January 28, 2022 17:40
@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36721/27996

@cmsbuild
Copy link
Contributor

Pull request #36721 was updated. @cmsbuild, @missirol, @Martin-Grunewald can you please check and sign again.

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 9, 2022

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36721/28233

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 9, 2022

Pull request #36721 was updated. @cmsbuild, @missirol, @Martin-Grunewald can you please check and sign again.

@missirol
Copy link
Contributor Author

missirol commented Feb 9, 2022

please test

Rebased, and improved handling of parameters for timing of ECAL RecHits (thanks to suggestions from Silvio and Andrea M.), in view of the upcoming updates in CMSHLT-2211.

@amassiro (cc: @fwyzard, @silviodonato), please have a look at 579db0b, and let me know if you have comments/corrections. Note that, in this customisation, hltEcalRecHit.cuda is cloned from hltEcalRecHit.cpu, so there is no need to edit hltEcalRecHit.cuda.skipTimeCalib explicitly.

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-b93920/22313/summary.html
COMMIT: 579db0b
CMSSW: CMSSW_12_3_X_2022-02-09-1100/slc7_amd64_gcc10
Additional Tests: GPU
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/36721/22313/install.sh to create a dev area with all the needed externals and cmssw changes.

GPU Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 24 differences found in the comparisons
  • DQMHistoTests: Total files compared: 4
  • DQMHistoTests: Total histograms compared: 19811
  • DQMHistoTests: Total failures: 953
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 18858
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 3 files compared)
  • Checked 12 log files, 9 edm output root files, 4 DQM output files
  • TriggerResults: found differences in 2 / 3 workflows

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 6 differences found in the comparisons
  • DQMHistoTests: Total files compared: 46
  • DQMHistoTests: Total histograms compared: 3765080
  • DQMHistoTests: Total failures: 13
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 3765044
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.004 KiB( 45 files compared)
  • DQMHistoSizes: changed ( 312.0 ): -0.004 KiB MessageLogger/Warnings
  • Checked 193 log files, 42 edm output root files, 46 DQM output files
  • TriggerResults: no differences found

@missirol
Copy link
Contributor Author

please test

re-running the tests, as the latest IBs include updates to the HLT menu (wrt the last tests of this PR)

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-b93920/22363/summary.html
COMMIT: 579db0b
CMSSW: CMSSW_12_3_X_2022-02-11-1400/slc7_amd64_gcc10
Additional Tests: GPU
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/36721/22363/install.sh to create a dev area with all the needed externals and cmssw changes.

GPU Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 6 differences found in the comparisons
  • DQMHistoTests: Total files compared: 4
  • DQMHistoTests: Total histograms compared: 19811
  • DQMHistoTests: Total failures: 1927
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 17884
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 3 files compared)
  • Checked 12 log files, 9 edm output root files, 4 DQM output files
  • TriggerResults: found differences in 2 / 3 workflows

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 46
  • DQMHistoTests: Total histograms compared: 3764395
  • DQMHistoTests: Total failures: 2
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3764371
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 45 files compared)
  • Checked 193 log files, 42 edm output root files, 46 DQM output files
  • TriggerResults: no differences found

@missirol
Copy link
Contributor Author

+hlt

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@perrotta
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit e84715c into cms-sw:master Feb 13, 2022
@missirol missirol deleted the devel_hltCustomPatatrackLimitOverrides2 branch March 27, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants