CUDA - Precision difference in Release version between with and without
debug information
I have a CUDA application, which I compile once for a Release version
twice: once with debug info (-G used) and once without debug info. I run
the application which does some computations on floats (including
functions such as expf, sinf, cosf, etc.). I notice that there are slight
differences in the numbers created by the two versions, here they are side
by side:
0: (-8.000000,0.000000,0.000000) 0: (-8.000000,0.000000,0.000000)
1: (-8.212574,-0.112065,0.970697) 1: (-8.212575,-0.112065,0.970697)
2: (-8.365530,-0.250361,1.949206) 2: (-8.365531,-0.250361,1.949206)
3: (-8.332600,-0.251884,2.948662) 3: (-8.332601,-0.251885,2.948662)
4: (-8.593035,-0.619825,3.841295) 4: (-8.593036,-0.619826,3.841295)
5: (-8.507285,-0.778658,4.824870) 5: (-8.507286,-0.778658,4.824870)
6: (-8.441058,-1.001207,5.797539) 6: (-8.441058,-1.001207,5.797539)
7: (-8.680929,-1.051136,6.767059) 7: (-8.680929,-1.051136,6.767059)
These are the first 7 values (both versions start with -8,0,0). As you can
see at this point there are only small differences in the 6th digit after
the decimal point. However, I use these during rotation matrix
computation, so after 1000 of these, the differences add up to be quite
significant.
I'm not adding the source code because it is very big and quite complicated.
I was wondering why is there a difference in the first place. I know that
there are vast differences between debug and release versions in terms of
optimizations. I guess there are similar differences between release with
and without debug info. However, how could optimizations change
calculation precision?
No comments:
Post a Comment