From 330e636f8ef18bcfc8baaefd42b3687d5b0745be Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 28 Mar 2022 23:44:41 +0200 Subject: [PATCH 1/2] Set concurrent lumis/IOVs if their value is different from default regardless of the number of threads It can happen that the job configuration is generated with cmsDriver without specifying the number of threads (i.e. that is 1), and ends up being used with number of threads being overridden. If the number of concurrent lumis/IOVs is set different from the default in such case, that setting would be lost. --- .../Applications/python/ConfigBuilder.py | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index 6a83d34958e97..809bb288a31b1 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -2279,19 +2279,31 @@ def prepare(self, doChecking = False): self.pythonCfgCode+="from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask\n" self.pythonCfgCode+="associatePatAlgosToolsTask(process)\n" - if self._options.nThreads != "1": + overrideThreads = (self._options.nThreads != "1") + overrideConcurrentLumis = (self._options.nConcurrentLumis != defaultOptions.nConcurrentLumis) + overrideConcurrentIOVs = (self._options.nConcurrentIOVs != defaultOptions.nConcurrentIOVs) + + if overrideThreads or overrideConcurrentLumis or overrideConcurrentIOVs: self.pythonCfgCode +="\n" self.pythonCfgCode +="#Setup FWK for multithreaded\n" - self.pythonCfgCode +="process.options.numberOfThreads = "+self._options.nThreads+"\n" - self.pythonCfgCode +="process.options.numberOfStreams = "+self._options.nStreams+"\n" - self.pythonCfgCode +="process.options.numberOfConcurrentLuminosityBlocks = "+self._options.nConcurrentLumis+"\n" - self.pythonCfgCode +="process.options.eventSetup.numberOfConcurrentIOVs = "+self._options.nConcurrentIOVs+"\n" - if int(self._options.nConcurrentLumis) > 1: - self.pythonCfgCode +="if hasattr(process, 'DQMStore'): process.DQMStore.assertLegacySafe=cms.untracked.bool(False)\n" - self.process.options.numberOfThreads = int(self._options.nThreads) - self.process.options.numberOfStreams = int(self._options.nStreams) - self.process.options.numberOfConcurrentLuminosityBlocks = int(self._options.nConcurrentLumis) - self.process.options.eventSetup.numberOfConcurrentIOVs = int(self._options.nConcurrentIOVs) + if overrideThreads: + self.pythonCfgCode +="process.options.numberOfThreads = "+self._options.nThreads+"\n" + self.pythonCfgCode +="process.options.numberOfStreams = "+self._options.nStreams+"\n" + self.process.options.numberOfThreads = int(self._options.nThreads) + self.process.options.numberOfStreams = int(self._options.nStreams) + if overrideConcurrentLumis: + self.pythonCfgCode +="process.options.numberOfConcurrentLuminosityBlocks = "+self._options.nConcurrentLumis+"\n" + self.process.options.numberOfConcurrentLuminosityBlocks = int(self._options.nConcurrentLumis) + if overrideConcurrentIOVs: + self.pythonCfgCode +="process.options.eventSetup.numberOfConcurrentIOVs = "+self._options.nConcurrentIOVs+"\n" + self.process.options.eventSetup.numberOfConcurrentIOVs = int(self._options.nConcurrentIOVs) + if self._options.nConcurrentLumis != "1": + # nConcurrentLumis == 0 implies that framework decides the + # value based on the number of streams, and the number of + # threads/streams can be set afterwards. The safest check + # is then to set assertLegacySafe == True only when + # explicitly asked to use 1 concurrent lumi. + self.pythonCfgCode +="if hasattr(process, 'DQMStore'): process.DQMStore.assertLegacySafe=cms.untracked.bool(False)\n" #repacked version if self._options.isRepacked: self.pythonCfgCode +="\n" From fc522dfd5f72a0ddaff02d5d9be401e3378c6fc3 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sun, 3 Apr 2022 00:25:53 +0200 Subject: [PATCH 2/2] Remove setting of DQMStore.assertLegacySafe as unnecessary This parameter was set to False already in https://github.com/cms-sw/cmssw/pull/34366 --- Configuration/Applications/python/ConfigBuilder.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index 809bb288a31b1..70084610d355d 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -2297,13 +2297,6 @@ def prepare(self, doChecking = False): if overrideConcurrentIOVs: self.pythonCfgCode +="process.options.eventSetup.numberOfConcurrentIOVs = "+self._options.nConcurrentIOVs+"\n" self.process.options.eventSetup.numberOfConcurrentIOVs = int(self._options.nConcurrentIOVs) - if self._options.nConcurrentLumis != "1": - # nConcurrentLumis == 0 implies that framework decides the - # value based on the number of streams, and the number of - # threads/streams can be set afterwards. The safest check - # is then to set assertLegacySafe == True only when - # explicitly asked to use 1 concurrent lumi. - self.pythonCfgCode +="if hasattr(process, 'DQMStore'): process.DQMStore.assertLegacySafe=cms.untracked.bool(False)\n" #repacked version if self._options.isRepacked: self.pythonCfgCode +="\n"