This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Using Intel® MKL from Eigen - FullPivLU

Tags: None
(comma "," separated)
gfedorov
Registered Member
Posts
1
Karma
0
Hello,
Eigen v3.3 ( windows, 64 bit).
I am trying to evaluate Intel MKL's LU decompostion from Eigen ( FullPivLU ) and I follow with this description :https://eigen.tuxfamily.org/dox/TopicUsingIntelMKL.html
it seems that Eigen::FullPivLU is not substituted with calls to Intel MKL ( getrf ) in that case.

Here is the example of the code I use:
#include <iostream>
#define EIGEN_USE_MKL_ALL
#include <Eigen/Dense>
#include <ctime>
using namespace Eigen;
using namespace std;
int main() {
typedef Matrix<double, 5, 3> Matrix5x3;
typedef Matrix<double, 5, 5> Matrix5x5;
Matrix5x3 m = Matrix5x3::Random();
cout << "Here is the matrix m:" << endl << m << endl;
Eigen::FullPivLU<Matrix5x3> lu(m);
cout << "Here is, up to permutations, its LU decomposition matrix:"
<< endl << lu.matrixLU() << endl;
cout << "Here is the L part:" << endl;

Matrix5x5 l = Matrix5x5::Identity();
l.block<5,3>(0,0).triangularView<StrictlyLower>() = lu.matrixLU();
cout << l << endl;
cout << "Here is the U part:" << endl;

Matrix5x3 u = lu.matrixLU().triangularView<Upper>();
cout << u << endl;
cout << "Let us now reconstruct the original matrix m:" << endl;
cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl;
return 0;
}

to check if Eigen's functions has been substituted by MKL's, I set MKL_VERBOSE=1 environment variables and see no results.
using for example matrix-vector, matrix-matrix, JacobiSVD or Cholesky factorization functions, I see all are OK and Eigen's calls are substituted by MKL:

here is example how I see this by using JacobiSVD:
set MKL_VERBOSE=1
....\Eigen>JacobiSVD.exe
Here is the matrix m:
-0.997497 0.617481
0.127171 0.170019
-0.613392 -0.0402539
MKL_VERBOSE Intel(R) MKL 2017.0 Update 3 Product build 20170413 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2)
enabled processors, Win 1.90GHz cdecl intel_thread NMICDev:0
MKL_VERBOSE SGESVD(S,S,3,2,000000583939D190,3,000000583939F750,000000583939D6D0,3,000000583939D3B0,2,00000058391BF630,-1,0) 5.42ms CNR:OFF Dyn:1 FastM
M:1 TID:0 NThr:2 WDiv:HOST: -nan
MKL_VERBOSE SGESVD(S,S,3,2,000000583939D190,3,000000583939F750,000000583939D6D0,3,000000583939D3B0,2,000000583939F180,10,0) 168.89us CNR:OFF Dyn:1 Fas
tMM:1 TID:0 NThr:2 WDiv:HOST:+0.000
Its singular values are:
1.28435
0.386867
Its left singular vectors are the columns of the thin U matrix:
-0.906518 -0.37201
0.034606 -0.536653
-0.420747 0.757372
Its right singular vectors are the columns of the thin V matrix:
0.908419 -0.41806
-0.41806 -0.908419
Now consider this rhs vector:
1
0
0
A least-squares solution of m*x = rhs is:
MKL_VERBOSE SGEMV(N,2,2,00000058391BF3B8,000000583939D010,2,000000583939F690,1,00000058391BF3B4,000000583939F770,1) 18.02us CNR:OFF Dyn:1 FastMM:1 TID
:0 NThr:2 WDiv:HOST:+0.000
-0.239172
1.16861
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Indeed, on PartialPivLU is substituted. LU with full pivoting is inherently very slow, but there are intermediates, like LU with rook pivoting. I don't know if MKL provides anything like that though.


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]