Why are my parallel simulations not using 100% of my CPU's

I am experiencing performance issues while running simulations on my computer with parsim/batchsim. The CPU usage is lower than expected.
 Specifically, I am curious about the following:Why would CPU usage be below 100%?Why do some simulations run faster with fewer workers?How can I be sure my workers are not idle?

 Accepted Answer

  1. Why would CPU usage be below 100%?
    It is not necessarily bad that CPU usage is not 100%. Most commonly, this would be because the process running the simulation is waiting on data to be read or written to memory. During this time, the CPU could be idle or free to work on other tasks. Other bottlenecks could be waiting for file or network I/O. 
  2. Why do some simulations run faster with fewer workers?
    This can be caused by shifting hardware bottlenecks as you increase the number of workers. For example, a computer typically has a limited amount of memory data it can read/write at any given time. With multiple workers all trying to access memory at the same time, this can create a bottleneck at the memory bus, which can make certain tasks take longer with more workers. See the doc page below for more details.Resource Contention in Task Parallel Problems - MATLAB & Simulink Example 
  3. How can I be sure the workers are not Idle?If you suspect your resources are not being used optimally, R2025a and later includes a new tool called the Parallel Pool Dashboard, which can be extremely helpful for visualizing what the workers are doing. 
    If you need further debugging, consider reaching out to MathWorks Technical Support

More Answers (0)

Categories

Find more on Simulink Supported Hardware in Help Center and File Exchange

Products

Release

R2020b

Community Treasure Hunt

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

Start Hunting!