numerics - How to determine BLAS/LAPACK implementation used internally for numerical matrix operations?
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.
Comments
Post a Comment