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

sort by pt only good-quality tracks #42428

Merged

Conversation

silviodonato
Copy link
Contributor

PR description:

Solve #42374 (@slava77 @mmusich @Dr15Jones).
In RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc tracks are sorted by pT in the attempt to improve the reproducibility of the GPU results #38065.
However, track with bad quality (< minQuality) might have pT undefined. Bad-quality tracks are discarded later on ( https://github.com/cms-sw/cmssw/blob/CMSSW_13_1_0_pre2/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc#L190 )
This PR sorts by pT only tracks with good quality.
This should avoid the risk of crash due to sorting tracks with uninitialized parameters.

As bad-quality tracks are discarded, this PR should have no effects on physics results.

PR validation:

Added a debug printout in storeTracks(iEvent, tracks, httopo); and no changes are observed, as expected.

If this PR is a backport please specify the original PR and why you need to backport that PR. If this PR will be backported please specify to which release cycle the backport is meant for:

I'm not sure if a backport is necessary. Perhaps it would good to have it for 13_2_X (HIon).

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-42428/36432

  • This PR adds an extra 16KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @silviodonato (Silvio Donato) for master.

It involves the following packages:

  • RecoTracker/PixelTrackFitting (reconstruction)

@cmsbuild, @mandrenguyen, @clacaputo can you please review it and eventually sign? Thanks.
@VourMa, @felicepantaleo, @GiacomoSguazzoni, @JanFSchulte, @rovere, @VinInn, @missirol, @gpetruc, @mmusich, @mtosi, @dgulhan this is something you requested to watch as well.
@perrotta, @dpiparo, @rappoccio you are the release manager for this.

cms-bot commands are listed here

if (quality[i1] >= minQuality_ && quality[i2] >= minQuality_)
return tsoa.view()[i1].pt() > tsoa.view()[i2].pt();
else
return quality[i1] > quality[i2];
Copy link
Contributor

Choose a reason for hiding this comment

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

without thinking about this a lot more, I'm not 100% sure this forms a 'stable sort'. For all possible values, does this guarantee 'if A < B and B < C then A < C'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • if A and B have both good quality, they are sorted as usual
  • if only one of the two has good quality, that track will be sorted first
  • if A and B have both bad quality, they are sorted according to their quality (they will remain unsorted among them if they have the same quality)

The outcome should be unique:

quality     outcome
A B C  
good good good sorted by pT
good good bad AB sorted by pT, and then C
good bad good AC sorted by pT, and then B
bad good good BC sorted by pT, and then A
good bad bad A, and then BC sorted by quality
bad good bad B, and then AC sorted by quality
bad bad good C, and then AB sorted by quality
bad bad bad sorted by quality

Trying to making a more formal demonstration...

Demonstration that it is impossible having "A < B" and "B < C" and "A > C"

  • if all good qualities: pt(A)<pt(B) and pt(B)<pt(C) and pt(A)>pt(C) --> impossible because pt(A)<pt(B) and pt(B)<pt(C) implies pt(A)<pt(C)

  • if all bad qualities: quality(A)<quality(B) and quality(B)<quality(C) and quality(A)>quality(C) --> impossible, see above

  • if A has bad quality, A > C implies that C has bad quality, B < C implies that C has bad quality --> all bad qualities case

  • if B has bad quality, A < B implies that A has bad quality, A > C implies that C has bad quality --> all bad qualities case

  • if C has bad quality, B < C implies that B has bad quality, A < B implies that C has bad quality --> all bad qualities case

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it difficult to scan the pT and quality in a few events with bad quality tracks just to confirm the sort behaves as expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked that the persistent tracks in storeTracks are sorted by pT, as expected, which is the behavior of the current code. I can also check the transient track collection.
Anyway, the main point was to not get accessed to pt() for tracks with bad quality, which is exactly what this PR is doing

@mmusich
Copy link
Contributor

mmusich commented Jul 31, 2023

enable gpu

@mmusich
Copy link
Contributor

mmusich commented Jul 31, 2023

test parameters:

  • enable_tests = gpu
  • workflows_gpu = 11634.503, 11634.506, 11634.583, 11634.587
  • workflow = 11634.501
  • relvals_opt= -w standard,highstats,pileup,generator,extendedgen,production,upgrade,cleanedupgrade,ged

@mmusich
Copy link
Contributor

mmusich commented Jul 31, 2023

@cmsbuild, please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-2f1911/33991/summary.html
COMMIT: a7c4a22
CMSSW: CMSSW_13_3_X_2023-07-31-1100/el8_amd64_gcc11
Additional Tests: GPU
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/42428/33991/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: 10 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3166771
  • DQMHistoTests: Total failures: 6
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3166743
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 48 files compared)
  • Checked 211 log files, 164 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

GPU Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 72 differences found in the comparisons
  • DQMHistoTests: Total files compared: 7
  • DQMHistoTests: Total histograms compared: 112752
  • DQMHistoTests: Total failures: 3026
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 109726
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 6 files compared)
  • Checked 24 log files, 30 edm output root files, 7 DQM output files
  • TriggerResults: no differences found

@silviodonato
Copy link
Contributor Author

fyi @cms-sw/hlt-l2

@mandrenguyen
Copy link
Contributor

+reconstruction
Sorts only high quality tracks by pT and puts the low quality one at the end.
Small changes to pixel tracks are observed in GPU workflows, consistent with expectation.
Author checked that sort gives the desired behavior, see:
#42428 (comment)

@cmsbuild
Copy link
Contributor

cmsbuild commented Aug 2, 2023

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, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@perrotta
Copy link
Contributor

perrotta commented Aug 2, 2023

+1

  • Good quality tracks are sorted as before
  • Bad quality tracks are not sorted among themselves, they mantain the same order
  • This looks like being the desired behaviour

@cmsbuild cmsbuild merged commit a41eee2 into cms-sw:master Aug 2, 2023
fwyzard added a commit to fwyzard/cmssw that referenced this pull request Mar 17, 2024
Port from CUDA to Alpaka the changes in cms-sw#42428 by Silvio Donato.
fwyzard added a commit to fwyzard/cmssw that referenced this pull request Mar 17, 2024
Port from CUDA to Alpaka the changes in cms-sw#42428 by Silvio Donato.
fwyzard added a commit to fwyzard/cmssw that referenced this pull request Mar 18, 2024
Port from CUDA to Alpaka the changes in cms-sw#42428 by Silvio Donato.
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.

6 participants