-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
sort by pt only good-quality tracks #42428
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-42428/36432
|
A new Pull Request was created by @silviodonato (Silvio Donato) for master. It involves the following packages:
@cmsbuild, @mandrenguyen, @clacaputo can you please review it and eventually sign? Thanks. 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]; |
There was a problem hiding this comment.
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'?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
enable gpu |
test parameters:
|
@cmsbuild, please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-2f1911/33991/summary.html Comparison SummarySummary:
GPU Comparison SummarySummary:
|
fyi @cms-sw/hlt-l2 |
+reconstruction |
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) |
+1
|
Port from CUDA to Alpaka the changes in cms-sw#42428 by Silvio Donato.
Port from CUDA to Alpaka the changes in cms-sw#42428 by Silvio Donato.
Port from CUDA to Alpaka the changes in cms-sw#42428 by Silvio Donato.
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).