Skip to content

Commit

Permalink
Merge pull request #37128 from fwyzard/cmsDriver_accelerators_options
Browse files Browse the repository at this point in the history
Add an option to cmsDriver for selecting the accelerators to use
  • Loading branch information
cmsbuild committed Mar 4, 2022
2 parents f8493f9 + 2030726 commit 80e7ab3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Configuration/Applications/python/ConfigBuilder.py
Expand Up @@ -89,6 +89,7 @@ class Options:
defaultOptions.nStreams = '0'
defaultOptions.nConcurrentLumis = '0'
defaultOptions.nConcurrentIOVs = '1'
defaultOptions.accelerators = None

# some helper routines
def dumpPython(process,name):
Expand Down Expand Up @@ -2280,6 +2281,16 @@ def prepare(self, doChecking = False):
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 self._options.accelerators is not None:
accelerators = self._options.accelerators.split(',')
self.pythonCfgCode += "\n"
self.pythonCfgCode += "# Enable only these accelerator backends\n"
self.pythonCfgCode += "process.load('Configuration.StandardSequences.Accelerators_cff')\n"
self.pythonCfgCode += "process.options.accelerators = ['" + "', '".join(accelerators) + "']\n"
self.process.load('Configuration.StandardSequences.Accelerators_cff')
self.process.options.accelerators = accelerators

#repacked version
if self._options.isRepacked:
self.pythonCfgCode +="\n"
Expand Down
5 changes: 5 additions & 0 deletions Configuration/Applications/python/Options.py
Expand Up @@ -414,3 +414,8 @@
default=defaultOptions.nConcurrentIOVs,
dest='nConcurrentIOVs'
)
expertSettings.add_option("--accelerators",
help="Comma-separated list of accelerators to enable; if 'cpu' is not included, the job will fail if none of the accelerators is available (default is not set, enabling all available accelerators, including the cpu)",
default=None,
dest='accelerators'
)

0 comments on commit 80e7ab3

Please sign in to comment.