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
Cleaning up subProcesses looping. #16292
Conversation
- Changed subProcesses_ to be a vector<SubProcess> object, instead of smart pointer to same. If empty, looping over the object is a nop. - Change return type of popVParameterSet() to vector<ParameterSet> instead of unique_ptr to same. I don't believe this introduced any breaking changes, outside of FWCore. Conflicts: FWCore/Framework/interface/SubProcess.h FWCore/Framework/src/EventProcessor.cc FWCore/Framework/src/SubProcess.cc FWCore/ParameterSet/src/ProcessDesc.cc
A new Pull Request was created by @knoepfel for CMSSW_8_1_X. It involves the following packages: FWCore/Framework @cmsbuild, @smuzaffar, @Dr15Jones, @davidlange6 can you please review it and eventually sign? Thanks. cms-bot commands are listed here #13028 |
std::make_pair(itPS->getUntrackedParameter<std::string>("type", "*"), | ||
itPS->getUntrackedParameter<std::string>("label", ""))); | ||
for(auto const& ps : excluded) { | ||
eventSetupDataToExcludeFromPrefetching_[ps.getUntrackedParameter<std::string>("record")].insert( |
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.
emplace
would avoid the need to create a std::pair
.
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.
Yep. I limited most of my changes to subProcesses_
, but this one could easily go in, too.
@@ -486,13 +483,13 @@ namespace edm { | |||
ScheduleItems items; | |||
|
|||
//initialize the services | |||
std::shared_ptr<std::vector<ParameterSet> > pServiceSets = processDesc->getServicesPSets(); | |||
ServiceToken token = items.initServices(*pServiceSets, *parameterSet, iToken, iLegacy, true); | |||
auto pServiceSets = processDesc->getServicesPSets(); |
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 believe the p
in pServiceSets
stood for pointer. Now it could just be serviceSets
.
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.
This is also forcing a copy. Is the copy needed? if not then it should be changed to auto const&
.
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.
Can change pServiceSets
to serviceSets
. There's no copy though...it's a move-construction of pServiceSets
, which is slightly less efficient than auto const&
.
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 do not believe you are correct. The signature for the member function is
auto const& getServicesPSets() const {return services_;}
Therefore it can not do a move construction and must do a copy.
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.
Ack! Good catch. Will change.
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.
Turns out it needed to be auto&
, since initServices
requires an lvalue reference.
bool hasSubProcesses = subProcessVParameterSet.get() != nullptr; | ||
|
||
auto subProcessVParameterSet = popSubProcessVParameterSet(*processParameterSet_); | ||
bool hasSubProcesses = subProcessVParameterSet.size() != 0ull; |
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.
not subProcessVParameterSet.empty()
might be clearer.
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.
Agreed.
std::string name = it->getParameter<std::string>("@service_type"); | ||
if (name == service) { | ||
// Use the configured service. Don't add a default. | ||
// However, the service needs to be moved to the front because it is a standard service. | ||
ParameterSet pset = *it; | ||
services_->erase(it); | ||
services_.erase(it); |
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.
Does erasing invalidate the iterator? If so, then it isn't safe to do while using the iterator to loop.
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.
Well, the erase
was in there before I tweaked it. And yes, in general, it does invalidate the iterator. But in this case, and the following, the loop is exited immediately after the erase (either by return
or break
); it's therefore safe in these cases.
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.
Your right. I guess it's best not to try to review code just before your trying to go home :).
please test |
The tests are being triggered in jenkins. |
@davidlange6 although this shouldn't have any functional changes, it would be fine to have this wait until CMSSW_9_0 opens if that would make your life easier. |
-1 Tested at: d29f764 You can see the results of the tests here: I found follow errors while testing this PR Failed tests: Build
I found an error when building: from /build/cmsbuild/jenkins-workarea/workspace/ib-any-integration/CMSSW_8_1_X_2016-10-20-2300/src/CommonTools/Utils/src/TMVAEvaluator.cc:1: /cvmfs/cms-ib.cern.ch/week1/slc6_amd64_gcc530/cms/cmssw-patch/CMSSW_8_1_X_2016-10-20-2300/src/CondFormats/EgammaObjects/interface/GBRForest.h:1:1: warning: null character(s) ignored /build/cmsbuild/jenkins-workarea/workspace/ib-any-integration/CMSSW_8_1_X_2016-10-20-2300/src/CommonTools/Utils/src/ExpressionFunctionSetter.cc:6:35: warning: /cvmfs/cms-ib.cern.ch/2016-43/slc6_amd64_gcc530/lcg/root/6.06.08-giojec/include/Math/ProbFuncMathCore.h is shorter than expected >> Compiling /build/cmsbuild/jenkins-workarea/workspace/ib-any-integration/CMSSW_8_1_X_2016-10-20-2300/src/CommonTools/Utils/src/findMethod.cc In file included from /build/cmsbuild/jenkins-workarea/workspace/ib-any-integration/CMSSW_8_1_X_2016-10-20-2300/src/CommonTools/Utils/src/TMVAEvaluator.cc:1:0: /build/cmsbuild/jenkins-workarea/workspace/ib-any-integration/CMSSW_8_1_X_2016-10-20-2300/src/CommonTools/Utils/interface/TMVAEvaluator.h:39:41: error: missing binary operator before token "(" #if ROOT_VERSION_CODE < ROOT_VERSION(6,7,0) ^ In file included from /build/cmsbuild/jenkins-workarea/workspace/ib-any-integration/CMSSW_8_1_X_2016-10-20-2300/src/CommonTools/Utils/interface/TMVAZipReader.h:26:0, from /build/cmsbuild/jenkins-workarea/workspace/ib-any-integration/CMSSW_8_1_X_2016-10-20-2300/src/CommonTools/Utils/src/TMVAEvaluator.cc:3: /cvmfs/cms-ib.cern.ch/2016-43/slc6_amd64_gcc530/lcg/root/6.06.08-giojec/include/TMVA/Reader.h:1:1: warning: null character(s) ignored |
Comparison not run due to Build errors (RelVals and Igprof tests were also skipped) |
please test |
The tests are being triggered in jenkins. |
-1 Tested at: d29f764 You can see the results of the tests here: I found follow errors while testing this PR Failed tests: UnitTests
I found errors in the following unit tests: |
@Dr15Jones Changes made and pushed to this fork. |
please test |
@smuzaffar The reason the previous test report said it failed, is at the end of the log it had
any idea what that means? |
The tests are being triggered in jenkins. |
Pull request #16292 was updated. @cmsbuild, @smuzaffar, @Dr15Jones, @davidlange6 can you please check and sign again. |
For PR tests we have 2 hours for unittests to finish. As this PR is rebuilding a lot of packages so it could easily have hit the timeout. I am changing the limits now based on the checked out packages. |
Comparison job queued. |
+1 |
This pull request is fully signed and it will be integrated in one of the next CMSSW_8_1_X IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @slava77, @davidlange6, @smuzaffar |
+1 |
First commit is only spacing. Second commit removes need for calling hasSubProcesses multiple times.