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
In the
vdp
model, on the Modeling tab, click Model Settings.In the Configuration Parameters dialog box, click Data Import/Export in the left pane.
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.
Click Configure Signals to Log.
To select signals to log, select a signal in
vdp
. Right click and select Properties.In the Signal Properties dialog box, check the Log signal data option and click OK.
Click OK in the Configuration Parameters dialog box.
Run the model once to make sure that the simulation is successful.
Create Baseline
Open Performance Advisor. In the Simulink® Toolstrip, on the Debug tab, click Performance.
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
.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.Select Show report after run. This opens an HTML report of check results.
In the left pane, select the Create baseline check. Clear the other checks.
In the Create baseline pane, set Stop Time to
10
. Click Apply.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.
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.
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 toautomatically for all checks
.Select a value for Time Out if you want to limit the runtime duration of Performance Advisor.
Click Run Selected Checks.
Performance Advisor runs the checks you selected and opens an HTML report with check results.
Review Results
In the HTML report, filter the results to see only the checks that passed.
All of the selected checks passed successfully.
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.
Performance Advisor gives you information about this check, advice for performance improvement, as well as a list of related model configuration parameters.
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.
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.
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
.
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 togenerate advice only
.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.
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.