Skip to content

That's just a taste — their profile full of gems!

Visit profile
User avatar
Sophie Porter
March 200

Accelerate Simulations with Parallel Computing and Fast Restart in MATLAB

In this video, we delve into the realm of parallel computing in MATLAB, a technique that allows you to expedite simulations by distributing them across multiple processing units simultaneously. We’ll explore how this approach can significantly reduce simulation times, especially when dealing with large numbers of simulations, such as in parameter sweeps or Monte Carlo simulations.

To facilitate parallel simulations, MATLAB provides the Parallel Computing Toolbox and MATLAB Parallel Server, which leverage headless MATLAB sessions or workers. These workers can be associated with multiple cores on your local machine or on clusters and clouds, forming a parallel pool.

The parsim command plays a crucial role in enabling parallel simulations. It accepts an array of simulation input objects, which conveniently encapsulate simulation inputs like variables, block parameters, and simulation configurations. Parsim distributes these simulations to the available workers, either on your local machine or on a remote cluster.

Let’s demonstrate the power of parallel simulations using a hybrid electric vehicle model as an example. Running 100 simulations serially for a parameter sweep would take approximately four hours. However, employing parallel simulations on our local machine, we reduced the simulation time to just two hours.

To achieve even greater speedups, we can harness remote clusters with hundreds of workers. In our example, running the simulations on a remote cluster with 50 workers further reduced the simulation time to a mere 11 minutes.

Now, let’s consider the use of fast restart in parallel simulations. Fast restart allows you to resume simulations from a previous checkpoint, saving significant time during iterative simulations. To utilize fast restart with parsim, simply set the ‘UseFastRestart’ argument to ‘on’.

However, if your simulation operates in Rapid Accelerator mode, which doesn’t support fast restart, you can still gain speedups by disabling the ‘Rapid Accelerator up-to-date check’. Additionally, creating a setup function to build the Rapid Accelerator target on the parallel workers is necessary to avoid errors.

In summary, parallel simulations offer a powerful way to accelerate simulations, particularly when running multiple simulations simultaneously. Whether you leverage local machines or remote clusters, fast restart or Rapid Accelerator optimization, parallel simulations can drastically reduce simulation times, saving you hours of waiting.

#efficiency#optimization#montecarlosimulation#simulation#matlab#simulink#highperformancecomputing#parallelcomputing#parametersweep#fastrestart#rapidaccelerator#clustercomputing
Like
Dislike

Add a comment...