Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a command which reveals which implementation of BLAS and LAPACK are used in Mathematica's matrix operations such as Eigensystem? I asked a related question on StackOverflow and one user mentioned that in Julia, the BLAS/LAPACK implementation can be found by executing versioninfo(). Several users who tried my code there had varying results, with some observing Mathematica to execute faster, and others observing Julia executing faster.

In my case, my Julia installation appears to make use of the OpenBLAS implementation, and it runs between 3 to 6 times slower than Mathematica's Eigensystem for randomly-generated arrays of size $1000\times1000$ to $2000\times2000$.

In the Mathematica documentation's tutorial/SomeNotesOnInternalImplementation, it mentions "For dense arrays, LAPACK algorithms extended for arbitrary precision are used when appropriate" and "BLAS technology is used to optimize for particular machine architectures", but nothing more.

EDIT: So in response to Kuba's comment, apparently one of the Julia devs noted that there is anomalous behavior in Julia with regards to eigenvector computation speed as a function of BLAS thread number. In short, using more threads in Julia's use of OpenBLAS appears to slow things down considerably. For reference, in Mathematica:

SetSystemOptions["MKLThreads" -> 1];
First@Timing@Eigensystem[RandomReal[{-500, 500}, {1000, 1000}]]
SetSystemOptions["MKLThreads" -> 2];
First@Timing@Eigensystem[RandomReal[{-500, 500}, {1000, 1000}]]
SetSystemOptions["MKLThreads" -> 3];
First@Timing@Eigensystem[RandomReal[{-500, 500}, {1000, 1000}]]
SetSystemOptions["MKLThreads" -> 4];
First@Timing@Eigensystem[RandomReal[{-500, 500}, {1000, 1000}]]
(*Out:*)
1.747211
1.466409
1.341609
1.357209

So I guess there's nothing wrong with Mathematica's implementation.

share|improve this question
    
I believe on Windows and Linux it uses the MKL. I'm not sure about OS X. –  Szabolcs Feb 8 at 19:25
    
Okay, I'll assume it's Intel MKL for now. Is there any way to test it to verify? Like for determining which C compiler is in use you just execute CCompilers[]; is there any equivalent for determining BLAS architecture? –  DumpsterDoofus Feb 8 at 19:28
    
I don't know but I think it's unlikely. You can dig around in the installation directory and see what's there. Providing such a function wouldn't allow users to do anything useful they can't already do, so it doesn't make sense to include it in my opinion. We can't swap out the BLAS implementation anyway. Julia can use several libraries so there you do need it for debugging ... –  Szabolcs Feb 8 at 19:40
    
You might be able to get an answer about this from support. It might be worth a try. –  Szabolcs Feb 8 at 19:42
    
So in my Mathematica directory there's a bunch of files relating to the Intel Math Kernel Library, such as "mkl_vml_mc.dll", etc. I'll try asking support anyways just to make sure. –  DumpsterDoofus Feb 8 at 19:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.