Fem: Make it possible to run CalculiX with one core - fixes #18339
This commit is contained in:
committed by
Chris Hennes
parent
51c0faff62
commit
fba8aad95d
@@ -300,11 +300,11 @@
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<property name="toolTip">
|
||||
<string>Set to zero to automatically use maximum number of available cores</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>40</number>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>AnalysisNumCPUs</cstring>
|
||||
|
||||
@@ -381,13 +381,11 @@ class _TaskPanel:
|
||||
# Set up for multi-threading. Note: same functionality as ccx_tools.py/start_ccx()
|
||||
ccx_prefs = FreeCAD.ParamGet(self.PREFS_PATH)
|
||||
env = QtCore.QProcessEnvironment.systemEnvironment()
|
||||
num_cpu_pref = ccx_prefs.GetInt("AnalysisNumCPUs", 1)
|
||||
if num_cpu_pref > 1:
|
||||
num_cpu_pref = ccx_prefs.GetInt("AnalysisNumCPUs", 0)
|
||||
if num_cpu_pref >= 1:
|
||||
env.insert("OMP_NUM_THREADS", str(num_cpu_pref))
|
||||
else:
|
||||
cpu_count = os.cpu_count()
|
||||
if cpu_count is not None and cpu_count > 1:
|
||||
env.insert("OMP_NUM_THREADS", str(cpu_count))
|
||||
env.insert("OMP_NUM_THREADS", str(QtCore.QThread.idealThreadCount()))
|
||||
self.Calculix.setProcessEnvironment(env)
|
||||
|
||||
self.cwd = QtCore.QDir.currentPath()
|
||||
|
||||
Reference in New Issue
Block a user