user1392028
user1392028

Reputation: 11

Matlab/Simulink: run batch of simulations in parallel?

I have to run a series of simulations and save the results. Since by default Matlab only uses one core, I wonder if it is possible to open multiple worker tasks and assign different simulation runs to them?

Upvotes: 0

Views: 351

Answers (2)

CMN
CMN

Reputation: 31

I aso have the same problem but I did not manage to really understand how to make it in MatLab. The documentation in matlab is too advanced to get to know how to make it.

Since I am working with Ubuntu I find a way to do the work calling the unix command from MatLab and using the parallel GNU command

So I mange to run my simulation in parallel with 4 cores.

unix('parallel --progress -j4 flow > /dev/null :::: Pool.txt','-echo')

you can find more info in the link Shell, run four processes parallel

Details of the syntaxis can be found at https://www.gnu.org/software/parallel/ but breifly I can tell you

--progress shows a status of the progress

-j4 tells the amount or jobs in parallel you want to have

flow is the name of my simulator

/dev/null was just to avoid the screen run output of the simulator to show up

Pool.txt is a file I made with the required simulator input that is basically the path and the main simulator file.

echo I do not remember now what was it for :D

Upvotes: 0

Thierry Dalon
Thierry Dalon

Reputation: 926

You could run each simulation in a separate MATLAB instance and let the OS handle the process to core assignment.

One master MATLAB could synchronize each child instances checking for example if simulation results file are existing.

Upvotes: 0

Related Questions