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

Throw an exception if a module requiring synchronization on lumi boundaries is used when concurrent lumis are enabled #35326

Merged
merged 4 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions FWCore/Concurrency/test/streamGrapher_stallMonitor_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

process.p = cms.Path(process.strt, process.t)

process.options = cms.untracked.PSet( numberOfStreams = cms.untracked.uint32(4),
numberOfThreads = cms.untracked.uint32(5))
process.options = dict( numberOfStreams = 4,
numberOfThreads = 5,
numberOfConcurrentLuminosityBlocks = 1)

process.add_(cms.Service("Tracer", printTimestamps = cms.untracked.bool(True)))
process.add_(cms.Service("StallMonitor", fileName = cms.untracked.string("stallMonitor.log")))
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/EventProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ namespace edm {
std::shared_ptr<EDLooperBase const> looper() const { return get_underlying_safe(looper_); }
std::shared_ptr<EDLooperBase>& looper() { return get_underlying_safe(looper_); }

void warnAboutModulesRequiringLuminosityBLockSynchronization() const;
void throwAboutModulesRequiringLuminosityBlockSynchronization() const;
void warnAboutLegacyModules() const;
//------------------------------------------------------------------
//
Expand Down
22 changes: 14 additions & 8 deletions FWCore/Framework/src/EventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ namespace edm {
actReg_->preBeginJobSignal_(pathsAndConsumesOfModules_, processContext_);

if (preallocations_.numberOfLuminosityBlocks() > 1) {
warnAboutModulesRequiringLuminosityBLockSynchronization();
throwAboutModulesRequiringLuminosityBlockSynchronization();
}
warnAboutLegacyModules();

Expand Down Expand Up @@ -2003,17 +2003,23 @@ namespace edm {
return false;
}

void EventProcessor::warnAboutModulesRequiringLuminosityBLockSynchronization() const {
std::unique_ptr<LogSystem> s;
void EventProcessor::throwAboutModulesRequiringLuminosityBlockSynchronization() const {
cms::Exception ex("ModulesSynchingOnLumis");
ex << "The framework is configured to use at least two streams, but the following modules\n"
<< "require synchronizing on LuminosityBlock boundaries:";
bool found = false;
for (auto worker : schedule_->allWorkers()) {
if (worker->wantsGlobalLuminosityBlocks() and worker->globalLuminosityBlocksQueue()) {
if (not s) {
s = std::make_unique<LogSystem>("ModulesSynchingOnLumis");
(*s) << "The following modules require synchronizing on LuminosityBlock boundaries:";
}
(*s) << "\n " << worker->description()->moduleName() << " " << worker->description()->moduleLabel();
found = true;
ex << "\n " << worker->description()->moduleName() << " " << worker->description()->moduleLabel();
}
}
if (found) {
ex << "\n\nThe situation can be fixed by either\n"
<< " * modifying the modules to support concurrent LuminosityBlocks (preferred), or\n"
<< " * setting 'process.options.numberOfConcurrentLuminosityBlocks = 1' in the configuration file";
throw ex;
}
}

void EventProcessor::warnAboutLegacyModules() const {
Expand Down
1 change: 1 addition & 0 deletions FWCore/Framework/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,4 @@
<test name="testFWCoreFrameworkBadScheduleException5" command="cmsRun ${LOCALTOP}/src/FWCore/Framework/test/test_bad_schedule_exception_message_cfg.py 5; grep -v 'Fatal Exception' test_bad_schedule_5.log | diff -q ${LOCALTOP}/src/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_5.log -"/>
<test name="testFWCoreFrameworkBadScheduleException6" command="cmsRun ${LOCALTOP}/src/FWCore/Framework/test/test_bad_schedule_exception_message_cfg.py 6; grep -v 'Fatal Exception' test_bad_schedule_6.log | diff -q ${LOCALTOP}/src/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_6.log -"/>
<test name="testFWCoreFrameworkBadScheduleException7" command="cmsRun ${LOCALTOP}/src/FWCore/Framework/test/test_bad_schedule_exception_message_cfg.py 7; grep -v 'Fatal Exception' test_bad_schedule_7.log | diff -q ${LOCALTOP}/src/FWCore/Framework/test/unit_test_outputs/test_bad_schedule_7.log -"/>
<test name="testFWCoreFrameworkModuleSynchLumiBoundary" command="run_module_synch_lumiboundary.sh"/>
9 changes: 9 additions & 0 deletions FWCore/Framework/test/run_module_synch_lumiboundary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Pass in name and status
function die { echo $1: status $2 ; exit $2; }

TEST_DIR=src/FWCore/Framework/test

cmsRun $TEST_DIR/test_module_synch_lumiboundary_cfg.py && die "module requiring synch on lumi boundaries test failed" 1
echo "module requiring synch on lumi boundaries test failed"
9 changes: 5 additions & 4 deletions FWCore/Framework/test/test_mayConsumes_deadlocking_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
process = cms.Process("DEADLOCKTEST")
process.source = cms.Source("EmptySource")

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(20000))
process.maxEvents.input = 20000

process.a = cms.EDAnalyzer("ConsumingOneSharedResourceAnalyzer",
valueMustMatch = cms.untracked.int32(1),
Expand All @@ -25,9 +25,10 @@
ivalue = cms.int32(2)
)

process.options = cms.untracked.PSet(
numberOfThreads = cms.untracked.uint32(2),
numberOfStreams = cms.untracked.uint32(0)
process.options = dict(
numberOfThreads = 2,
numberOfStreams = 0,
numberOfConcurrentLuminosityBlocks = 1
)

process.t = cms.Task(process.one, process.two)
Expand Down
10 changes: 10 additions & 0 deletions FWCore/Framework/test/test_module_synch_lumiboundary_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("Test")

process.source = cms.Source("EmptySource")
process.options.numberOfStreams = 2

process.a = cms.EDProducer("edmtest::one::WatchLumiBlocksProducer", transitions = cms.int32(0))

process.p = cms.Path(process.a)
9 changes: 5 additions & 4 deletions FWCore/Framework/test/test_no_concurrent_module_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

process.source = cms.Source("EmptySource")

process.options = cms.untracked.PSet(
numberOfStreams = cms.untracked.uint32(4),
numberOfThreads = cms.untracked.uint32(4)
process.options = dict(
numberOfStreams = 4,
numberOfThreads = 4,
numberOfConcurrentLuminosityBlocks = 1
)

process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(20))
process.maxEvents.input = 20

process.i1 = cms.EDProducer("BusyWaitIntLegacyProducer", ivalue = cms.int32(1),
iterations = cms.uint32(300*1000))
Expand Down
12 changes: 5 additions & 7 deletions FWCore/Framework/test/test_one_modules_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
process = cms.Process("TESTONEMODULES")

import FWCore.Framework.test.cmsExceptionsFatalOption_cff
process.options = cms.untracked.PSet(
numberOfStreams = cms.untracked.uint32(nStreams),
numberOfThreads = cms.untracked.uint32(nStreams)
)

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(nEvt)
process.options = dict(
numberOfStreams = nStreams,
numberOfThreads = nStreams,
numberOfConcurrentLuminosityBlocks = 1
)

process.maxEvents.input = nEvt

process.source = cms.Source("EmptySource",
timeBetweenEvents = cms.untracked.uint64(10),
Expand Down
19 changes: 7 additions & 12 deletions FWCore/Integration/test/TestParentage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "DataFormats/Provenance/interface/Provenance.h"
#include "DataFormats/TestObjects/interface/ToyProducts.h"
#include "FWCore/Framework/interface/ConstProductRegistry.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand Down Expand Up @@ -52,30 +52,25 @@ namespace {

namespace edmtest {

class TestParentage : public edm::EDAnalyzer {
class TestParentage : public edm::global::EDAnalyzer<> {
public:
explicit TestParentage(edm::ParameterSet const& pset);
virtual ~TestParentage();
~TestParentage() override = default;

virtual void analyze(edm::Event const& e, edm::EventSetup const& es) override;
virtual void analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const& es) const override;

private:
edm::InputTag inputTag_;
edm::EDGetTokenT<IntProduct> token_;
std::vector<std::string> expectedAncestors_;
bool callGetProvenance_;
};

TestParentage::TestParentage(edm::ParameterSet const& pset)
: inputTag_(pset.getParameter<edm::InputTag>("inputTag")),
: token_(consumes(pset.getParameter<edm::InputTag>("inputTag"))),
expectedAncestors_(pset.getParameter<std::vector<std::string> >("expectedAncestors")),
callGetProvenance_(pset.getUntrackedParameter<bool>("callGetProvenance", true)) {
token_ = consumes<IntProduct>(inputTag_);
}

TestParentage::~TestParentage() {}
callGetProvenance_(pset.getUntrackedParameter<bool>("callGetProvenance", true)) {}

void TestParentage::analyze(edm::Event const& e, edm::EventSetup const&) {
void TestParentage::analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const&) const {
edm::Handle<IntProduct> h = e.getHandle(token_);

edm::Provenance const* prov = h.provenance();
Expand Down