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

mkl dsyev vs matlab eig()

nick_choo
Beginner
689 Views

Hi,

I ran a little experiment and was perplexed with the answer. Iinterface to mkl via JNI fromjava, and have wrappers that call the appropriate function I want to call. I ran a small test in matlab, calling eig() in a 5000x5000 real symmetric matrix. nowcalling the java function frommatlab, thedsyev takes four times longer than calling eig() on the same matrix. from reading the matlab documentation it seems that eig() calls the same function, dsyev.is there a reason that it would be that much faster in matlab? does matlab do any proprietary optimization that speedsit up somehow?

thanks,

Nick

0 Kudos
2 Replies
Intel_C_Intel
Employee
689 Views

The behavior you are getting seems strange in that the dominant time should be in the eignesolver and not in the interfacing from Java to the function. I am sure that you are correct in thatMATLAB does call the same LAPACK function,dsyev.

I have no experience on doing the sort of thing you are doing so can't be of much help on the implementation. But the "smell test" - factor to 4 difference for the same case - suggests that youtry tofigure out how much of the time is actaully being spent in getting through the wrappers and how much time is actually being spent indsyev. The relative time in invoking thefunction should be negligible. --Bruce

0 Kudos
Intel_C_Intel
Employee
689 Views

Nick,

I want to point out one more fact that you may be aware of, but maybe not. There are some examples with MKL on the use of MKL within Java environments. There are no examples for writing wrappers for LAPACK, but there are examples for some of the BLAS.

Bruce

0 Kudos
Reply