GRT target code runs slower than Rapid Accelerator mode

1 次查看(过去 30 天)
Hello,
I have a large Simulink model that is modeling multiple dynamic systems. In rapid accelerator mode, the model runs at about 1.5x real time. I have used the Real-Time Workshop to generate C code of the model and have built an executable using the grt_main.c wrapper function. The executable runs at about 6x real time. Is this typical? If not, does anyone know why this might be?
I have enabled most of the optimization options and parameter inlining. My model does not need to run in real-time, it just concerns me that it takes 4x longer to run the generated code than it dos to run in rapid accelerator mode.
At first glance the generated code appears to produce the same results as rapid acclerator mode, but I am in the process of formally verifying that.
Also, I have several enabled subsystems that run in multiple sample times. I haven't had a chance to correct these yet, so i disabled the error. I dont know if this is related to my speed issue, but you never know.
Thanks for any info,
Matt
  6 个评论
Guy Rouleau
Guy Rouleau 2011-2-7
This is very surprising. I can't guess anything else. I recommend contacting technical support because this is definitely unexpected. To investigate deeper, what I would do is to cut the model in pieces, trying to isolate the piece causing problems.
Matthew
Matthew 2011-2-8
I will try picking apart my model and testing each piece individually. I'll post back if I discover anything.

请先登录,再进行评论。

回答(3 个)

Seth Popinchalk
Seth Popinchalk 2011-2-17
It is likely that some of the hooks to connect the Rapid Accelerator mode simulation with Simulink may add a measurable overhead to the simulation. The GRT Wrapper generated executable would not include those hooks, so it could conceivable be faster. (You might be able to verify this by building GRT with external mode support to see if it slows down the GRT based executable.)

Seth Popinchalk
Seth Popinchalk 2011-2-17
The memory layout for a GRT executable and a Rapid Accelerator executable could be quite different. Depending on cache effects, and algorithm access patterns, the time to access global memory may have a significant impact on run time. The so-called pathological cache effects ( cache misses ) can result in significant run-time changes.

Brad Carman
Brad Carman 2018-6-4
Was there ever an answer to this question? I'm currently experiencing the same exact problem.

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by