* [gentoo-science] Atlas giving wrong results on matrix multiplication
@ 2011-09-14 8:48 Xavier Fernández i Marín
2011-09-19 15:15 ` Andrea Arteaga
0 siblings, 1 reply; 3+ messages in thread
From: Xavier Fernández i Marín @ 2011-09-14 8:48 UTC (permalink / raw
To: gentoo-science
Dear all,
I recently submitted a question to the R-help mailing list, because I
noticed that matrix multiplication was giving me trouble (basically, that
there were some times when a result was NaN):
http://tolstoy.newcastle.edu.au/R/e15/help/11/09/7165.html
As it is mentioned in the end of the thread, the solution was to recompile
R against the reference blas and lapack libraries, and avoid the atlas
that I was using.
So it seems that the problem is not R-related, but atlas-related, and
linked to gentoo, I would like to share the problem with you, just in case
somebody has any clue on what is wrong with atlas.
Although I have firstly used a very aggressive cflags to compile atlas
(-Ofast), I suspected that the problem was that, but I recompiled atlas
using -O2 and the problem still presists with atlas, but is solved with
reference.
I am using atlas-3.9.23-r4, R-2.13.1 and gcc-4.6.1
Thank you,
--
- Xavier -
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-science] Atlas giving wrong results on matrix multiplication
2011-09-14 8:48 [gentoo-science] Atlas giving wrong results on matrix multiplication Xavier Fernández i Marín
@ 2011-09-19 15:15 ` Andrea Arteaga
2011-09-20 5:17 ` Xavier Fernández i Marín
0 siblings, 1 reply; 3+ messages in thread
From: Andrea Arteaga @ 2011-09-19 15:15 UTC (permalink / raw
To: gentoo-science
Dear Xavier,
thank you for your email and sorry for the late reply.
In theory it should be useless to provide optimization flags when
compiling ATLAS, because it automatically uses and tests many flags,
but I could be wrong.
How did you install ATLAS? From the science overlay? I suggest that
you update it. Now in the overlay we have sci-libs/atlas-3.9.49
(~keyworded) [BTW, I will probably bump the version to 3.9.51 today].
Could you install it and redo the test? Otherwise, could you shortly
explain how to reproduce the problem, so that I can try?
Cheers
Andrea Arteaga
2011/9/14 Xavier Fernández i Marín <xfim.ll@gmail.com>:
> Dear all,
>
> I recently submitted a question to the R-help mailing list, because I
> noticed that matrix multiplication was giving me trouble (basically, that
> there were some times when a result was NaN):
> http://tolstoy.newcastle.edu.au/R/e15/help/11/09/7165.html
>
>
> As it is mentioned in the end of the thread, the solution was to recompile
> R against the reference blas and lapack libraries, and avoid the atlas
> that I was using.
>
> So it seems that the problem is not R-related, but atlas-related, and
> linked to gentoo, I would like to share the problem with you, just in case
> somebody has any clue on what is wrong with atlas.
>
> Although I have firstly used a very aggressive cflags to compile atlas
> (-Ofast), I suspected that the problem was that, but I recompiled atlas
> using -O2 and the problem still presists with atlas, but is solved with
> reference.
>
> I am using atlas-3.9.23-r4, R-2.13.1 and gcc-4.6.1.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-science] Atlas giving wrong results on matrix multiplication
2011-09-19 15:15 ` Andrea Arteaga
@ 2011-09-20 5:17 ` Xavier Fernández i Marín
0 siblings, 0 replies; 3+ messages in thread
From: Xavier Fernández i Marín @ 2011-09-20 5:17 UTC (permalink / raw
To: gentoo-science
Andrea Arteaga vas escriure el dia dl, 19 set 2011:
> Dear Xavier,
>
> thank you for your email and sorry for the late reply.
> In theory it should be useless to provide optimization flags when
> compiling ATLAS, because it automatically uses and tests many flags,
> but I could be wrong.
Yes, Atlas tries to find the best options. However, I was worried because
I had -Ofast in CFLAGS, and thought that maybe some GCC optimizations were
harming the binary.
>
> How did you install ATLAS? From the science overlay? I suggest that
> you update it. Now in the overlay we have sci-libs/atlas-3.9.49
> (~keyworded) [BTW, I will probably bump the version to 3.9.51 today].
> Could you install it and redo the test? Otherwise, could you shortly
> explain how to reproduce the problem, so that I can try?
No, I simply use the atlas provided in the official gentoo branch.
François sent an email pointing that there was a problem with 3.9-xx, and
suggesting going bach to 3.8. This is what I did and it is working fine,
without errors. So I assume that, effectively, it was something related
to the 3.9 branch, rather than compiling options.
A simplification of the code that was giving trouble is:
-----8<---------------
B <- c(0, 4.9039)
for (l in 10:100) {
X <- cbind(1, matrix(rnorm(l, 0, 3), ncol=1))
X <- ics
for (i in 1:1000) {
M <- X %*% B
w <- which(is.nan(M))
l <- length(w)
if (l!=0) {
print(paste("Length", l, "error(s) on", X[w,2], sep=" "))
}
}
}
-----8<---------------
Thank you,
--
- Xavier -
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-20 5:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-14 8:48 [gentoo-science] Atlas giving wrong results on matrix multiplication Xavier Fernández i Marín
2011-09-19 15:15 ` Andrea Arteaga
2011-09-20 5:17 ` Xavier Fernández i Marín
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox