Setting multi-threaded calculation - preferences page

About the development of the FEM module/workbench.

Moderator: bernd

dawmhigh
Posts: 2
Joined: Tue Jan 03, 2017 10:09 pm

Re: Setting multi-threaded calculation - preferences page

Post by dawmhigh »

Hello again
i am using the newest version on linux Debian 8.6 (jessie) i compiled it too.
I found also the folder but i do not know which value i should change?

Code: Select all

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 = 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()))
@bernd can you help me ?

can you give me a short hint?

Best regards and a big thank from me to all how answered!!!!!
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Setting multi-threaded calculation - preferences page

Post by bernd »

- be sure you have multiple core hardware ;) --> ok
- use latest dev version, ATM 0.17.9529 --> ok
- in FEM CalculiX prefs, change the numbr of CPU count
- use Fem_RunSolver to run the analysis --> nothing is printed but the multiple core should be used
- if you have been using the Fem_RunSolver once you will get it in the Fem_ControlSolver too as long as you do not close FreeCAD. In Fem_ControlSolver you can see the num cpu in the output window in task panel.

hope this helps bernd
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Setting multi-threaded calculation - preferences page

Post by sgrogan »

bernd wrote:confirmed on
This "may" be within reach of my limited skills.
What would be the ideal behavior in terms of standard analysis dialog, quick analysis, and resetting system settings?
I'm thinking that it may be useful to be able to override the prefs in the dialog like it's possible to do with the working directory? Should this be persistent for a FreeCAD instance?
I personally like the old "greedy" behavior of the quick analysis to grab all system resources and use them. If it's possible to overide prefs in the dialog, the prefs could be set to a high value and over-ridden in the dialog if a lower value is desired.
Opinions?
"fight the good fight"
User avatar
makkemal
Posts: 395
Joined: Wed Apr 29, 2015 12:41 pm
Location: South Africa
Contact:

Re: Setting multi-threaded calculation - preferences page

Post by makkemal »

I think if a user picks any value that is larger than "1" the preferences value should override the system value.
If the preferences value is "1" the system values should be used i.e. 1 for normal analysis max CPU's for quick analysis.

My suggestion ?
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Setting multi-threaded calculation - preferences page

Post by sgrogan »

makkemal wrote:If the preferences value is "1" the system values should be used i.e. 1 for normal analysis max CPU's for quick analysis.
What is it doesn't exist? The value is ""
How I used this with the old behavior, either in a system environmental variable or setting the value for a terminal session, OMP_NUM_THREADS was used in the solver dialog, but quick analysis used available resources.
I do see makkemal's point, if a user set the variable to the default, it's seems this is an attempt to not allow it to be overridden.
"fight the good fight"
User avatar
makkemal
Posts: 395
Joined: Wed Apr 29, 2015 12:41 pm
Location: South Africa
Contact:

Re: Setting multi-threaded calculation - preferences page

Post by makkemal »

What is it doesn't exist? The value is ""
Not possible with current implementation defaults of "1" gets assigned
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Setting multi-threaded calculation - preferences page

Post by sgrogan »

makkemal wrote:Not possible with current implementation defaults of "1" gets assigned
Yes, I understand, I want to change the implantation. I think I can do it.
My proposal.
In the new implementation FreeCAD would have the same behavior for both quick and analysis dialog.
1. FreeCAD reads system value.
If the value equals "1" then FreeCAD uses "1" and leaves the system value unchanged.
Otherwise FreeCAD uses the FreeCAD pref value an restores the system value after each analysis run (including to null)
2. Next step is to allow to override the value in the standard analysis dialog. Then FreeCAD would use this value and reset after the analysis.
"fight the good fight"
User avatar
makkemal
Posts: 395
Joined: Wed Apr 29, 2015 12:41 pm
Location: South Africa
Contact:

Re: Setting multi-threaded calculation - preferences page

Post by makkemal »

My proposal.
In the new implementation FreeCAD would have the same behavior for both quick and analysis dialog.
1. FreeCAD reads system value.
If the value equals "1" then FreeCAD uses "1" and leaves the system value unchanged.
Otherwise FreeCAD uses the FreeCAD pref value an restores the system value after each analysis run (including to null)
2. Next step is to allow to override the value in the standard analysis dialog. Then FreeCAD would use this value and reset after the analysis.
This sounds like a good plan to me
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Setting multi-threaded calculation - preferences page

Post by bernd »

seams a good plan to me too. Go for it.
Post Reply