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

[14_0_X] Removed variable-length arrays #44936

Merged
merged 1 commit into from
May 14, 2024

Conversation

aehart
Copy link
Contributor

@aehart aehart commented May 8, 2024

PR description:

This PR removes all variable-length arrays in the L1Trigger/TrackFinding* packages, which turns out to just be in L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc. This led to stack overflows, and ultimately segfaults, in CMSSW_14_1_0_pre3 on certain events, as reported in #44306 (comment).

PR validation:

With the fixes in this PR, the specific job that was reported to segfault is now able to run to completion.

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:

Although the crash reported in #44306 (comment) is only seen in 14_1, we include this backport for safety.

Original PR: #44935

@cmsbuild
Copy link
Contributor

cmsbuild commented May 8, 2024

A new Pull Request was created by @aehart for CMSSW_14_0_X.

It involves the following packages:

  • L1Trigger/TrackFindingTracklet (l1)

@epalencia, @cmsbuild, @aloeliger can you please review it and eventually sign? Thanks.
@missirol, @skinnari, @Martin-Grunewald, @erikbutz this is something you requested to watch as well.
@rappoccio, @antoniovilela, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

cmsbuild commented May 8, 2024

cms-bot internal usage

@srimanob
Copy link
Contributor

srimanob commented May 8, 2024

@cmsbuild please test

@cmsbuild
Copy link
Contributor

cmsbuild commented May 8, 2024

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-06d76c/39314/summary.html
COMMIT: 9b9fd8d
CMSSW: CMSSW_14_0_X_2024-05-08-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/44936/39314/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially removed 29 lines from the logs
  • Reco comparison results: 52 differences found in the comparisons
  • DQMHistoTests: Total files compared: 48
  • DQMHistoTests: Total histograms compared: 3327413
  • DQMHistoTests: Total failures: 8
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 3327384
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.004 KiB( 47 files compared)
  • DQMHistoSizes: changed ( 312.0 ): -0.004 KiB MessageLogger/Warnings
  • Checked 202 log files, 165 edm output root files, 48 DQM output files
  • TriggerResults: no differences found

}
}
// Initialize all-false 2D vector of tracks being duplicates to other tracks
vector<vector<bool>> dupMap(numStublists, vector<bool>(numStublists, false));
Copy link
Contributor

Choose a reason for hiding this comment

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

If symmetric and storage is an issue why not using triangular storage?
btw interesting enough vector<bool> uses one bit per entry while bool v[N] will use a full byte...

}
}
}

// Check to see if the track is a duplicate
for (unsigned int itrk = 0; itrk < numStublists; itrk++) {
for (unsigned int jtrk = 0; jtrk < numStublists; jtrk++) {
if (dupMap[itrk][jtrk]) {
noMerge[itrk] = true;
if (dupMap.at(itrk).at(jtrk)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why at?
please use at only for debugging, never in production code.

dupMap[itrk][jtrk] = true;
dupMap[jtrk][itrk] = true;
dupMap.at(itrk).at(jtrk) = true;
dupMap.at(jtrk).at(itrk) = true;
}
}
}

// Check to see if the track is a duplicate
for (unsigned int itrk = 0; itrk < numStublists; itrk++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why this loop at all?
just set noMerge[itrk] = true; where one set the dupMap.

@@ -316,7 +308,7 @@ void PurgeDuplicate::execute(std::vector<Track>& outputtracks, unsigned int iSec
for (unsigned int itrk = 0; itrk < numStublists - 1; itrk++) {
for (unsigned int jtrk = itrk + 1; jtrk < numStublists; jtrk++) {
// Merge a track with its first duplicate found.
Copy link
Contributor

@VinInn VinInn May 9, 2024

Choose a reason for hiding this comment

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

here is said "merge with the first duplicate found" but I no not see any break, so what prevents to merge with all other duplicates?

If really one merges with just the first found than there is no need of the dupMap: it is enough for each track to keep record of the first duplicate...

I think the whole algorithm need a review as most probably all those large maps and vectors are not needed...

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed

@srimanob
Copy link
Contributor

Hi @VinInn @aehart @cms-sw/l1-l2

Thanks @VinInn for reviewing the code. As this is a backport PR (and master is already merged), should we merge as it? Then we have a follow up PR to follow up reviewing. Thx.

@aloeliger
Copy link
Contributor

+l1

  • I see no issue merging it. @aehart Are you the one ultimately responsible for this code/algorithm? Would it be possible to discuss some of @VinInn's comments more in depth?

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_14_0_X IBs (tests are also fine) and once validation in the development release cycle CMSSW_14_1_X is complete. This pull request will now be reviewed by the release team before it's merged. @rappoccio, @antoniovilela, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2)

@aehart
Copy link
Contributor Author

aehart commented May 10, 2024

* I see no issue merging it. @aehart Are you the one ultimately responsible for this code/algorithm? Would it be possible to discuss some of @VinInn's comments more in depth?

I think I ultimately share responsibility for this code with @tomalin and @zdemirag, and I'm happy to discuss @VinInn's comments in whatever forum makes sense.

@tomalin
Copy link
Contributor

tomalin commented May 10, 2024

This PR looks OK to me. I've asked one of the authors of this class to check the comments made above about improving the code further.

@antoniovilela
Copy link
Contributor

@aehart @tomalin @cms-sw/l1-l2
If there is no urgency for the backport, I see no problem in being deliberate and going through all comments from @VinInn. You could make a new PR for master and merge the changes from both master PRs as a single backport in this PR.

@antoniovilela
Copy link
Contributor

+1

  • Merge as discussed at ORP. Please follow up on remaining comments.

@cmsbuild cmsbuild merged commit d8e5329 into cms-sw:CMSSW_14_0_X May 14, 2024
10 checks passed
@aehart aehart deleted the array_fix_14_0_X branch May 15, 2024 11:09
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.

7 participants