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

Removed use of static in DefaultMeasure::UpdateAxesFast #9

Merged

Conversation

Dr15Jones
Copy link

The use of static arrays in DefaultMeasure::UpdateAxesFast caused
thread-safety problems. The stated reason for using the arrays
was to avoid allocation/deallocation but that was also achievable
by having the arrays just be on the stack.

@cmsbuild
Copy link

cmsbuild commented Dec 9, 2015

A new Pull Request was created by @Dr15Jones (Chris Jones) for branch cms/v1.020.

@cmsbuild, @smuzaffar, @Degano, @iahmad-khan, @davidlange6 can you please review it and eventually sign? Thanks.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.

external issue cms-sw/cmsdist#2025

@Dr15Jones
Copy link
Author

@smuzaffar @davidlange6 I'm testing now to be sure this solves all the remaining problems with Njettiness

@Dr15Jones
Copy link
Author

The test shows that this does fix the problem: step3 of workflow 50208.0 always fails without this change and succeeds with the change.

// some storage, declared static to save allocation/re-allocation costs
static LightLikeAxis new_axes[N];
static fastjet::PseudoJet new_jets[N];
// some storage, declared on stack to save allocation/re-allocation costs
Copy link

Choose a reason for hiding this comment

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

I don't see how this comment makes sense anymore. The arrays will be constructed and destroyed every time this method is called, so there will be some performance cost compared to declaring them static. The change is necessary for thread-safety, but the comment should be deleted.

Choose a reason for hiding this comment

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

agree, comment now does not make any sense.
@Dr15Jones , can you update it and then I will merge it for 23h00 IB.

Copy link
Author

Choose a reason for hiding this comment

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

I had interpreted the comment to be relative to new and delete. Looks to me like the following for loop could also be removed now.

Choose a reason for hiding this comment

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

yes make sense to remove the for loop

The use of static arrays in DefaultMeasure::UpdateAxesFast caused
thread-safety problems. The stated reason for using the arrays
was to avoid allocation/deallocation but that was also achievable
by having the arrays just be on the stack.
@Dr15Jones Dr15Jones force-pushed the removeStaticDefaultMeasure branch from 03b7b81 to e93521f Compare December 9, 2015 18:55
@cmsbuild
Copy link

cmsbuild commented Dec 9, 2015

Pull request #9 was updated.

external issue cms-sw/cmsdist#2025

@Dr15Jones
Copy link
Author

I have made the suggested changes

@Dr15Jones
Copy link
Author

I ran my test after the code change and everything still works.

smuzaffar added a commit that referenced this pull request Dec 9, 2015
Removed use of static in DefaultMeasure::UpdateAxesFast
@smuzaffar smuzaffar merged commit 42297db into cms-externals:cms/v1.020 Dec 9, 2015
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.

4 participants