How Acceleration Modes Work
Overview
The accelerator and rapid accelerator modes use portions of the Simulink® Coder™ product to create an executable.
The accelerator and rapid accelerator modes replace the interpreted code normally used in Simulink simulations, shortening model run time.
Although the acceleration modes use some Simulink Coder code generation technology, you do not need the Simulink Coder software installed to accelerate your model.
Note
The code generated by the accelerator and rapid accelerator modes is suitable only for speeding the simulation of your model. Use Simulink Coder to generate code for other purposes.
Normal Mode
In normal mode, the MATLAB® technical computing environment is the foundation on which the Simulink software is built. Simulink controls the solver and model methods used during simulation. Model methods include such things as computation of model outputs. Normal mode runs in one process.
Accelerator Mode
By default, accelerator mode uses Just-in-Time (JIT) acceleration to generate an execution engine in memory instead of generating C code or MEX files. You can also have your model fall back to the classic accelerator mode, in which Simulink generates and links code into a C-MEX S-function.
In accelerator mode, the model methods are separate from the Simulink software and are part of the acceleration target code, which is used in later simulations.
Simulink checks that the acceleration target code is up to date before reusing it. For more information, see Code Regeneration in Accelerated Models.
There are two modes of operation in accelerator mode.
Just-In-Time Accelerator Mode
In this default mode, Simulink generates an execution engine in memory for the top-level model only and not for referenced models. As a result, a C compiler is not required during simulation.
Because the acceleration target code is in memory, it is available for reuse as long as the model is open. Simulink also serializes the acceleration target code so that the model does not need rebuilding when it is opened.
Classic Accelerator Mode
If you want to simulate your model using the classic, C-code generating, accelerator mode, run the following command:
set_param(0,'GlobalUseClassicAccelMode','on');
In this mode, Simulink generates and links code into a shared library, which communicates with the Simulink software. The target code executes in the same process as MATLAB and Simulink.
Rapid Accelerator Mode
Rapid accelerator mode creates a rapid accelerator standalone executable from your model. This executable includes the solver and model methods, but it resides outside of MATLAB and Simulink. It uses external mode (see External Mode Communication (Simulink Coder)) to communicate with Simulink.
MATLAB and Simulink run in one process, and if a second processing core is available, the standalone executable runs there.