Low Performance when model is run from Simulink

3 Ansichten (letzte 30 Tage)
Matteo Bordignon
Matteo Bordignon am 8 Feb. 2023
I'm trying to run a model developed in Simulink, that outputs a "real time" animation.
When I open the model and run it from the Simulink window with the Run button, the animation is laggy and misses some feature, for example the Figure where it should be displayed doesn't open automatically.
However, when I don't open simulink and run the model from the Command Line direcly as
>> sim('ModelName.slx')
it works perfectly, with high frame rate and automatically opens the Figure.
From looking at the Task Manager, it seems that when the model is run with Simulink open, my laptop uses the integrated GPU, while in the other case it defaults to the (more powerful) dedicated GPU.
In the Graphics Settings, MATLAB is listed as "High Performance", meaning it will use the dedicated GPU, as it does. I tried to set the same parameter for Simulink, but I don't seem to find an executable so that I can add it to the program list (it probably hasn't got one since it stays 'under' the Matlab icon).
Does anyone has an idea how to solve this?
Thanks.

Antworten (1)

Smit
Smit am 9 Feb. 2023
Hi,
I understand you are observing low performance while running your model in Simulink. You have set your GPU to accelerate MATLAB’s executable, but it is not picking up the Simulink GUI.
You can set MATLAB and Simulink to use GPU acceleration as well.
For Simulink, you can use the GPU Coder to accelerate your model simulations. In the Simulink GUI, you can go to “Model Configuration Parameters” (Ctrl+E). In the “Simulation Target” section, you can select the “GPU acceleration” option and configure any additional parameters according to your requirements in the “GPU Acceleration” tab under “Simulation Target”.
You can visit the documentation page for GPU Coder for more information.
  1 Kommentar
Matteo Bordignon
Matteo Bordignon am 9 Feb. 2023
Thank you for your answer.
I had already tried GPU Coder but it seems to be doing more harm than good; the time to compile grew exponentially and the animation was incredibly slow. Moreover, from the Task Manager I could still see that the dedicated GPU was turned off.
I don't think this can be a solution since when I save the model without enabling GPU Acceleration and run the simulation from the Command Window, it should use the 'normal' coder and it activates the GPU correctly.
Do you have any other idea?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by