Skip to content

Commit

Permalink
feat: set env variable OMP_NUM_THREADS
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Nov 27, 2023
1 parent df4e1ff commit 2018021
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DIRAC/Resources/Computing/InProcessComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def submitJob(self, executableFile, proxy=None, inputs=None, **kwargs):
"""
payloadEnv = dict(os.environ)
if mp_threads := kwargs.get("numberOfProcessors"):
payloadEnv["OMP_NUM_THREADS"] = mp_threads
payloadEnv["OMP_NUM_THREADS"] = str(mp_threads)
payloadProxy = ""
if proxy:
self.log.verbose("Setting up proxy for payload")
Expand Down
4 changes: 4 additions & 0 deletions src/DIRAC/Resources/Computing/SingularityComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
r"Xrd.*",
r"DIRAC_.*",
r"BEARER_TOKEN.*",
r"OMP_NUM_TREADS",
]
ENV_VAR_WHITELIST = re.compile(r"^(" + r"|".join(ENV_VAR_WHITELIST) + r")$")

Expand Down Expand Up @@ -374,6 +375,9 @@ def submitJob(self, executableFile, proxy=None, **kwargs):
baseDir = ret["baseDir"]
tmpDir = ret["tmpDir"]

if mp_threads := kwargs.get("numberOfProcessors"):
os.environ["OMP_NUM_THREADS"] = str(mp_threads)

if proxy:
payloadProxyLoc = ret["proxyLocation"]

Expand Down

0 comments on commit 2018021

Please sign in to comment.