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

ngrenz: testing of stereo optimization #10963

Merged
merged 7 commits into from Sep 2, 2015

Conversation

ngrenz
Copy link
Contributor

@ngrenz ngrenz commented Aug 27, 2015

Optimization by reducing of operations for the stereo test, as well as avoiding of
object creation within TrackerHitAssociator.cc

The outputs are supposed to be unchanged.
Any comments and suggestions are welcome.

@ngrenz
Copy link
Contributor Author

ngrenz commented Aug 27, 2015

@boudoul FYI

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @ngrenz for CMSSW_7_6_X.

ngrenz: testing of stereo optimization

It involves the following packages:

DataFormats/SiStripDetId
DataFormats/TrackerCommon
SimTracker/TrackerHitAssociation

@cmsbuild, @cvuosalo, @civanch, @mdhildreth, @slava77 can you please review it and eventually sign? Thanks.
@makortel, @GiacomoSguazzoni, @rovere, @VinInn, @wmtford, @gpetruc, @cerati, @threus, @dgulhan this is something you requested to watch as well.
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.
If you are a L2 or a release manager you can ask for tests by saying 'please test' in the first line of a comment.
@Degano you are the release manager for this.
You can merge this pull request by typing 'merge' in the first line of your comment.

@civanch
Copy link
Contributor

civanch commented Aug 27, 2015

@ngrenz , having many "return" in an inline method disables inline. From my point of view, each inline method should have only one "return".

@@ -112,18 +112,18 @@ class SiStripDetId : public DetId {
// ---------- inline methods ----------
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@civanch sorry, do you refer to this comment

The functions have the same number of returns as in the previous program version
and the inline expression is never used.

I had thought to change the SiStripDetId::stereo() function to

inline uint32_t SiStripDetId::stereo() const { return ( ((id_>>sterStartBit_ ) & sterMask_ ) == 1 ) ? 1:0; }

but I am not sure whether the readability would suffer

Copy link
Contributor

Choose a reason for hiding this comment

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

@ngrenz , yes, it is the most effective c++ but I agree the readability is not the best. It is possible to have something like:

inline uit32_t SiStripDetId::stereo const
{
uit32_t k = 0;
if(1 == ((id_>>sterStartBit_ ) & sterMask_ )) { k = 1; }
return k;
}
similar solutions may be applied in other inlined methods from this header.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I will rewrite the function.

Do I need the inline expression?
Or rather I do not understand why there is the comment

 // ---------- inline methods ----------

but no inline expressions, in the original code

Copy link
Contributor

Choose a reason for hiding this comment

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

If implementation of a method is inside header file it is assumed to be inlined even without a declaration.

Copy link
Contributor

Choose a reason for hiding this comment

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

i find
return 1 == (id_>>sterStartBit_ ) & sterMask_ ) ? 1:0;

very clear and obvious

return ( id.rawId() - 2 );
} else { return 0; }
uint32_t testId = (id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_;
return ( testId == 1 || testId == 2) ? ( id.rawId() - testId ) : 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@VinInn your last comment was "It can only be 0, 1 or 2 .."
do you mean the output of tidGlued or the result of the calculation (id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_

if it is the calculation, then it is more efficient to compare testId with 0.

Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

to make clear
id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_
for ANY strip det is
0 for r-phi
1 for stereo
2 for glued
3 never

@slava77
Copy link
Contributor

slava77 commented Aug 27, 2015

@cmsbuild please test

@cmsbuild
Copy link
Contributor

The tests are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

Pull request #10963 was updated. @cmsbuild, @cvuosalo, @civanch, @mdhildreth, @slava77 can you please check and sign again.

@civanch
Copy link
Contributor

civanch commented Aug 27, 2015

please test

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

case 1: return W1A;
case 2: return W2A;
case 3: return W3A;
case 1: geometry = W1A;
Copy link
Contributor

Choose a reason for hiding this comment

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

you are missing "break;" after each assignment (otherwise everything below a selected "case" is executed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks

@slava77
Copy link
Contributor

slava77 commented Aug 28, 2015

@cmsbuild please test

@cmsbuild
Copy link
Contributor

The tests are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

Pull request #10963 was updated. @cmsbuild, @cvuosalo, @civanch, @mdhildreth, @slava77 can you please check and sign again.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

@civanch
Copy link
Contributor

civanch commented Aug 29, 2015

+1

@slava77
Copy link
Contributor

slava77 commented Sep 1, 2015

+1

for #10963 5dda346

  • changes in the code are visually OK (although the impact of optimization is not very clear, beyond lexically better expressions; after the compiler optimization there probably isn't that much of a difference)
    • is there a confirmed place where these changes help?
  • jenkins tests pass and comparisons with the baseline show no difference
  • checked locally with igprof running on 100 events or run2 data with prompt reco. At this level, there is no significant change. I checked a few methods that have DetId or TrackerTopology in the interface, but the CPU cost appeared to be about the same (within apparent per-job fluctuations of performance counts).

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 1, 2015

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_6_X IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @davidlange6, @Degano, @smuzaffar

@davidlange6
Copy link
Contributor

+1

cmsbuild added a commit that referenced this pull request Sep 2, 2015
ngrenz: testing of stereo optimization
@cmsbuild cmsbuild merged commit 97c4b3d into cms-sw:CMSSW_7_6_X Sep 2, 2015
@ngrenz ngrenz deleted the ngrenz_stereo branch December 18, 2015 10:48
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.

None yet

7 participants