MATLAB and Simulink results are different (GPU Coder)
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dhivyan Ravichandran
le 6 Sep 2020
Commenté : Dhivyan Ravichandran
le 11 Sep 2020
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 commentaires
Réponse acceptée
Walter Roberson
le 6 Sep 2020
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.)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with GPU Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!