Use of multithreading

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

Post Reply
Ly. 明亮
Posts: 5
Joined: Thu 03 Dec 2020, 05:56

Use of multithreading

Post by Ly. 明亮 » Sun 09 May 2021, 09:19

Hi, Thorsten

Thank you for updating the latest version (openEMS_x64_v0.0.35-67-ga013077) of openEMS for Windows. After I installed the version, I checked it. The results are as follows:
check.JPG
check.JPG (99.33 KiB) Viewed 2452 times

My understanding of the above information is as follows. This version debugs multithreading issues:

(1) By default, 'engine=fastest' means that the CPU will automatically allocate threads for the program so that the simulation speed is the fastest and the time is the shortest.
(2)’engine=multithreading’ means to use multithreading simulation, and ‘multithreading=n’ means to use n thread simulation.

The above is my understanding of the multi-threaded simulation of the latest version of openEMS. Is my understanding correct?

I am using openEMS to simulate an electrically large antenna. Its size is 500*500*200mm and there are about 40,000,000 grids, which take a long time to run once. I have used the latest version of openEMS to simulate on my computer with 4 cores, 8 threads, and 32G RAM. The simulation log is as follows:
1.JPG
1.JPG (138.04 KiB) Viewed 2452 times
2.JPG
2.JPG (185.14 KiB) Viewed 2452 times
It can be seen that it will take 6 hours to run the program once, which will be a great waste of time. So I want to use multi-threading to speed up the program. At present, I have the following computer hardware configurations, and I want to test the running time of the program on them:

(1) PC: CPU-4 cores, 8 threads; RAM-32G; 3.6 GHz;
(2) PC: CPU-8 cores, 8 threads; RAM-24G; 3.2 GHz;
(3) PC: CPU-8 cores, 8 threads; RAM-32G; 3.6 GHz;
(4) PC: CPU-8 cores, 16 threads; RAM-32G; 3.6GHz;
(5) Sever: CPU-28 cores, 56 threads; RAM-512G;

In order to get the fastest simulation speed, which value of 'engine' I should choose, 'engine=fastest' or 'engine=multithread'? If I choose 'engine=multithread', where should I set the value of 'engine' and what number of threads n be selected?

I sincerely look forward to your reply, thank you very much.

Best wishes
Ly.bright

thorsten
Posts: 1475
Joined: Mon 27 Jun 2011, 12:26

Re: Use of multithreading

Post by thorsten » Sun 09 May 2021, 22:22

Hi,

fastest and multithreaded is the same and thus you can omit to set this at all.
As far as number of threads is concerned, that depends on the simulation.
Start with e.g. 2 and work you way up to the number of cores available to see what gives you the best speed.

best regards
Thorsten

HexAndFlex
Posts: 14
Joined: Sat 06 Oct 2018, 09:11

Re: Use of multithreading

Post by HexAndFlex » Tue 25 May 2021, 05:18

As Thorsten says, there is an optimum number of threads. I run this on a 10core i9 processor. But in general, it normally runs faster if I limit the threads to about 4.

Other speed sup tricks include...

Lowering the stopping criteria. You have it set to -40db. You might be able to get away with anything up to -20db. You can always boost this for a final check once you are happy with the model.

Check the mesh. In particular you want to avoid having any small mesh cells. The timestep is governed by the size of the smallest cell.

GeorgZ
Posts: 1
Joined: Tue 22 Jun 2021, 21:50

Re: Use of multithreading

Post by GeorgZ » Tue 22 Jun 2021, 21:57

Hey everyone! Maybe I'm a little late to the party but I'd like to add something:

I did some benchmarks for OpenEMS and found out that "typically" it gives the best performance when running (number of memory channels in the system) + 1. I verified this on some Skylake systems (Pentium, Core i5-8400) and an older mobile i5-520M.
So, i guess if you use a desktop computer or a notebook for simulations, go for 3 threads.
Btw. i somehow think that it runs much faster on Linux, but i'm not sure about that.

mysol
Posts: 2
Joined: Thu 05 Aug 2021, 16:15

Re: Use of multithreading

Post by mysol » Thu 05 Aug 2021, 16:43

Hi all!
I have installed openems 0.0.35 on two desktops with ubuntu 20.04 from "apt" and use python shell (openems-python from "apt") for scripting
Configuration of desktops:
1. i5-4440 4 cores 4 threads 8Gb RAM 2133
2. Dual processors Xeon 8160 with total 48 cores and 96 threads, 4 channels 2 per CPU used with total 32 Gb RAM 2666

Trying to simulate dipole with 1s desktop:
Used 4 threads with speed ~130 MC/s

Trying with 2nd:
1. Trying to use all threads, but available only 50 (i don't know why). Result - didn't run( Stuck on "Running FDTD engine... this may take a while... grab a cup of coffee?!?"
2. Trying to reduce threads. Lower to 30. I've got 8 MC/s...
3. Lower to 10. I've got around 20 MC/s
4. 4 threads give me around 30 MC/s...

What am i doing wrong?) I've made geekbench benchmark and it gives me nice results compared to other desktop builds with same XEON processors and RAMs, but i can't configure simulation for predictable speeds...

Thank for any advice

Post Reply