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 eb8fe88 commit df4e1ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/DIRAC/Resources/Computing/InProcessComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def submitJob(self, executableFile, proxy=None, inputs=None, **kwargs):
:return: S_OK(payload exit code) / S_ERROR() if submission issue
"""
payloadEnv = dict(os.environ)
if mp_threads := kwargs.get("numberOfProcessors"):
payloadEnv["OMP_NUM_THREADS"] = mp_threads
payloadProxy = ""
if proxy:
self.log.verbose("Setting up proxy for payload")
Expand Down
1 change: 1 addition & 0 deletions src/DIRAC/Resources/Computing/PoolComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def submitJob(self, executableFile, proxy=None, inputs=None, **kwargs):
# Here we define task kwargs: adding complex objects like thread.Lock can trigger errors in the task
taskKwargs = {"InnerCESubmissionType": self.innerCESubmissionType}
taskKwargs["jobDesc"] = kwargs.get("jobDesc", {})
taskKwargs["numberOfProcessors"] = kwargs.get("numberOfProcessors")

# Submission
future = self.pPool.submit(executeJob, executableFile, proxy, self.taskID, inputs, **taskKwargs)
Expand Down

0 comments on commit df4e1ff

Please sign in to comment.