[Numpy-discussion] Different results from repeated calculation

Fernando Perez fperez.net at gmail.com
Sat Jan 27 18:11:59 EST 2007

On 1/27/07, Charles R Harris <charlesr.harris at gmail.com> wrote:

> Hmmm, and your problem machine is running smp linux. As is mine; fedora uses
> smp even on single processor machines these days. I think we could use more
> data here comparing
> Linux (single, smp)
> Window

OK, this is weird.  I modified the repeat code a little to ease
collecting of results, and all of a sudden the differences went away.
If you look at the attached code, here's what happens for me:

a) If I have line 77 like this (commented out):

    #print '-'*75

I get:

94 z different 8.47032947254e-22
95 z different 8.47032947254e-22
96 z different 8.47032947254e-22
98 z different 8.47032947254e-22
99 z different 8.47032947254e-22

Numpy version: 1.0.2.dev3521

test1:  0  differences
test2:  75  differences
test3:  0  differences

b) If I remove the comment char from that line, I get:

tlon[~/Desktop]> python repeat.py

Numpy version: 1.0.2.dev3521

test1:  0  differences
test2:  0  differences
test3:  0  differences

That's it.  One comment char removed, and something that's done
/after/ the tests are actually executed.

That kind of 'I add a printf() call and the bug disappears' is
unpleasantly reminiscent of lurking pointer errors in C code...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: repeat.py
Type: text/x-python
Size: 2129 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070127/f331480e/attachment.py>

More information about the NumPy-Discussion mailing list