I'm trying to use Eigen (3.3.1 or 3.3.2) with INTEL's MKL PardisoLU solver. I'm using EIGEN_USE_MKL_ALL flag and have IntelSWTools 2017 installed. Currently tried it only on Win10 with VS C++, but this is not the target platform.
The solver itself looks to work significantly faster than the SparseLU which is nice (I'm interesting using a very large matrices).
However in a parallel scenario it doesn't solve my problem correctly. There is no such problem with SparseLU or when I remove the upper level parallelism (commenting the pragma parallel for
below).
The PardisoLU itself supposed to be thread safe, so what am i doing wrong?
The scenario is very briefly as the following
#include <Eigen/PardisoSupport>
#define N = 100000
typedef Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor> FullMatrix;
typedef Eigen::SparseMatrix<Complex, Eigen::ColMajor, long long> SparseMatrix;
typedef Eigen::PardisoLU<SparseMatrix> Solver;
//typedef Eigen::SparseLU<SparseMatrix, Eigen::COLAMDOrdering< long long>> Solver;
Eigen::initParallel();
SparseMatrix A = CreateA();
Solver S;
S.analyzePattern(A);
S.factorize(A);
FullMatrix Q(A.rows(),N);
#pragma omp parallel for
for (int n = 0; n < N; ++n)
{
SparseMatrix Rhs = getRhs(n);
Q.col(n) = S.Solve(Rhs);
}