How does parsim() run more instances than workstation cores?

18 次查看(过去 30 天)
I want to run six simulink models in parallel using the parallel computing toolbox and parsim(). My workstation has 4 cores. The parallel computing toolbox creates no more workers than cores.
How does parsim() handle the six models in parallel when it can create no more than 4 workers? Threads?
  2 个评论
Artyom
Artyom 2019-10-25
What about Hyperthreading? Usually Intel CPUs provide twice number of virtual cores than physical - e.g. 8 for 4. Can the number of workers be increased in this case?
Jason Ross
Jason Ross 2019-10-25
You can set the number or workers in a local cluster in the properties of the local scheduler. You can set this to whatever number of workers you wish. The default is the number of compute cores in your CPU, which is half the hyperthreaded cores. When doing numerical work, you need the compute cores, so in practice hyperthreaded cores provide little or no benefit for additional parallelization or performance.

请先登录,再进行评论。

采纳的回答

mizuki
mizuki 2017-5-15
Set NumWorkers as 6 in cluster profile manager. Go to
MATLAB Toolstrip (menu bar)
-> Parallel
-> Manage Cluster Profiles
-> Select your cluster
(if you are working on your machine, please select "local")
-> Click Edit
-> Change/Set NumWorkers to 6
(In the image, NumWorkers is set as 4)
After setting NumWorkers as 6, run parsim again.
  2 个评论
Benjamin Hall
Benjamin Hall 2018-7-5
I don't think this will work, mizuki. MATLAB won't allow more workers than physical cores. Parsim can queue jobs though. If you call parsim with 'ShowSimulationManager' set to 'on', you will see that it queues parallel jobs in excess of the number of workers/cores. e.g. out = parsim(in, 'ShowProgress', 'on', 'ShowSimulationManager', 'on')
Jason Ross
Jason Ross 2019-10-25
You can set the number of workers higher than the number of (compute) cores and the software will be 100% OK with it. It will dutifully start that many workers (or try to -- at some point you'll run out of something -- RAM, most likely) . The issue is that when the workers get blocked on compute cores, there's no real benefit to haveing more workers running. You are bottlenecked on the ability of the cores to process work, and therefore it's a no-win situation.
You are correct in your answer that the scheduler knows how to schedule and queue tasks. So parts of the job just wait on workers to complete work.

请先登录,再进行评论。

更多回答(1 个)

Benjamin Hall
Benjamin Hall 2018-7-5
MATLAB won't allow more workers than physical cores. Parsim can queue jobs though. If you call parsim with 'ShowSimulationManager' set to 'on', you will see that it queues parallel jobs in excess of the number of workers/cores. e.g. out = parsim(in, 'ShowProgress', 'on', 'ShowSimulationManager', 'on')

类别

Help CenterFile Exchange 中查找有关 Run Multiple Simulations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by