From df4e1ffba57877aa6d18b53749c922a502b5c0de Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Mon, 27 Nov 2023 16:13:38 +0100 Subject: [PATCH] feat: set env variable OMP_NUM_THREADS --- src/DIRAC/Resources/Computing/InProcessComputingElement.py | 2 ++ src/DIRAC/Resources/Computing/PoolComputingElement.py | 1 + 2 files changed, 3 insertions(+) diff --git a/src/DIRAC/Resources/Computing/InProcessComputingElement.py b/src/DIRAC/Resources/Computing/InProcessComputingElement.py index 00c48d5e884..39b3976284e 100755 --- a/src/DIRAC/Resources/Computing/InProcessComputingElement.py +++ b/src/DIRAC/Resources/Computing/InProcessComputingElement.py @@ -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") diff --git a/src/DIRAC/Resources/Computing/PoolComputingElement.py b/src/DIRAC/Resources/Computing/PoolComputingElement.py index 29196a2ff8d..38ea4b15d23 100644 --- a/src/DIRAC/Resources/Computing/PoolComputingElement.py +++ b/src/DIRAC/Resources/Computing/PoolComputingElement.py @@ -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)