[Numpy-discussion] Bizarre errors with byteswapping, complex256, PPC
Matthew Brett
matthew.brett@gmail....
Wed Jun 20 15:48:33 CDT 2012
Hi,
Our Debian friends were hammering our code tests before the upcoming
freeze, and found the following very odd thing on 32-bit PPC running
Debian squeeze and numpy 1.6.2 or current trunk.
Consider the following script:
<script>
import numpy as np
arr = np.arange(10, dtype=np.complex256)
bs_arr = arr.byteswap().newbyteorder('S')
print arr
print bs_arr
print arr == bs_arr
print arr == bs_arr
print arr == bs_arr
</script>
Here is the output from some example runs of this script:
np-devel)[mb312@joshlegacy ~/tmp]$ python funny_bs.py
[ 0.0+0.0j 1.0+0.0j 2.0+0.0j 3.0+0.0j 4.0+0.0j 5.0+0.0j 6.0+0.0j
7.0+0.0j 8.0+0.0j 9.0+0.0j]
[ 0.0+0.0j 1.0+0.0j 2.0+0.0j 3.0+0.0j 4.0+0.0j 5.0+0.0j 6.0+0.0j
7.0+0.0j 8.0+0.0j 9.0+0.0j]
[ True False False False False False False False False False]
[ True False False False False False False False False False]
[ True False False False False False False False False False]
(that's the most common result)
(np-devel)[mb312@joshlegacy ~/tmp]$ python funny_bs.py
[ 0.0+0.0j 1.0+0.0j 2.0+0.0j 3.0+0.0j 4.0+0.0j 5.0+0.0j 6.0+0.0j
7.0+0.0j 8.0+0.0j 9.0+0.0j]
[ 0.0+0.0j 1.0+0.0j 2.0+0.0j 3.0+0.0j 4.0+0.0j 5.0+0.0j 6.0+0.0j
7.0+0.0j 8.0+0.0j 9.0+0.0j]
[ True True True True True True True True True True]
[ True True True True True True True True True True]
[ True True True True True True True True True True]
(this happens maybe 10% of the time)
(np-devel)[mb312@joshlegacy ~/tmp]$ python funny_bs.py
[ 0.0+0.0j 1.0+0.0j 2.0+0.0j 3.0+0.0j 4.0+0.0j 5.0+0.0j 6.0+0.0j
7.0+0.0j 8.0+0.0j 9.0+0.0j]
[ 0.0+0.0j 1.0+0.0j 2.0+0.0j 3.0+0.0j 4.0+0.0j 5.0+0.0j 6.0+0.0j
7.0+0.0j 8.0+0.0j 9.0+0.0j]
[ True True True True True True True True True True]
[ True False False False False False False False False False]
[ True True True True True True True True True True]
(less than 10% of the time - order of True, False prints _of the same
comparison_ is random. This only seems to happen with complex256.
Is there anything I can do to debug this further? Does anyone want a
login to this machine to have a look?
See you,
Matthew
More information about the NumPy-Discussion
mailing list