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 (99.33 KiB) Viewed 498 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 (138.04 KiB) Viewed 498 times
2.JPG (185.14 KiB) Viewed 498 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

Posts: 1438
Joined: Mon 27 Jun 2011, 12:26

Re: Use of multithreading

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


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

Posts: 13
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.

Post Reply