From 1b8e56378ae6ad20536aaa0dd8eb7797b2655722 Mon Sep 17 00:00:00 2001 From: vdwalts Date: Mon, 1 Aug 2016 21:58:19 +0100 Subject: [PATCH] FEM: use new pref for manually set num processor cores in ccx run --- src/Mod/Fem/FemToolsCcx.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Mod/Fem/FemToolsCcx.py b/src/Mod/Fem/FemToolsCcx.py index 517865aaa..b7b713523 100644 --- a/src/Mod/Fem/FemToolsCcx.py +++ b/src/Mod/Fem/FemToolsCcx.py @@ -153,9 +153,14 @@ class FemToolsCcx(FemTools.FemTools): self.ccx_stderr = "" if self.inp_file_name != "" and self.ccx_binary_present: ont_backup = os.environ.get('OMP_NUM_THREADS') + self.ccx_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Ccx") + num_cpu_pref = self.ccx_prefs.GetInt("AnalysisNumCPUs", 1) # If number of CPU's specified if not ont_backup: - ont_backup = "" - _env = os.putenv('OMP_NUM_THREADS', str(multiprocessing.cpu_count())) + ont_backup = str(num_cpu_pref) + if num_cpu_pref > 1: + _env = os.putenv('OMP_NUM_THREADS', str(num_cpu_pref)) # if user picked a number use that instead + else: + _env = os.putenv('OMP_NUM_THREADS', str(multiprocessing.cpu_count())) # change cwd because ccx may crash if directory has no write permission # there is also a limit of the length of file names so jump to the document directory cwd = QtCore.QDir.currentPath()