Perform Acceleration

Customize the Build Process

Compiler optimizations are off by default. This results in faster build times, but slower simulation times. You can optimize the build process toward a faster simulation.

  1. From the Simulation menu, select Model Configuration Parameters.

  2. In the Configuration Parameters dialog box, from the Compiler optimization level drop-down list, select Optimizations on (faster runs).

    Code generation takes longer with this option, but the model simulation runs faster.

  3. Select Verbose accelerator builds to display progress information using code generation, and to see the compiler options in use.

Changing the Location of Generated Code

By default, the Accelerator mode places the generated code in a subfolder of the working folder called slprj/accel/modelname (for example, slprj/accel/f14). To change the name of the folder into which the Accelerator Mode writes generated code:

  1. In the Simulink® Editor window, on the Modeling tab, select Environment > Simulink Preferences.

    The Simulink Preferences window appears.

  2. In the Simulink Preferences window, navigate to the Simulation cache folder parameter.

  3. Enter the absolute or relative path to your subfolder and click Apply.

Run Acceleration Mode from the User Interface

To accelerate a model, first open it, and then on the Simulation tab, in the Simulate section, select Accelerator or Rapid Accelerator from the drop-down menu. Then start the simulation.

The following example shows how to accelerate the already opened f14 model using the Accelerator mode:

  1. On the Simulation tab, in the Simulate section, select Accelerator from the drop-down menu.

  2. On the Simulation tab, click Run.

    The Accelerator and Rapid Accelerator modes first check to see if code was previously compiled for your model. If code was created previously, the Accelerator or Rapid Accelerator mode runs the model. If code was not previously built, they first generate and compile the C code, and then run the model.

    For an explanation of why these modes rebuild your model, see Code Regeneration in Accelerated Models.

The Accelerator mode places the generated code in a subfolder of the working folder called slprj/accel/modelname (for example, slprj/accel/f14). If you want to change this path, see Changing the Location of Generated Code.

The Rapid Accelerator mode places the generated code in a subfolder of the working folder called slprj/raccel/modelname (for example, slprj/raccel/f14).

Note

The warnings that blocks generate during simulation (such as divide-by-zero and integer overflow) are not displayed when your model runs in Accelerator or Rapid Accelerator mode.

Making Run-Time Changes

A feature of the Accelerator and Rapid Accelerator modes is that simple adjustments (such as changing the value of a Gain or Constant block) can be made to the model while the simulation is still running. More complex changes (for example, changing from a sin to tan function) are not allowed during run time.

The Simulink software issues a warning if you attempt to make a change that is not permitted. The absence of a warning indicates that the change was accepted. The warning does not stop the current simulation, and the simulation continues with the previous values. If you wish to alter the model in ways that are not permitted during run time, you must first stop the simulation, make the change, and then restart the simulation.

In general, simple model changes are more likely to result in code regeneration when in Rapid Accelerator mode than when in Accelerator mode.

Related Examples

More About