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
Fix clang warnings in FastSimulation/SimplifiedGeometryPropagator #26429
Fix clang warnings in FastSimulation/SimplifiedGeometryPropagator #26429
Conversation
…S_THREAD_GUARD (reusing std::once_flag) and remove unused [this] from lambda expression
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-26429/9208
|
A new Pull Request was created by @fabiocos (Fabio Cossutti) for master. It involves the following packages: FastSimulation/SimplifiedGeometryPropagator @cmsbuild, @ssekmen, @lveldere, @mdhildreth, @civanch can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
The tests are being triggered in jenkins. |
-1 Tested at: 1048626 You can see the results of the tests here: I found follow errors while testing this PR Failed tests: ClangBuild
I found compilation warning while trying to compile with clang. Command used:
See details on the summary page. |
Comparison not run due to Build errors/Fireworks only changes/No short matrix requested (RelVals and Igprof tests were also skipped) |
@@ -200,8 +202,8 @@ namespace fastsim | |||
// TODO: Is this correct? | |||
// Thread safety | |||
static std::once_flag initializeOnce; | |||
[[cms::thread_guard("initializeOnce")]] std::vector< std::vector<double> > NuclearInteraction::theRatiosMap; | |||
[[cms::thread_guard("initializeOnce")]] std::map<int, int> NuclearInteraction::theIDMap; | |||
CMS_THREAD_GUARD(initializeOnce) std::vector< std::vector<double> > NuclearInteraction::theRatiosMap; |
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.
@Dr15Jones do you see what is different here wrt to the case of NuclearInteractionFTF ? I might simply restore the previous syntax removing the once_flag declaration, but I do not understand what is wrong here...
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.
indeed the other possible solution works in 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.
CMS_THREAD_GUARD(initializeOnce)
does not actually use the variable initializeOnce
, it just creates the string "initializeOnce"
. As far as I can tell, the variable is not actually used.
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.
The varaibles theRatiosMap
and theIDMap
are not handled in a thread-safe way.
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.
@Dr15Jones ok, in the case of NuclearInteractionFTF initializeOnce is then used by std::call_once, that is the difference
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-26429/9228
|
please test |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
@ssekmen this is a technical fix, could you please check it? |
+1 |
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. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
Fix clang warnings in FastSimulation/SimplifiedGeometryPropagator: use CMS_THREAD_GUARD, reuse std::once_flag in call_once to initialize static objects in NuclearInteraction, and remove unused [this] from lambda expression in plugin NuclearInteractionFTF.
PR validation:
Code compiles, workflow 2018.8 runs.