MATLAB and Simulink results are different (GPU Coder)

7 次查看(过去 30 天)
Hello all,
For my project I had integrated GPU coder into simulink for evaluvating State space equation and I got the output.
Also using the function in MATLAB, I got the results.
While comparing both the results, the difference should be 0, but I am getting the difference in output as 1e-13(approx.)
So can anyone please explain me why there is difference in the results???
Thanks in advance !!!

采纳的回答

Walter Roberson
Walter Roberson 2020-9-6
You should not expect the exact same results between CPU and GPU for floating point arithmetic.
CPU and GPU have different instruction sets. When you compile for GPU, the order of operations can be different than for CPU, including because of differences in the optimization capabilities of the different compilers. For efficiency, a number of operations on GPU use vendor high-performance libraries, which use different implementations than the high-performance libraries used for CPU. Whether the high performance libraries are even invoked on CPU depends on the problem size (there is a cost to starting up those library calls, so MATLAB does the calculations more directly for smaller calculations.)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with GPU Coder 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by