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 !!!
댓글 수: 0
채택된 답변
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 Center 및 File 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!