Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Design Optimization   

Speeding Up Parameter Estimation Using Parallel Computing

When to Use Parallel Computing for Estimating Model Parameters

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:

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:

How Parallel Computing Speeds Up Parameter Estimation

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:

Parallel Computing with Nonlinear least squares and Gradient descent Methods

When you select Gradient descent as the estimation method, the model is simulated during the following computations:

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.

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 .

Parallel Computing with the Pattern search Method

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.

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

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:

  1. Add the path dependencies, as described How to Use Parallel Computing in the GUI and How to Use Parallel Computing at the Command Line.

  2. Add the file dependencies, as described in Configuring Parallel Computing on Multiprocessor Networks.

Configuring Your System for Parallel Computing

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.

Configuring Parallel Computing on Multicore Processors

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.

Configuring Parallel Computing on Multiprocessor Networks

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:

  1. 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.

  2. 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.

How to Use Parallel Computing in the GUI

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.

  1. Open the Simulink model by typing the model name at the MATLAB prompt.

  2. Configure the model for parameter estimation, as described in Configuring Parameter Estimation in the GUI.

  3. In the Estimation tab of the New Estimation node, click Estimation Options.

    This action opens the Options - New Estimation dialog box.

  4. 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.

  5. (Optional) Add the path dependencies that the automatic check does not detect.

    1. Specify the paths in the Model path dependencies list box.

      You can specify the paths separated with a semicolon, or on a new line.

    2. 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.

  6. (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.

  7. Click OK.

  8. In the Estimation tab, click Start to estimate the model parameters using parallel computing.

  9. 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.

Troubleshooting

Why are the estimation results with and without using parallel computing different?

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:

Why do I not see the estimation speedup I expected using parallel computing?

Why does the estimation using parallel computing not make any progress?

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:

  1. Run the optimization for a few iterations without parallel computing to see if the optimization progresses.

  2. Check if the remote workers have access to all model dependencies. To learn more, see Model Dependencies.

Why do I receive an error "Cannot save model tpe5468c55_910c_4275_94ef_305e2eeeeef4"?

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.

Why does the estimation using parallel computing not stop when I click Stop?

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.

  


Related Products & Applications

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