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

Add an option to cmsDriver for selecting the accelerators to use #37128

Merged
merged 1 commit into from
Mar 4, 2022
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
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'
)