Random rounding errors
David Bateman
David.Bateman at motorola.com
Thu Mar 13 08:24:25 CDT 2008
Marco Caliari wrote:
> David, I didn't understand: could the flag -ffloat-store be the
> problem or the fix? How can I verify if this is the problem?
>
>
Using -ffloat-store to compile the atlas/blas/lapack might be the
solution.. The x86 registers are longer than the double precision
numbers they represent. That is a multiplication of two 64 bit double
precision numbers results in a value store in an 80 bit register. The
following calculation can use this 80 bit value directly, rather than
having to reload the value in to the register first, resulting in
slightly higher precision and faster calculations. The sense of the
"-ffloat-store" flag is that all register values are stored to memory
after a calculation forgoing this optimization.
It most cases you don't want to use "-ffloat-store", but I think this
reuse of the register values might be the cause of the randomness in
your solutions. What I believe is happening is that the kernel is
preempting the process, forcing the calculation back to memory and
loosing those extra 16bits of precision. When this occurs will appear
entirely random as its up to the kernel to decide when to preempt the
calculation. For same calculations (and certainly those that take less
than 10ms) it is hardly preempting your calculation, but when the
calculation becomes large it might. The predominant value of the
solution you are seeing is probably the one where the calculation is not
preempted.
I'm surprised you don't see similar behavior for reference blas though I
suspect it might be that atlas makes more use of this optimization than
the reference blas.. In any case compiling atlas/lapack/blas with
-ffloat-store should probably address the issue. However, if the above
is the cause of the issue, then perhaps you really shouldn't care.....
Regards
David
--
David Bateman David.Bateman at motorola.com
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
More information about the Bug-octave
mailing list