_______________________________________________
NumPy-Discussion mailing list
NumPy-Di...@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
--
View this message in context: http://old.nabble.com/Apparently-non-deterministic-behaviour-of-complex-array-multiplication-tp32893004p32898294.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
The context here is that I read in 24 files, totaling about 7GB, and then
forming data matrices of size 24 x N, where N varies. I tried for example
this morning to run the same code, but working with only 12 of the files -
just to see if NaNs appeared. No NaN appeared however when the machine was
being less 'taxed'.
Strangely enough, I also seterr(all='raise') in the workspace before
executing this (in the case where I read all 24 files and do net NaN) and I
do not get any messages about the NaN while the calculation is taking place.
If you want to play with this I would be willing to put the data on a file
sharing site (its around 7.1G of data) together with the code and you could
play with it from there. The code is not too many lines - under 100 lines,
and I am sure I could trim it down from there.
Let me know if you are interested.
cheers,
K
--
View this message in context: http://old.nabble.com/Apparently-non-deterministic-behaviour-of-complex-array-multiplication-tp32893004p32898383.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
_______________________________________________
Hi Pierre,
I was thinking about uploading some examples but strangely, when I store the
array using for example: np.save('Y',Y)
and then reload it in a new workspace, I find that the problem does not
reproduce. It would seem somehow to be
associated with the 'overhead' of the workspace I am in...
The context here is that I read in 24 files, totaling about 7GB, and then
forming data matrices of size 24 x N, where N varies. I tried for example
this morning to run the same code, but working with only 12 of the files -
just to see if NaNs appeared. No NaN appeared however when the machine was
being less 'taxed'.
I confirmed with the guy who put together the machine that it is non-ECC
RAM. You know, now that i think about it, this machine seems to crash a
fair amount more often than its identical twin which sits on a desk near me.
I researched memtest a bit... downloaded and compiled it, but I do not quite
understand the finer points of using it... it seems that I want to remove my
RAM cards and test them one at a time. Do you know a good reference for
using it.
I think at this point the best thing to do will be to dump my data/code to
portable HDD and load it on the other computer with same specs as this one.
If it runs without generating any NaN then I will proceed to a full memtest.
Thanks for the advice.
-Karl
--
View this message in context: http://old.nabble.com/Apparently-non-deterministic-behaviour-of-complex-array-multiplication-tp32893004p32900355.html
2. Here is how I am temporarily working around the problem: Right before
performing the multiplication of X*X.H where X=asmatrix(Y), I save X to file
using np.save('X',X). Then I reload it via X=np.load('X.npy'). Cast as
matrix: X=asmatrix(X); and carry on: S=X*X.H. I have not seen any NaN
although I have only run it a few times... but it seems to work.
I'd be very curious to hear any ideas on why this problem exists in the
first place, and why save/load gets me around it.
For the record I am running ubuntu 11.04, have 16GB RAM (not 12) and use
python2.7.
cheers,
Karl
Hi Pierre,
I confirmed with the guy who put together the machine that it is non-ECC
RAM. You know, now that i think about it, this machine seems to crash a
fair amount more often than its identical twin which sits on a desk near me.
I researched memtest a bit... downloaded and compiled it, but I do not quite
understand the finer points of using it... it seems that I want to remove my
RAM cards and test them one at a time. Do you know a good reference for
using it.
I think at this point the best thing to do will be to dump my data/code to
portable HDD and load it on the other computer with same specs as this one.
If it runs without generating any NaN then I will proceed to a full memtest.
Thanks for the advice.
-Karl
On Thu, Dec 1, 2011 at 2:47 PM, kneil <magnetot...@gmail.com> wrote:
Are you using non-ECC RAM, by chance? (Though if you have >4GB of ram, I
can't imagine that you wouldn't be using ECC...)
Alternately, have you run memtest lately? That sound suspiciously like bad
ram...
--
View this message in context: http://old.nabble.com/Apparently-non-deterministic-behaviour-of-complex-array-multiplication-tp32893004p32906553.html
If save/load actually makes a reliable difference, then it would be useful to do something like this, and see what you see:
save("X", X)
X2 = load("X.npy")
diff = (X == X2)
# did save/load change anything?
any(diff)
# if so, then what changed?
X[diff]
X2[diff]
# any subtle differences in floating point representation?
X[diff][0].view(np.uint8)
X2[diff][0].view(np.uint8)
(You should still run memtest. It's very easy - just install it with your package manager, then reboot. Hold down the shift key while booting, and you'll get a boot menu. Choose memtest, and then leave it to run overnight.)
- Nathaniel
np.save('X',X);
X2=np.load('X.npy')
X2=np.asmatrix(X2)
diffy = (X != X2)
if diffy.any():
print X[diffy]
print X2[diffy]
print X[diffy][0].view(np.uint8)
print X2[diffy][0].view(np.uint8)
S=X*X.H/k
S2=X2*X2.H/k
nanElts=find(isnan(S))
if len(nanElts)!=0:
print 'WARNING: Nans in S:'+str(find(isnan(S)))
print 'WARNING: Nans in S2:'+str(find(isnan(S2)))
My ouput, (when I got NaN) mostly indicated that both arrays are numerically
identical, and that they evaluated to have the same nan-value entries.
For example
>>WARNING: Nans in S:[ 6 16]
>>WARNING: Nans in S2:[ 6 16]
Another time I got as output:
>>WARNING: Nans in S:[ 26 36 46 54 64 72 82 92 100 110 128 138 146
156 166 174 184 192
202 212 220 230 240 250 260 268 278 279 296 297 306 314 324 334 335 342
352 360 370 380 388 398 416 426 434 444 454 464 474]
>>WARNING: Nans in S2:[ 26 36 46 54 64 72 82 92 100 110 128 138 146
156 166 174 184 192
202 212 220 230 240 250 260 268 278 279 296 297 306 314 324 334 335 342
352 360 370 380 388 398 416 426 434 444 454 464 474]
These were different arrays I think. At anyrate, those two results appeared
from two runs of the exact same code. I do not use any random numbers in
the code by the way. Most of the time the code runs without any nan showing
up at all, so this is an improvement.
*I am pretty sure that one time there were nan in S, but not in S2, yet
still no difference was observed in the two matrices X and X2. But, I did
not save that output, so I can't prove it to myself, ... but I am pretty
sure I saw that.
I will try and run memtest tonight. I am going out of town for a week and
probably wont be able to test until next week.
cheers,
Karl
I also think What was beyond w:
1. I have many less NaN than I used to, but still get NaN in S,
but NOT in S2!
--
View this message in context: http://old.nabble.com/Apparently-non-deterministic-behaviour-of-complex-array-multiplication-tp32893004p32922174.html
Nathaniel Smith wrote:
>
> (You should still run memtest. It's very easy - just install it with your
> package manager, then reboot. Hold down the shift key while booting, and
> you'll get a boot menu. Choose memtest, and then leave it to run
> overnight.)
>
> - Nathaniel
>
>
--
View this message in context: http://old.nabble.com/Apparently-non-deterministic-behaviour-of-complex-array-multiplication-tp32893004p32927196.html
Olivier Delalleau-2 wrote:
>
> I was trying to see if I could reproduce this problem, but your code fails
> with numpy 1.6.1 with:
> AttributeError: 'numpy.ndarray' object has no attribute 'H'
> Is X supposed to be a regular ndarray with dtype = 'complex128', or
> something else?
>
> -=- Olivier
>
>
--
View this message in context: http://old.nabble.com/Apparently-non-deterministic-behaviour-of-complex-array-multiplication-tp32893004p32969114.html