Skip to content

Commit

Permalink
Add an option to cmsDriver for selecting the accelerators to use
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Mar 3, 2022
1 parent 4456728 commit 2030726
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 2030726

Please sign in to comment.