Parallelization

13 views
Skip to first unread message

Jessica Chen

unread,
Feb 4, 2025, 3:17:13 AMFeb 4
to Morpheus users
Hi all,

I am looking to run my parameter sweeps in parallel to save some time,. Currently, I have a bash script that runs a for loop across 32 cores, however running more than 3 simulations at once seems to slow down the runtime greatly. Is there a solution to this?

Thank you,
Jessica

Lutz Brusch

unread,
Feb 4, 2025, 5:40:49 AMFeb 4
to Morpheus users
Hi Jessica,

thank you for this question!

Morpheus jobs can be parallelized in two layers [1]:
1. Using the available CPU threads to speed up an individual run (in-job parallelization) 
and/or
2. Using the available CPU threads to run independent jobs at the same time (between-job parallelization).

By default, Morpheus checks for available CPU cores and applies the following heuristics [2]:
Use 50% of the available cores for parallel computation in (each) job (layer 1). This way you may run two Morpheus jobs along each other or do other stuff (layer 2). More parallel (Morpheus) jobs will then hinder each other. You have added your own rule for layer 2 and observe the expected slow-down.

Please use the GUI/Settings/Local menu to manually set the numbers for layer 1 (set this to 1 in your case) and layer 2 (if you would control the sweep from the GUI's ParameterSweep feature, else it will not matter for your "for" loop). These settings are written to environment variables and are then read by the simulator on that machine. Or, from a terminal set the environment variable for OpenMP threads to 1. This should solve your problem, else please get back to us.

Best,
Lutz for Morpheus.lab

Jörn Starruß

unread,
Feb 4, 2025, 5:49:53 AMFeb 4
to morpheu...@googlegroups.com

Hi Jessica,

Morpheus automatically exploits the computational power of multiple cores in a single simulation.

If you prefer to run multiple simulations in parallel, aka farming, it's preferable to constrain the usage of multiple threads by either:

  * Setting the environmental variable 'OMP_NUM_THREADS' to the desired thread count per simulation, or

  * Using the --num-threads arg command line switch, if it is already available in the version you use.

Also you might use the GUI feature of ParameterSweep, as Lutz detailed already.

Best,
Jörn

--
You received this message because you are subscribed to the Google Groups "Morpheus users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to morpheus-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/morpheus-users/43676597-1f6d-47af-95e5-990064848028n%40googlegroups.com.
-- 
------------------
Dipl.-Ing. Jörn Starruß
Pronomen: er / he

Technische Universität Dresden
CIDS - Center for Interdisciplinary Digital Sciences
Department Informationsdienste und Hochleistungsrechnen (ZIH)
Abteilung Innovative Methoden des Computing

Tel.: +49 351 463-38554
E-Mail: joern.s...@tu-dresden.de
Office: APB 1026
Reply all
Reply to author
Forward
0 new messages