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

const thread-safe packed classes #11706

Merged
merged 3 commits into from Oct 15, 2015

Conversation

Dr15Jones
Copy link
Contributor

Made the mutable members of pat::PackedCandidate and pat::PackedGenParticle being changed in const functions be thread-safe. Added unit tests.

Made the updating of mutable members in const functions of
pat::PackedCandidate thread-safe. Added a unit test for the class.
Made the updating of mutable members in const functions of
pat::PackedGenParticle thread-safe. Added a unit test for the class.
@Dr15Jones
Copy link
Contributor Author

I didn't know of anyway to actually test that reading back the classes work correctly.

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2015

A new Pull Request was created by @Dr15Jones (Chris Jones) for CMSSW_7_6_X.

const thread-safe packed classes

It involves the following packages:

DataFormats/PatCandidates

@cmsbuild, @vadler, @monttj can you please review it and eventually sign? Thanks.
@gpetruc 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.

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2015

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/8715/console

statusFlags_(c.statusFlags()) { pack(); }
explicit PackedGenParticle( const reco::GenParticle & c, const edm::Ref<reco::GenParticleCollection> & mother)
: p4_(c.pt(), c.eta(), c.phi(), c.mass()), p4c_(p4_), vertex_(0,0,0), pdgId_(c.pdgId()), charge_(c.charge()), mother_(mother), unpacked_(true),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOTE: the vertex is not taken from the GenParticle. Is this intended?

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2015

-1
Tested at: 9b8d11b
I found an error when building:

>> Compiling edm plugin /tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc 
/tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc: In instantiation of 'pat::PATPackedCandidateProducer::sort_indexes(const std::vector<_RealType>&) const:: [with T = pat::PackedCandidate; size_t = long unsigned int]':
/tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc:61:52:   required from 'struct pat::PATPackedCandidateProducer::sort_indexes(const std::vector<_RealType>&) const [with T = pat::PackedCandidate]::'
/tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc:61:117:   required from 'std::vector pat::PATPackedCandidateProducer::sort_indexes(const std::vector<_RealType>&) const [with T = pat::PackedCandidate]'
/tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc:291:52:   required from here
/tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc:61:116: error: no matching function for call to 'pat::PackedCandidate::PackedCandidate(const value_type&)'
               std::sort(idx.begin(), idx.end(),[&v,this](size_t i1, size_t i2) { return candsOrdering(v[i1],v[i2]);});
                                                                                                                    ^
/tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc:61:116: note: candidate is:
In file included from /tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc:9:0:
/tmp/cmsbuild/workspace/ib-any-integration/CMSSW_7_6_X_2015-10-08-2300/src/DataFormats/PatCandidates/interface/PackedCandidate.h:34:5: note: pat::PackedCandidate::PackedCandidate()


you can see the results of the tests here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-11706/8715/summary.html

Using explicit with copy and move constructors causes problems with
some common patterns. The version generated by default by the compiler
do not use explicit.
@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2015

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/8725/console

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2015

Pull request #11706 was updated. @cmsbuild, @vadler, @monttj can you please check and sign again.

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2015

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2015

davidlange6 added a commit that referenced this pull request Oct 15, 2015
@davidlange6 davidlange6 merged commit cfc2edc into cms-sw:CMSSW_7_6_X Oct 15, 2015
@Dr15Jones Dr15Jones deleted the threadSafePackedCandidate branch October 19, 2015 14:08
@wmtan
Copy link
Contributor

wmtan commented Oct 19, 2015

@davidlange6 @Dr15Jones Chris asked me to look at this, but I have no idea how to reproduce the problem. I do not know which workflows reproduce the problem. nor how to generate and view the distributions that do not match.

@Dr15Jones
Copy link
Contributor Author

@wmtan I just drilled through the comparison to baseline plots and found 50202.0_TTbar_13+TTbar_13+DIGIUP15_PU50+RECOUP15_PU50+HARVESTUP15_PU50 to have a big difference if one clicks on that link, then goes to the 'ParticleFlow' and click on that pie chart then click on the pie chart for packedGenParticlesValidation then click on the 'CompWithGenParticles' pie chart.

So I suggest running workflow 50202.0. I searched from CompWithGenParticles and hit
http://cmslxr.fnal.gov/source/Validation/RecoParticleFlow/python/miniAODValidation_cff.py#0014
So you could look at that module to see what differences it is looking at.

@wmtan
Copy link
Contributor

wmtan commented Oct 19, 2015

@Dr15Jones The problem easily reproduces. In step3 of relval 50202.0, pat::PackedGenParticle is produced. The distributions of all data members (e.g. pt, Y, etc) are totally screwed up. The differences are far from subtle, and you can tell it is screwed up just by looking. No need to compare with the distributions prior to this PR to tell the distributions are wrong. I'll try to debug this tomorrow.
Some good news: The pat::PackedCandidate distributions look OK, so the problem is confined to
pat::PackedGenParticle.

@davidlange6
Copy link
Contributor

and this may or may not be related - but lots of warnings coming (I think) from these changes

https://cmssdt.cern.ch/SDT/cgi-bin/buildlogs/slc6_amd64_gcc493/CMSSW_7_6_X_2015-10-19-1100/DataFormats/PatCandidates

On Oct 20, 2015, at 1:27 AM, wmtan notifications@github.com wrote:

@Dr15Jones The problem easily reproduces. In step3 of relval 50202.0, pat::PackedGenParticle is produced. The distributions of all data members (e.g. pt, Y, etc) are totally screwed up. The differences are far from subtle, and you can tell it is screwed up just by looking. No need to compare with the distributions prior to this PR to tell the distributions are wrong. I'll try to debug this tomorrow.
Some good news: The pat::PackedCandidate distributions look OK, so the problem is confined to
pat::PackedGenParticle.


Reply to this email directly or view it on GitHub.

@Dr15Jones
Copy link
Contributor Author

We can make the warnings go away by using the macro CMS_THREAD_GUARD instead if the attribute directly.

@wmtan
Copy link
Contributor

wmtan commented Oct 20, 2015

#12000 fixes the discrepancies. It now also fixes the build warnings.

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

4 participants