-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
const thread-safe packed classes #11706
Conversation
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.
I didn't know of anyway to actually test that reading back the classes work correctly. |
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. |
please test |
The tests are being triggered in jenkins. |
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), |
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.
NOTE: the vertex is not taken from the GenParticle. Is this intended?
-1 >> 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: |
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.
please test |
The tests are being triggered in jenkins. |
const thread-safe packed classes
@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. |
@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 |
@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. |
and this may or may not be related - but lots of warnings coming (I think) from these changes
|
We can make the warnings go away by using the macro CMS_THREAD_GUARD instead if the attribute directly. |
#12000 fixes the discrepancies. It now also fixes the build warnings. |
Made the mutable members of pat::PackedCandidate and pat::PackedGenParticle being changed in const functions be thread-safe. Added unit tests.