| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink Design Optimization |
| Contents | Index |
| Learn more about Simulink Design Optimization |
| On this page… |
|---|
When to Use Parallel Computing for Estimating Model Parameters How Parallel Computing Speeds Up Parameter Estimation Configuring Your System for Parallel Computing |
You can use Simulink Design Optimization software with Parallel Computing Toolbox™ software to speed up parameter estimation of Simulink models. Using parallel computing may reduce the estimation time in the following cases:
The model contains a large number parameters to estimate, and the Nonlinear least squares or Gradient descent is selected as the estimation method.
The Pattern search method is selected as the estimation method.
The model is complex and takes a long time to simulate.
When you use parallel computing, Simulink Design Optimization software distributes independent simulations to run them in parallel on multiple MATLAB sessions, also known as workers. The time required to simulate the model dominates the total estimation time. Therefore, distributing the simulations significantly reduces the estimation time. For more information on the expected speedup, see How Parallel Computing Speeds Up Parameter Estimation.
The following sections describe how to configure your system, and use parallel computing:
You can enable parallel computing with the Nonlinear least squares, Gradient descent and Pattern search estimation methods in the Simulink Design Optimization software. The following sections describe how parallel computing speeds up the estimation:
When you select Gradient descent as the estimation method, the model is simulated during the following computations:
Objective value computation — One simulation per iteration
Objective gradient computations — Two simulations for every tuned parameter per iteration
Line search computations — Multiple simulations per iteration
The total time,
, taken per iteration to perform
these simulations is given by the following equation:
![]()
where
is
the time taken to simulate the model and is assumed to be equal for
all simulations,
is the number
of parameters to estimate, and
is
the number of line searches.
When you use parallel computing, Simulink Design Optimization software
distributes the simulations required for objective gradient computations.
The simulation time taken per iteration when the gradient computations
are performed in parallel,
,
is approximately given by the following equation:
![]()
where
is
the number of MATLAB workers.
Note The equation does not include the time overheads associated with configuring the system for parallel computing and loading Simulink software on the remote MATLAB workers. |
The expected reduction of the total estimation time is given by the following equation:

For example, for a model with Np=3, Nw=4,
and Nls=3, the expected
reduction of the total estimation time equals
.
The Pattern search method uses search and poll sets to create and compute a set of candidate solutions at each estimation iteration.
The total time,
, taken per iteration to perform
these simulations, is given by the following equation:
![]()
where
is
the time taken to simulate the model and is assumed to be equal for
all simulations,
is the number
of parameters to estimate,
is
a factor for the search set size, and
is a factor for the poll set
size.
When you use parallel computing, Simulink Design Optimization software
distributes the simulations required for the search and poll set computations,
which are evaluated in separate parfor loops. The simulation time taken per iteration
when the search and poll sets are computed in parallel,
, is given by the following equation:

where
is
the number of MATLAB workers.
Note The equation does not include the time overheads associated with configuring the system for parallel computing and loading Simulink software on the remote MATLAB workers. |
The expected speed up for the total estimation time is given by the following equation:

For example, for a model with Np=3, Nw=4, Nss=15,
and Nps=2, the expected
speedup equals
.
Using the Pattern search method with parallel computing may not speed up the estimation time. When you do not use parallel computing, the method stops searching for a candidate solution at each iteration as soon as it finds a solution better than the current solution. When you use parallel computing, the candidate solution search is more comprehensive. Although the number of iterations may be larger, the estimation without using parallel computing may be faster.
Model dependencies are files, such as referenced models, data files and S-functions, without which a model cannot run. When you use parallel computing, Simulink Design Optimization software helps you identify model path dependencies. To do so, the software uses the Simulink Manifest Tools. The dependency analysis may not find all the files required by your model. To learn more, see the Scope of Dependency Analysis in the Simulink documentation.
If your model has dependencies that the software cannot detect automatically, you must add the dependencies before you start the estimation using parallel computing:
Add the path dependencies, as described How to Use Parallel Computing in the GUI and How to Use Parallel Computing at the Command Line.
Add the file dependencies, as described in Configuring Parallel Computing on Multiprocessor Networks.
Note When you use parallel computing, verify that the remote MATLAB workers can access all the model dependencies. The optimization errors out if all the remote workers cannot access all the model dependencies. |
You can use parallel computing on multi-core processors or multi-processor networks. To configure your system for parallel computing, see the following sections:
After you configure your system for parallel computing, you can use the GUI or the command-line functions to estimate the model parameters.
With a basic Parallel Computing Toolbox license, you can establish a pool of up to four parallel MATLAB sessions in addition to the MATLAB client.
To start a pool of four MATLAB sessions in local configuration, type the following at the MATLAB prompt:
matlabpool open local
To learn more, see the matlabpool reference page in the Parallel Computing Toolbox documentation.
To use parallel computing on a multiprocessor network, you must have the Parallel Computing Toolbox software and the MATLAB® Distributed Computing Server™ software. To learn more, see the Parallel Computing Toolbox and MATLAB Distributed Computing Server documentation.
To configure a multiprocessor network for parallel computing:
Create a user configuration file to include any model file dependencies, as described in Defining Configurations and FileDependencies reference page in the Parallel Computing Toolbox documentation.
Open the pool of MATLAB workers using the user configuration file, as described in Applying Configurations in Client Code in the Parallel Computing Toolbox documentation.
Opening the pool allows the remote workers to access the file dependencies included in the user configuration file.
After you configure your system for parallel computing, as described in Configuring Your System for Parallel Computing, you can use the GUI to estimate the model parameters.
Tip If you want to use functions to estimate parameters using parallel computing, see How to Use Parallel Computing at the Command Line. |
Open the Simulink model by typing the model name at the MATLAB prompt.
Configure the model for parameter estimation, as described in Configuring Parameter Estimation in the GUI.
In the Estimation tab of the New Estimation node, click Estimation Options.

This action opens the Options - New Estimation dialog box.

In the Parallel Options tab, select the Use the matlabpool during optimization option.
This action checks for model path dependencies in your Simulink model and displays the path dependencies in the Model path dependencies list box.
Note As described in Model Dependencies, the automatic path dependencies check may not detect all the path dependencies in your model. |

(Optional) Add the path dependencies that the automatic check does not detect.
Specify the paths in the Model path dependencies list box.
You can specify the paths separated with a semicolon, or on a new line.

Click Apply to include the new paths.
Alternatively, you can click Add path dependency to open a Browse For Folder dialog box where you can select the directory to add.

(Optional) If you modify the Simulink model such that it introduces a new path dependency, then you must resync the path dependencies. Click Sync path dependencies from model in the Parallel Options tab to rerun the automatic dependency check for your model.
This action updates the Model path dependencies list box with any new path dependency found in the model.
Click OK.
In the Estimation tab, click Start to estimate the model parameters using parallel computing.
Examine the values of the estimated parameters in the Value column of the Parameters tab.
For more information on how to troubleshoot estimation results you obtained using parallel computing, see Troubleshooting.
Why are the estimation results with and without using parallel computing different?
Why do I not see the estimation speedup I expected using parallel computing?
Why does the estimation using parallel computing not make any progress?
Why do I receive an error "Cannot save model tpe5468c55_910c_4275_94ef_305e2eeeeef4"?
Why does the estimation using parallel computing not stop when I click Stop?
The values of the estimated parameters obtained using parallel computing may differ from the values obtained without using parallel computing. The results can be different under the following conditions:
Different numerical precision on the client and worker machines can produce marginally different simulation results. Thus, the estimation method may take a completely different solution path and produce a different result.
The state of the model on the client and the worker machines can differ, and thus lead to a different result. For example, the state can become different if you change a parameter value initialized by a callback function on the client machine after the workers have loaded the model. The model parameter values on the workers and the client are now out of sync, which can lead to a different result.
After you change the model parameter values initialized by a callback function, verify that the parameters exist in the model workspace or update the callback function so that the remote workers have access to the changed parameter values.
When you use parallel computing with the Pattern search method, the method searches for a candidate solution more comprehensively than when you do not use parallel computing. This more comprehensive search can result in a different solution. To learn more, see Parallel Computing with the Pattern search Method.
The resulting estimation time may not be faster when you estimate a small number of model parameters or when the model does not take long to simulate. In such cases, the overheads associated with creating and distributing the parallel tasks outweighs the benefits of running the simulations during estimation in parallel.
Using Pattern search method with parallel computing may not speed up the estimation time. When you do not use parallel computing, the method stops searching for a candidate solution at each iteration as soon as it finds a solution better than the current solution. The candidate solution search is more comprehensive when you use parallel computing. Although the number of iterations may be larger, the optimization without using parallel computing is faster.
To learn more about the expected speedup, see Parallel Computing with the Pattern search Method.
In some cases, the gradient computations on the remote worker machines may silently error out when you use parallel computing. In such cases, the Estimation progress table shows that the f(x) values do not change, and the optimization terminates after two iterations.
To troubleshoot the problem:
Run the optimization for a few iterations without parallel computing to see if the optimization progresses.
Check if the remote workers have access to all model dependencies. To learn more, see Model Dependencies.
When you select Refined as the Gradient type, the software may error out when it saves a temporary model to a nonwriteable directory, and then displays this error message. Change the Gradient type to Basic to clear this error. To learn more, see Selecting Additional Optimization Options.
When you use parallel computing, the software has to wait till the current iteration completes before it notifies the workers to stop the estimation. The estimation does not terminate immediately when you click Stop, and appears to continue to run.
![]() | Accelerating Model Simulations During Estimation | Estimating Initial States | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |