Regarding the number of thread used

SCONE is a software tool for predictive simulations of biomechanical movement. It uses OpenSim for modeling and simulation, and performs optimization using various control strategies, including feed-forward control, proprioceptic feedback control, and bal
POST REPLY
User avatar
Yuichiro Omura
Posts: 44
Joined: Thu Apr 04, 2019 10:03 pm

Regarding the number of thread used

Post by Yuichiro Omura » Thu Oct 20, 2022 12:44 am

Hi, thank you for your support always.
I want to specify the number of thread that one optimization use.
According to Cma Optimizer page in reference manual, I tried to use "max_threads", but it may not work.
Actually, it says it's deprecated and use global setting. How can I change the global setting?

User avatar
Thomas Geijtenbeek
Posts: 461
Joined: Wed Mar 12, 2014 8:08 am

Re: Regarding the number of thread used

Post by Thomas Geijtenbeek » Thu Oct 20, 2022 1:07 am

The maximum number of threads that is used in SCONE is determined in Preferences -> Advanced -> optimization. By default, the maximum available number of threads is used, so you should not have to change this setting.

However, if you only run a single optimization, the number of parallel simulations is always limited by the population size. By default, the population size (also referred to as 'lambda') is set automatically based on the number of parameters, but you can override it in the Optimizer settings.

Another (preferred) way to use more threads is to simply run multiple optimizations in parallel (via Scenario -> Run Multiple Optimizations). This is typically more effective than increasing the population size (lambda), especially for avoiding local minima.

User avatar
Yuichiro Omura
Posts: 44
Joined: Thu Apr 04, 2019 10:03 pm

Re: Regarding the number of thread used

Post by Yuichiro Omura » Thu Oct 20, 2022 1:41 am

Thank you for your quick response. I understand.
I have another question related to this.
I am using a python file to run multiple optimizations simultaneously by running multiple scone files.
The problem is that each optimization use same few threads, it means that waiting time occurs because optimization is performed using the same few threads, even though there are free threads.
Is there any way to avoid this? If it is an issue with python program, I'll find a way to resolve.

User avatar
Thomas Geijtenbeek
Posts: 461
Joined: Wed Mar 12, 2014 8:08 am

Re: Regarding the number of thread used

Post by Thomas Geijtenbeek » Thu Oct 20, 2022 1:59 am

If you run multiple simulations via sconecmd.exe, then the number of threads should not be limited. Just make sure you run the instances in parallel (i.e. in the background), so that they're not waiting for the previous optimization to finish.

See also: https://scone.software/doku.php?id=doc:batch

User avatar
Yuichiro Omura
Posts: 44
Joined: Thu Apr 04, 2019 10:03 pm

Re: Regarding the number of thread used

Post by Yuichiro Omura » Thu Oct 20, 2022 4:58 am

I see. Using sconecmd.exe, if I start a new Optimization 2 while an Optimization 1 is in progress, sometimes the threads used by Optimization 1 are used by Optimization 2. Is the only solution to this starting optimization 1 and 2 at the same time, as described in the URL page you provided?

User avatar
Thomas Geijtenbeek
Posts: 461
Joined: Wed Mar 12, 2014 8:08 am

Re: Regarding the number of thread used

Post by Thomas Geijtenbeek » Thu Oct 20, 2022 7:35 am

The available CPU threads are indeed shared between tasks by the OS, but this is not necessarily a problem (it's what the OS is designed to do).

You can only limit the total amount of threads if you start the Optimizations from inside SCONE Studio and use the 'Pool Optimizer' (option 3). This makes the most optimal use of all available cores by using a thread pool. The difference in performance is not that big, however, so it might not be worth the extra effort.

User avatar
Yuichiro Omura
Posts: 44
Joined: Thu Apr 04, 2019 10:03 pm

Re: Regarding the number of thread used

Post by Yuichiro Omura » Fri Oct 21, 2022 11:30 pm

I understand. Thank you for your support!

POST REPLY