-
Notifications
You must be signed in to change notification settings - Fork 30
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
GeometrySplit functor isn't threadsafe #1607
Conversation
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.
info
might be a bit too loud
Co-authored-by: Dmitry Kalinkin <[email protected]>
There was an alternative solution, overwriting the copy constructors for the class so that each copy has a new std::once_flag and does it's own initialization on the first call. Making everything needing initialized shared pointers feels cleaner. |
Are any of the CI tests run on multiple threads which would be possible to compare the output between a single and multi-threaded run? |
Looks like this was being partially approached in #975. For cases like this having at least one job still run on a single core to compare the output would be useful. Checking the default flags it appears nthreads should be 1 if not specified, however the behaviour change seen here was only identified by explicitly adding the -Pnthreads=1 flag. Doesn't sound like that should have made a difference, any idea why it did? |
Capybara summary for PR 1607 |
@nathanwbrei may be the best person to address that. |
Please could this be reviewed independently of the issues around running/testing with different numbers of threads, I can flag that as separate issue. |
Do we understand why these are copied in each thread in the first place? |
I'm not familiar enough with JANA2 resource management to comment but would be keen to hear an explanation. |
Quality Gate passedIssues Measures |
If possible could this be reviewed and merged before tagging for September, the Low-Q2 Tagger reconstruction is (variably) broken without it. The questions raised around the threads and JANA will still need addressing but can be answered later. |
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 get the idea, but not the details. Fine to merge IMO.
Briefly, what does this PR introduce?
Fixes issues with the initialization of the GeometrySplit functor across threads.
Currently only the std::once_flag is a shared pointer and none of the other variables which are being initialized. This meant that when copied to other threads the is_init flag was set but the decoder and geometry divisions had not been so the loop over the detector ids was always empty. This resulted in an apparent variable decrease in the efficiency of the Low-Q2 tagger depending on how many threads were asked for.
Unit tests for all of the meta factories and functors should be added as an issue to try head this off in the future but outwith this fix.
What kind of change does this PR introduce?
Please check if this PR fulfills the following:
Does this PR introduce breaking changes? What changes might users need to make to their code?
No
Does this PR change default behavior?
All of the Low-Q2 Tagger hits will be converted into clusters rather than just those run on the first thread to call the functor.