[announcement] multi-threading for Elmer

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

[announcement] multi-threading for Elmer

Post by uwestoehr »

There is a new feature in FEM that needs testing on different OSes:

It is now possible to run Elmer with several CPU cores.

-----------------
How?
- in the FEM WB go to the preferences and set for Elmer the number to a value > 1
- run Elmer as usual

Background info:
Elmer divides the mesh to portions equal to the number of used CPU cores. This a different approach than CalculiX and has some drawbacks:
- depending on your mesh a smaller number of CPU cores can run faster than using more cores
- in some cases using e.g 12 cored does not converge while 8 cores will work fine. The reason is that at some point the mesh portions become too small.
So in the end it is often necessary to adjust the number of cores, depending on the mesh.

Features?
- you can specify the number of used cores. As described, this is important
- FreeCAD can now import "Parallel (Partitioned) VTK Unstructured Data" files (*.pvtu). A *.pvtu is the result of a multi-threaded run but you can also now just load a *.ptvu you got from elsewhere.
- by default FreeCAD filters the results so that the mesh portion boundaries will become transparent too. However, to purposely made the mesh portion boundaries visible, there is a preferences option to turn off the filtering, see the images below.

Known limitation:
- for some simulation types you first need to install modules to Elmer to enable multi-threading. Check the Elmer report for info about this. A typical case is that for direct solving one has to install the MUMPS module.


Result of a heated metal rod put into streaming air:
FreeCAD_fC6Ydp8All.png
FreeCAD_fC6Ydp8All.png (49.05 KiB) Viewed 1928 times
The simulation was performed using 12 CPU cores and took 38 seconds. Down to 8 used cores the run time keeps at 42. With only one core the time increases up to 142 seconds.

When turning off the the filtering, you can see the mesh part portions:
FreeCAD_TJhw9Pphdk.png
FreeCAD_TJhw9Pphdk.png (108.61 KiB) Viewed 1928 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [announcement] multi-threading for Elmer

Post by Kunda1 »

Awesome news! Thanks uwe for this feature!
For those interested in testing, will this be backported and released in new minor-version OR is it assumed that testers should download the latest development versions for their respected platforms?

Edit: JFYI, Snap edge users will be able to test this feature once the new build has finished (~60+ minutes from now).
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [announcement] multi-threading for Elmer

Post by uwestoehr »

Kunda1 wrote: Sat Jul 16, 2022 2:56 pm For those interested in testing, will this be backported
This is new feature and changes the workflow significantly, therefore this will not be backported. I also expect that sooner or later some issue are discovered. I merged it to master to get more feedback and testing.
mst31
Posts: 19
Joined: Sun Apr 03, 2022 10:43 pm

Re: [announcement] multi-threading for Elmer

Post by mst31 »

Thanks!
I have tried to run multi-thread - all works. If I set one core in pereferences then Elmer runs one thread for assembling matrices stage and four threads for calculation stage (I have four thread CPU). If I set four cores then Elmer runs four threads on all stages.
But there is error in pereferences menu. When I changes number of cores then FreeCAD prints errors:
16:25:24 Unhandled std::exception caught in GUIApplication::notify.
The error message is: basic_string::substr: __pos (which is 18446744073709551612) > this->size() (which is 0)
After I closed menu I can't open it - error appears:
16:26:03 C++ exception thrown (basic_string::substr: __pos (which is 18446744073709551612) > this->size() (which is 0))

Code: Select all

OS: Linux Mint 20.3 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.21.29667 (Git)
Build type: Unknown
Branch: upstream/master
Hash: fba4663baa4a8b0932115700e3b726d04bf719b8
Python 3.8.10, Qt 5.12.8, Coin 4.0.0, Vtk 7.1.1, OCC 7.5.2
Locale: Russian/Russia (ru_RU)
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: [announcement] multi-threading for Elmer

Post by Jee-Bee »

Kunda1 wrote: Sat Jul 16, 2022 2:56 pm For those interested in testing, will this be backported and released in new minor-version
Am i right if i say that FC mis use backporting quite often? In my opinion backporting is mainly about fixing bugs and everything that can be seen as a Feature is just the next release...
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [announcement] multi-threading for Elmer

Post by uwestoehr »

Jee-Bee wrote: Tue Jul 19, 2022 3:55 pm Am i right if i say that FC mis use backporting quite often?
Where for example?
Jee-Bee wrote: Tue Jul 19, 2022 3:55 pm In my opinion backporting is mainly about fixing bugs and everything that can be seen as a Feature is just the next release...

Sure, see https://forum.freecadweb.org/viewtopic. ... 58#p610658
Post Reply