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

Backport Puppi speedups [10_6_X] #37718

Merged
merged 4 commits into from May 12, 2022

Conversation

kpedro88
Copy link
Contributor

PR description:

This PR is a combined backport of three speedups for Puppi:

  1. Use reserve for vectors of candidates (see Puppi speedup: use reserve for vectors #37717)
  2. Avoid creating/filling reco objects unnecessarily in useExistingWeights case (based on Simplify PUPPI Photon producer and change PUPPI isolation algo #27929)
  3. Avoid use of unnecessary candidate vector and temporary object in useExistingWeights case (based on Fix a discrepancy in Puppi weights when running on MiniAOD w/ useExistingWeights=False #28033)

In my test of the useExistingWeights case (on a UL17 ttbar sample), the combination of these three changes reduced the CPU usage of PuppiProducer by 50%.

PR validation:

Code compiles and runs. CPU impact quantified with igprof. Compared AK8 jet pT in a ttbar workflow to confirm that no changes occurred.

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

See above. Reason: to speed up ultra-legacy analysis processing.

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @kpedro88 (Kevin Pedro) for CMSSW_10_6_X.

It involves the following packages:

  • CommonTools/PileupAlgos (reconstruction)

@jpata, @cmsbuild, @clacaputo, @slava77 can you please review it and eventually sign? Thanks.
@rappoccio, @jdolen, @ahinzmann, @missirol, @gkasieczka, @hatakeyamak 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

@kpedro88
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-6021ad/24287/summary.html
COMMIT: 8bf214a
CMSSW: CMSSW_10_6_X_2022-04-24-0000/slc7_amd64_gcc700
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/37718/24287/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 35
  • DQMHistoTests: Total histograms compared: 3215686
  • DQMHistoTests: Total failures: 2
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3215350
  • DQMHistoTests: Total skipped: 334
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 34 files compared)
  • Checked 143 log files, 29 edm output root files, 35 DQM output files
  • TriggerResults: no differences found

@jpata
Copy link
Contributor

jpata commented Apr 29, 2022

type jetmet

@clacaputo
Copy link
Contributor

test parameters

  • enable_test = profiling

@clacaputo
Copy link
Contributor

@cmsbuild please test

@smuzaffar
Copy link
Contributor

smuzaffar commented May 3, 2022

@jpata @kpedro88 , looks like the default workflow for profiling 35234.21 ( https://github.com/cms-sw/cms-bot/pull/1721/files ) is not available in 10.6.X that is why PR profiling job is failing . If profiling is needed for 10.6.X then can we adjust bot to use a different workflow?

@jpata
Copy link
Contributor

jpata commented May 3, 2022

Actually we were not sure what will happen when profiling in this backport, good to know that it fails due to the missing Phase2 workflow. I guess it's not critical here, one can rely on the profiling in the master.

@kpedro88
Copy link
Contributor Author

kpedro88 commented May 3, 2022

To my recollection, none of the prodlike workflows used for profiling are available in 10_6_X.

@cmsbuild
Copy link
Contributor

cmsbuild commented May 3, 2022

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-6021ad/24373/summary.html
COMMIT: 8bf214a
CMSSW: CMSSW_10_6_X_2022-05-01-0000/slc7_amd64_gcc700
Additional Tests: PROFILING
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/37718/24373/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 35
  • DQMHistoTests: Total histograms compared: 3215686
  • DQMHistoTests: Total failures: 2
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3215350
  • DQMHistoTests: Total skipped: 334
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 34 files compared)
  • Checked 143 log files, 29 edm output root files, 35 DQM output files
  • TriggerResults: no differences found

@clacaputo
Copy link
Contributor

+reconstruction

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_10_6_X IBs (tests are also fine) and once validation in the development release cycle CMSSW_12_4_X is complete. 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)

Copy link
Contributor

@perrotta perrotta left a comment

Choose a reason for hiding this comment

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

Since you are cleaning and you are not verbatim backporting the three PRs, you can also consider:

@@ -287,33 +282,36 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
const reco::PFCandidate *cand = dynamic_cast<const reco::PFCandidate*>(&aCand);
pfCand.reset( new reco::PFCandidate( cand ? *cand : reco::PFCandidate(aCand.charge(), aCand.p4(), id) ) );
}
LorentzVector pVec;

//get an index to a pup in lCandidates: either fUseExistingWeights with no skips or get from fPuppiContainer
int iPuppiMatched = fUseExistingWeights ? val : fPuppiContainer->recoToPup()[val];
Copy link
Contributor

Choose a reason for hiding this comment

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

    if ( fUseExistingWeights ) {
      puppiP4s.emplace_back(lWeights[val]*aCand.px(), lWeights[val]*aCand.py(), lWeights[val]*aCand.pz(), lWeights[val]*aCand.energy());
    }
    else {
      int iPuppiMatched = fPuppiContainer->recoToPup()[val];
      if ( iPuppiMatched >= 0 ) {

@kpedro88
Copy link
Contributor Author

@perrotta done in the latest commit

@cmsbuild
Copy link
Contributor

Pull request #37718 was updated. @jpata, @cmsbuild, @clacaputo, @slava77 can you please check and sign again.

@kpedro88
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-6021ad/24630/summary.html
COMMIT: 839d0c3
CMSSW: CMSSW_10_6_X_2022-05-08-0000/slc7_amd64_gcc700
Additional Tests: PROFILING
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/37718/24630/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 2 differences found in the comparisons
  • DQMHistoTests: Total files compared: 35
  • DQMHistoTests: Total histograms compared: 3215686
  • DQMHistoTests: Total failures: 2
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3215350
  • DQMHistoTests: Total skipped: 334
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 34 files compared)
  • Checked 143 log files, 29 edm output root files, 35 DQM output files
  • TriggerResults: no differences found

@clacaputo
Copy link
Contributor

+reconstruction

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_10_6_X IBs (tests are also fine) and once validation in the development release cycle CMSSW_12_4_X is complete. 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

  • Code speedup, no changes on outputs

@cmsbuild cmsbuild merged commit 6c0fc64 into cms-sw:CMSSW_10_6_X May 12, 2022
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.

None yet

6 participants