Parsim slows down after many iterations

24 ビュー (過去 30 日間)
Jörg Kunkelmoor
Jörg Kunkelmoor 2025 年 12 月 15 日 7:03
回答済み: Ayush 2025 年 12 月 18 日 5:18
Hello, I have the following problem.
I use parsim to optimise the parameters of my simulation with particle swarm optimisation. I use it together with Rapidaccelerator.
The simulation is performed with 100 iterations of 32 particles. In one run, 32 simulations are performed with 3 workers.
The first iterations take about 500 seconds. After that, it slows down dramatically to 6000 seconds. The hard drive is then 100% utilised. RAM is still at 85% and the processor at 50%.
After each simulation, I summarise the results and then delete everything unnecessary. I have commented out all scopes. I have Fastrestart enabled.
Has anyone else had the same problem? After the 32 simulations, parsim automatically frees up the pool of resources and the RAM goes down.
Should i disable more of them:
simIn(k) = simIn(k).setModelParameter( ...
‘SaveOutput’,‘off’, ...
‘SaveTime’,‘off’, ...
‘SaveState’,‘off’, ...
‘SignalLogging’,‘off’);
and clear SDI:
simOut = parsim(simInBatch, ...
‘CleanupFcn’, @() Simulink.sdi.clear);
Workers are already cleaned up every time, or do I have to call it separately?
Simulink.sdi.cleanupWorkerResources

回答 (1 件)

Ayush
Ayush 2025 年 12 月 18 日 5:18
Hi Jörg,
I understand you’re seeing high disk usage and slowdowns when running "parsim" with Rapid Accelerator, even after disabling most logging.
A possible cause is that each parallel simulation sends its output back to the client and stores it in memory as a "Simulink.SimulationOutput" object. Over many iterations, this can fill up RAM and force your system to use disk swap, which slows everything down. Even with logging disabled, the accumulation of simulation results can overwhelm your resources.
You can refer to the following answer from MathWorks staff regarding Disk usage in parallel simulations:
Hope it helps.

カテゴリ

Help Center および File ExchangeSystem Composer についてさらに検索

製品


リリース

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by