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

Cleaning up subProcesses looping. #16292

Merged
merged 3 commits into from Oct 25, 2016
Merged

Conversation

knoepfel
Copy link
Contributor

First commit is only spacing. Second commit removes need for calling hasSubProcesses multiple times.

- 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
@cmsbuild
Copy link
Contributor

A new Pull Request was created by @knoepfel for CMSSW_8_1_X.

It involves the following packages:

FWCore/Framework
FWCore/ParameterSet
FWCore/ServiceRegistry

@cmsbuild, @smuzaffar, @Dr15Jones, @davidlange6 can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @wddgit, @wmtan this is something you requested to watch as well.
@slava77, @smuzaffar you are the release manager for this.

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(
Copy link
Contributor

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.

Copy link
Contributor Author

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();
Copy link
Contributor

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.

Copy link
Contributor

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&.

Copy link
Contributor Author

@knoepfel knoepfel Oct 21, 2016

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&.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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 :).

@Dr15Jones
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 20, 2016

@Dr15Jones
Copy link
Contributor

@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.

@cmsbuild
Copy link
Contributor

-1

Tested at: d29f764

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

I found follow errors while testing this PR

Failed tests: Build

  • 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


@cmsbuild
Copy link
Contributor

Comparison not run due to Build errors (RelVals and Igprof tests were also skipped)

@Dr15Jones
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 21, 2016

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

@cmsbuild
Copy link
Contributor

-1

Tested at: d29f764

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

I found follow errors while testing this PR

Failed tests: UnitTests

  • Unit Tests:

I found errors in the following unit tests:

@knoepfel
Copy link
Contributor Author

@Dr15Jones Changes made and pushed to this fork.

@Dr15Jones
Copy link
Contributor

please test

@Dr15Jones
Copy link
Contributor

@smuzaffar The reason the previous test report said it failed, is at the end of the log it had

>> Tests for package DQMServices/Components ran.
config/SCRAM/GMake/Makefile.rules:1965: recipe for target 'unittests_TestPoolInput' failed
gmake: *** [unittests_TestPoolInput] Terminated

any idea what that means?

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 21, 2016

@cmsbuild
Copy link
Contributor

Pull request #16292 was updated. @cmsbuild, @smuzaffar, @Dr15Jones, @davidlange6 can you please check and sign again.

@smuzaffar
Copy link
Contributor

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.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

@Dr15Jones
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

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

@davidlange6
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 1ba792a into cms-sw:CMSSW_8_1_X Oct 25, 2016
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

5 participants