I am trying to solve a linear system of equations of the form Ax=b with the LeastSquaresConjugateGradient of the Eigen library and A is a sparse matrix.
LeastSquaresConjugateGradient < SparseMatrix < double > > solver;
solver.compute( A );
x = solver.solve( b );
In principle it works perfectly. But I want to use this for quite huge matrices and hence it would be nice to run this in parallel. The Eigen documentation only mentions to put the following lines on top.
omp_set_num_threads( 2 );
setNbThreads( 2 );
Moreover the documentation states that the LeastSquaresConjugateGradient routine should work in parallel.
I also set the number of threads in bash by export OMP_NUM_THREADS=2
But still I get no performance gain at all. What am I doing wrong??