## Possible bug dsyevd_gpu test wrong eigenvectors result

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
luiceur
Posts: 26
Joined: Tue Jul 10, 2012 4:38 am

### Possible bug dsyevd_gpu test wrong eigenvectors result

Hi,

I have made a small test including MKL and MAGMA eigenvectors/eigenvalues calculation. I thought it could be due to my data, but it also gives wrong results using the random double matrix generator. For small values (14 - 32) of N, it gives right results, however it doesn't give the right value for eigenvectors for large values of N (1024 onwards). It always gives right results for eigenvalues though. Is that a bug?
Attachments
test.tar.gz

luiceur
Posts: 26
Joined: Tue Jul 10, 2012 4:38 am

### Re: Possible bug dsyevd_gpu test wrong eigenvectors result

Hi Stan,

Did you have a chance to run my test? I've run the test on the Fermi C2050 cards. I have not tried on the K20s yet, but I guess it will hav ethe same effect.
Have you ever heard anything else from anybody about that?

Luis

Stan Tomov
Posts: 281
Joined: Fri Aug 21, 2009 10:39 pm

### Re: Possible bug dsyevd_gpu test wrong eigenvectors result

Hi Luis,
I just ran the test and reproduced your result on a K20c.
I added a check for the factorization though and for the orthogonality and everything looks fine:

Code: Select all

``````test> ./benchmark_cpu -N 2000
Calculating eigenvalues with MKL
Quering space...
Solving eigenvalues...
Calculating eigenvalues with MAGMA
Quering for workspace
Warming up...
Quering optimal sizes...
Performing MAGMA operation...

Successful calculation of eigenvectors/eigenvalues
Testing the factorization A = U S U' for correctness:
(1)    | A - U S U' | / (|A| N) = 3.670771e-18
(2)    | I -   U'U  | /  N      = 6.732193e-17

Eigenvalues: SUCESS!!!!
Calculating max difference eigenvectors ...
ERROR: max diff = 1.088852
``````
I added the check at the end of calcMAGMA.cc with the following code:

Code: Select all

``````  double result[3], eps = lapackf77_dlamch( "E" );

lapackf77_dsyt21( &ione, uplo, &N, &izero,
A, &N,
w, h_work,
Ar, &N,
Ar, &N,
NULL, h_work, &result[0] );

printf("Testing the factorization A = U S U' for correctness:\n");
printf("(1)    | A - U S U' | / (|A| N) = %e\n", result[0]*eps);
printf("(2)    | I -   U'U  | /  N      = %e\n", result[1]*eps);
``````
Similar check for the LAPACK result gives that the factorization is correct and the eigenvectors are orthogonal:

Code: Select all

``````Testing the factorization A = U S U' for correctness:
(1)    | A - U S U' | / (|A| N) = 4.021844e-18
(2)    | I -   U'U  | /  N      = 1.075072e-16
``````
I suppose this has to do with the directions of the vectors, or if there are repeated eigenvalues we may have chosen different than LAPACK corresponding eigenvectors. Is it important for you that the result matches the LAPACK results?
Stan

luiceur
Posts: 26
Joined: Tue Jul 10, 2012 4:38 am

### Re: Possible bug dsyevd_gpu test wrong eigenvectors result

I understand...And yes, your are right. Mathematically the result is correct, but for some reason they are different to the ones calculated with LAPACK. It seems that is important that eigenvectors match the LAPACK eigenvectors within my application...

xinwu
Posts: 8
Joined: Fri Jun 24, 2011 9:22 am

### Re: Possible bug dsyevd_gpu test wrong eigenvectors result

Hi, Stan!

I was using the default "testing_dsyevd" and "testing_dsyevd_gpu" in the "testing" directory in MAGMA v1.3.0. If a very small matrix, e.g. 10x10 matrix, was specified, then it gave some error messages.

Thank you!

/* the output */

xwu@t2090th1:~/magma/magma-1.3.0/testing> ./testing_dsyevd_gpu -N 10
MAGMA 1.3.0
device 0: Tesla M2090, 1301.0 MHz clock, 5375.4 MB memory, capability 2.0
device 1: Tesla M2090, 1301.0 MHz clock, 5375.4 MB memory, capability 2.0
testing_dsyevd -N 10 [-JV] [-JN]

N CPU Time(s) GPU Time(s)
===================================

MKL ERROR: Parameter 11 was incorrect on entry to magma_dsytrd_gpu.

MKL ERROR: Parameter 11 was incorrect on entry to magma_dsytrd_gpu.
10 0.00 0.00
xwu@t2090th1:~/magma/magma-1.3.0/testing> ./testing_dsyevd -N 10
MAGMA 1.3.0
device 0: Tesla M2090, 1301.0 MHz clock, 5375.4 MB memory, capability 2.0
device 1: Tesla M2090, 1301.0 MHz clock, 5375.4 MB memory, capability 2.0
testing_dsyevd -N 10 [-JV] [-JN]

N CPU Time(s) GPU Time(s)
===================================

MKL ERROR: Parameter 9 was incorrect on entry to magma_dsytrd.

MKL ERROR: Parameter 9 was incorrect on entry to magma_dsytrd.
10 0.00 0.00