Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7086 Discussions

SVD with via "divide and conquer" method (LAPACKE_sgesdd)

VICTOR_K_Intel
Employee
1,273 Views

Hi,

I am searching for the most efficient SVD calculation approach in MKL and about to conclude this is "LAPACKE_sgesdd". Could you please help me with two questions:

1. Is "LAPACKE_sgesdd" really the fastest routine in MKL in sense of SVD decomposition or I missed something?

2. Why when I make a call

LAPACKE_sgesdd(CblasRowMajor, 'A', dim, dim, X, dim, e, U, dim, V, dim);

everything works fine (U, V, and e arrays are filled as imposed by MKL manual), but when I make a call with jobz = 'O'

LAPACKE_sgesdd(CblasRowMajor, 'O', dim, dim, X, dim, e, U, dim, V, dim);

error is output "MKL ERROR: Parameter 10 was incorrect on entry to SGESDD."?

 

Thanks,

Victor.

0 Kudos
5 Replies
mecej4
Honored Contributor III
1,273 Views

I ran your example on Windows 8.1 X64 with the 32-bit and 64-bit 14.0.2 compilers, and the code ran with no error messages output, whether I used 'O' or 'A' as the second argument to LAPACKE_sgesdd.

It is not useful to use matrices with random values for elements when computing the SVD, particularly when a runtime error is involved and the occurrence of the error may depend on the values of the matrix elements. This could be one reason for my failure to reproduce the error that you reported.

Secondly, if by "most efficient" you mean "fastest", you need to come up with a test matrix that is much larger than a pitiful 5 X 5 matrix in order to get meaningful timing results.

 

0 Kudos
Gennady_F_Intel
Moderator
1,273 Views

I have also checked this example with the MKL v, 11.1 update 2 for win32 and 64 bits -- the lapack_int res = LAPACKE_sgesdd(....); always returned OK.

0 Kudos
VICTOR_K_Intel
Employee
1,273 Views

Thanks for quick response, guys.

Originally I compiled my example with MKL 11.1.1 and there was error. But compiling with 11.1.2 work fine for me to. The problem has gone. Great!

mecej4, thank you for advice, this does make sense. As for this error, it is reproducible quiet stable on MKL 11.1.1 so uncertainty didn't play a big role there. As for 5x5 size matrices, they were used to have as simple example as possible to reproduce the bug, not for performance.

But still, could you recommend any more fast routine to compute SVD for big matrices (e.g. 5000x5000), or LAPACKE_sgesdd is the fastes one?

0 Kudos
mecej4
Honored Contributor III
1,273 Views

>But still, could you recommend any more fast routine to compute SVD for big matrices (e.g. 5000x5000), or LAPACKE_sgesdd is the fastes one?
I am afraid that there is no simple answer (note this quotation of H.L. Mencken: For every complex problem there is an answer that is clear, simple and wrong.). It frequently happens in numerical mathematics that one's list of desired attributes of a solution method must change when problem sizes are scaled up from sizes that are amenable to back-of-the-envelope treatment to problems that are many orders of magnitude larger.

 

What attributes can you identify for your input matrices? Are they banded? Sparse? Do you need only the singular values, or do you need singular vectors?

How many singular values do you require? Or will a mere count of non-zero singular values suffice? What do you intend to do with the singular values?

Suppose a single "best" routine existed. Why would a library for professional (rather than pedagogical) use, such as MKL, provide any other routines designed for treating the same problem, assuming that there were no trade secrets or copyright issues at play?

0 Kudos
VICTOR_K_Intel
Employee
1,273 Views

:-)

I see what you mean, mecej4, and agree about "correctness" of my original question.

Unfortunately I don't have any specific attributes for input matrices (except symmetry in some cases) and all singular values/vectors are required.

0 Kudos
Reply