Main Content

Improve vdp Model Performance

This example shows you how to run Performance Advisor on the vdp model, review advice, and make changes to improve performance.

Enable Data Logging for the Model

  1. In the vdp model, on the Modeling tab, click Model Settings.

  2. In the Configuration Parameters dialog box, click Data Import/Export in the left pane.

  3. Set up signal logging. The model must log at least one signal for Performance Advisor to work. For example, select the States or Output check box.

  4. Click Configure Signals to Log.

  5. To select signals to log, select a signal in vdp. Right click and select Properties.

  6. In the Signal Properties dialog box, check the Log signal data option and click OK.

  7. Click OK in the Configuration Parameters dialog box.

  8. Run the model once to make sure that the simulation is successful.

Create Baseline

  1. Open Performance Advisor. In the Simulink® Toolstrip, on the Debug tab, click Performance.

  2. In the right pane, under Set Up, select a global setting for Take Action. To automatically apply advice to the model, select automatically for all checks.

  3. Select global settings to validate any improvements in simulation time and accuracy after applying advice. To select the default setting for validation, for Validate simulation time and Validate simulation accuracy, select use check parameters.

    Note

    To validate any improvements automatically, change the global settings to For all checks. However, this can increase simulation time as validating all checks requires more simulation runs.

  4. Select Show report after run. This opens an HTML report of check results.

  5. In the left pane, select the Create baseline check. Clear the other checks.

  6. In the Create baseline pane, set Stop Time to 10. Click Apply.

  7. Click Run This Check. The right pane updates to show that the baseline was created successfully.

Select Checks and Run

Note

The global input parameters to take action and validate improvement apply to all the checks you select.

  1. In the left pane, clear the baseline check. Select these checks:

    • In Simulation > Checks Occurring Before Update, select Identify resource-intensive diagnostic settings.

    • In Simulation > Checks that Require Update Diagram, select Check model reference parallel build.

    • In Simulation Targets > Check Compiler Optimization Settings, select Select compiler optimizations on or off.

    • Select Final validation.

  2. For every check that you have selected in the left pane, select options in the right pane to validate any improvements in simulation time and accuracy. Note that Take Action based on advice is set to automatically, a result of Take Action being set to automatically for all checks.

  3. Select a value for Time Out if you want to limit the runtime duration of Performance Advisor.

  4. Click Run Selected Checks.

Performance Advisor runs the checks you selected and opens an HTML report with check results.

Review Results

  1. In the HTML report, filter the results to see only the checks that passed.

    All of the selected checks passed successfully.

  2. Navigate to the results for a particular check, for example Check model reference parallel build. Use the navigation tree in the left pane or scroll to the results for this check in the right pane.

  3. Performance Advisor gives you information about this check, advice for performance improvement, as well as a list of related model configuration parameters.

  4. Filter the results to display warnings. See results for the Identify resource-intensive diagnostic settings check.

    Performance Advisor identified diagnostic settings that incur runtime overhead during simulation. It modified values for some of these diagnostics. A table in the report shows the diagnostics checked and whether Performance Advisor suggested a change to the value.

    If the performance of the model improved, the HTML report gives you information about this improvement. If the performance has deteriorated, Performance Advisor discards all changes and reinstates the original settings in the model.

  5. See details for the Final Validation check.

    This check validates the overall performance improvement in the model. The check results show changes in simulation time and accuracy, depending on whether performance improved or degraded.

Apply Advice and Validate Manually

Generate advice for a check, apply it, and validate any improvements manually.

  1. In the left pane, click Performance Advisor. Select these settings and click Apply:

    • Set Take Action to generate advice only.

    • Set Validate simulation time to use check parameters.

    • Set Validate simulation accuracy to use check parameters.

  2. For every check that you have selected in the left pane, select options in the right pane to validate any improvements in simulation time and accuracy. Note that Take Action based on advice is set to manually, a result of Take Action being set to generate advice only.

  3. Select Performance Advisor in the left pane. Click Run Selected Checks in the Performance Advisor pane.

    If the performance of the model has improved, the Final Validation check results show the overall performance improvement.

  4. In the results for Identify resource-intensive diagnostic settings, Performance Advisor suggests new values for the diagnostics it checked. Review these results to accept or reject the values it suggests.

    Alternatively, click Modify all and Validate to accept all changes and validate any improvement in performance.

Related Topics