Reduce Build Time for Simulink Real-Time Referenced Models
In a parallel computing environment, you can increase the speed of code generation and compilation for models containing large model reference hierarchies. Achieve the speed by building referenced models in parallel whenever conditions allow. For example, if you have Parallel Computing Toolbox™ software, you can distribute code generation and compilation for each referenced model across the cores of a multicore host computer. If you also have MATLAB® Parallel Server™ software, you can distribute code generation and compilation for each referenced model across remote workers in your MATLAB Parallel Server configuration.
You can build referenced models in parallel on a compute cluster. In this way, you can more quickly build and download real-time applications to the target computer.
For this procedure, you must have a functioning Simulink® Real-Time™ installation on your development computer.
Identify a set of worker computers, which can be separate cores on your development computer or computers in a remote cluster running under Windows®.
If you intend to use separate cores on the development computer, install Parallel Computing Toolbox on the development computer.
If you intend to use computers in a remote cluster:
On each cluster computer, install:
Parallel Computing Toolbox
MATLAB Parallel Server
Simulink Real-Time Target Support Package
Start and configure the remote cluster according to the instructions at Get Started with MATLAB Parallel Server (MATLAB Parallel Server).
Run MATLAB on the development computer.
In MATLAB, call the
parpoolfunction to open a parallel pool on the cluster.
To configure the compiler for the remote workers as a group, call the
In this configuration, the development computer and the remote workers have installed a supported version of a C++ compiler that is compatible with the code generation target. For the current list of supported compilers, see Supported and Compatible Compilers.
From the top model of the model reference hierarchy, open the Configuration Parameters dialog box. Go to the Model Referencing pane and select the Enable parallel model reference builds option. This selection enables the parameter MATLAB worker initialization for builds. For more information, see Reduce Build Time for Referenced Models by Using Parallel Builds.
Build and download your model.
parpool (Parallel Computing Toolbox) |
pctRunOnAll (Parallel Computing Toolbox)