intel XEON E7 compilation

83 views
Skip to first unread message

Alvaro Ulloa

unread,
Feb 11, 2014, 4:31:21 PM2/11/14
to openbla...@googlegroups.com
Hi, 

I am not an adance linux user but I know I have an Intel(R) Xeon(R) CPU E7- 4870 processor. 

Default compilatino settings doesn't seem to work. Any suggestions on what architecture or compilation options I should use?

Thanks in advance

Alvaro Ulloa

unread,
Feb 11, 2014, 10:32:00 PM2/11/14
to openbla...@googlegroups.com
Just to elaborate more in my question.

I said default compilation does not work I meant the following

Running the following in R 

a<- matrix(rnorm(4*4),4)

and then compuiting the pseudoinverse and multiplying by itself I should get Identity

library(MASS)
ginv(a)%*%a

This is true SOMETIMES, here two answers :

> ginv(a)%*%a
            [,1]        [,2]        [,3]        [,4]
[1,]  0.07823858 -0.22477713 0.028575229 -0.29368248
[2,] -0.22246013  0.94575174 0.006896415 -0.07087804
[3,] -0.19005871 -0.04634697 1.005891949 -0.06055462
[4,] -0.18891406 -0.04606784 0.005856464  0.93981008
> ginv(a)%*%a
             [,1]          [,2]          [,3]          [,4]
[1,] 1.000000e+00 -1.665335e-16 -1.110223e-16 -4.267420e-16
[2,] 9.714451e-17  1.000000e+00  4.440892e-16 -4.718448e-16
[3,] 2.220446e-16 -2.220446e-16  1.000000e+00  1.595946e-16
[4,] 1.089406e-15 -3.330669e-16  0.000000e+00  1.000000e+00

Although, using 

solve(a)%*%a 

always work


Any help in this matter is highly appreciated. 

Zhang Xianyi

unread,
Feb 11, 2014, 10:43:26 PM2/11/14
to Alvaro Ulloa, openbla...@googlegroups.com
Hi Alvaro,

I think the default setting is fine for your CPU.

Did you mean ginv(a)%*%a gave wrong answers sometimes? 

Thank you

Xianyi
 


--
You received this message because you are subscribed to the Google Groups "OpenBLAS-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openblas-user...@googlegroups.com.
To post to this group, send email to openbla...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Alvaro

unread,
Feb 11, 2014, 10:51:09 PM2/11/14
to Zhang Xianyi, openbla...@googlegroups.com
Yes, it gives different answers. Not using openBLAS I get always the same answer.

Alvaro Ulloa

Zhang Xianyi

unread,
Feb 11, 2014, 11:36:59 PM2/11/14
to Alvaro, openbla...@googlegroups.com
Could you give any tip about ginv(a)%*%a? For example, which BLAS function used in ginv(a)%.

Alvaro

unread,
Feb 12, 2014, 12:06:37 AM2/12/14
to Zhang Xianyi, openbla...@googlegroups.com
ginv computes the Moore-Penrose generalized inverse of a matrix X

ginv is writen in R script. The main operation is the svd
decomposition of a matrix.

Inside the SVD function there is a function called La.svd and inside
it the following call

res <- .Internal(La_svd(jobu, x, double(min(n, p)), u, vt))

So my guess is that La_svd should call some BLAS function computing
the SVD decomposition
Alvaro Ulloa

Carter Schonwald

unread,
Feb 12, 2014, 2:53:16 AM2/12/14
to Alvaro, Zhang Xianyi, openbla...@googlegroups.com
Alvaro,
could you reproduce the problem directly against that internal ffi call (and share the associated binding code?).

R is its own code base, and while many people on this list are likely sometimes R users, the more you can reproduce the problem exactly against the libs that are the likely culprit, the better!

-Carter

Alvaro

unread,
Feb 12, 2014, 1:29:11 PM2/12/14
to Carter Schonwald, Zhang Xianyi, openbla...@googlegroups.com
Hi,

I don't know what a ffi is but I will guess it is the La_svd function.
I also don't know what a binding code is.

I tried running La_svd using the .Internal function as in R but I got
a segmentation fault.

> a<- matrix(rnorm(4*4),4)
> u<-matrix(0,4,4)
> v<-matrix(0,4,4)
> res<- .Internal(La_svd("S",a,4,u,v))
> res

*** caught segfault ***
address (nil), cause 'unknown'
Alvaro Ulloa

Alvaro

unread,
Feb 12, 2014, 1:52:51 PM2/12/14
to Carter Schonwald, Zhang Xianyi, openbla...@googlegroups.com
Update:

I should have called

> res<- .Internal(La_svd("S",a,double(4),u,v))

with that I don't get the segfault again.

after testing that function using openBLAS it seems to to the SVD
correctly. So, I don't know where the error is happening.


Alvaro Ulloa

Alvaro

unread,
Feb 12, 2014, 1:57:21 PM2/12/14
to Carter Schonwald, Zhang Xianyi, openbla...@googlegroups.com
Update:

Playing around with ginv()

It works when I call it as follow

> ginv(a,tol=-1)%*%a


can someone explain why?

Ps: When not using openBLAS I don't need that fix


Alvaro Ulloa

Alvaro

unread,
Feb 12, 2014, 1:58:41 PM2/12/14
to Carter Schonwald, Zhang Xianyi, openbla...@googlegroups.com
Ignore last message.

I was just lucky to get 10 right answers in a row. Then it started
failing again :(
Alvaro Ulloa

Alvaro

unread,
Feb 12, 2014, 2:08:32 PM2/12/14
to Carter Schonwald, Zhang Xianyi, openbla...@googlegroups.com
Update:

Definetly the SVD decomposition is the problem.
It is giving a wrong answer sometimes.

See the following:

> b<- svd(a); norm(a- b$u%*%diag(b$d)%*%t(b$v),type="F")
[1] 2.640037e-15
> b<- svd(a); norm(a- b$u%*%diag(b$d)%*%t(b$v),type="F")
[1] 2.640037e-15
> b<- svd(a); norm(a- b$u%*%diag(b$d)%*%t(b$v),type="F")
[1] 0.5132554


I decompose matrix a and then compare how good the reconstruction is.
Ideally the results should zero or small number. But 0.5 is
inacceptable.

Alvaro Ulloa

Alvaro

unread,
Feb 12, 2014, 6:24:23 PM2/12/14
to openbla...@googlegroups.com
Update:

Apparently it is a LAPACK problem

the SVD help on R states : "The main functions used are the LAPACK
routines DGESDD and ZGESVD."

Installing gotoBLAS worked fine but only with 16 threads. My machine
was compiled to use 80 threads.

Should I compile LAPACK too?
Alvaro Ulloa

Carter Schonwald

unread,
Feb 12, 2014, 7:07:48 PM2/12/14
to Alvaro, openbla...@googlegroups.com
Did you use your Linux package manager to install openblas? Some of them, like Debian, don't build lapack with openblas. 

Could you try building openblas from source yourself  with the default flags on the machine you're doing the testing? 
Reply all
Reply to author
Forward
0 new messages