Performance of parsim with a large number of simulations

7 views (last 30 days)
Dear matlab community :)
I am using parsim for a simulation with a very large number of runs. It seems that the number of runs impacts the duration of each run.
My simulation has runs that normally require between 0.05 and 0.1 seconds for each run in a 5000 run simulation, but the runs increase to 0.25 seconds for a 500,000 run simulation :/
I am attaching a small piece of code that includes the parsim if it helps to identify the problem:
for j = 1:1:length(VdcPEl)
for k = 1:1:length(VdcEDl)
for l = 1:1:length(Wl)
ind=ind+1;
B0 = Bl(i);
F0s = F0(l);
VdcED = VdcEDl(k);
VdcPE = VdcPEl(j);
in(ind) = Simulink.SimulationInput('TestHyvrid');
in(ind) = in(ind).setVariable('B0',B0);
in(ind) = in(ind).setVariable('VdcPE',VdcPE);
in(ind) = in(ind).setVariable('VdcED',VdcED);
in(ind) = in(ind).setVariable('F0s',F0s);
end
end
end
end
out = parsim(in, 'ShowProgress', 'on','ShowSimulationManager', 'on','TransferBaseWorkspaceVariables','on','UseFastRestart','on' );
The processor used is a Intel Xeon Gold 5222 CPU @ 3.80GHz
If you have an idea to solve this problem, or simply ideas to get around it, I'm interested. Thanks for reading! :)
Adrien A

Answers (1)

Swastik Sarkar
Swastik Sarkar on 23 Sep 2024
It appears that the ShowSimulationManager setting is enabled during the execution of parsim. Disabling this setting might alleviate the bottleneck, as continuous data updates to the Simulation Manager could be affecting performance, especially as the number of simulations increases.
A similar issue has been reported, indicating that the Simulation Manager can slow down overall simulation performance. More details can be found in this Bug Report:
Additionally, exploring different workflows might be beneficial. More information on multiple simulations workflows is available in the documentation:
Hope this helps.

Categories

Find more on Run Multiple Simulations in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!