Sara
Sara

Reputation: 823

Eigen ConjugateGradient solver not running multithreaded

I have a sparse matrix A of size (91716x91716) with 3096684 nonzero elements, and a dense vector rhs. I am solving the system with a ConjugateGradient this way:

initParallel();
ConjugateGradient<SparseMatrix<double>, Lower|Upper> solver;
solver.compute(A);
const VectorXd response = solver.solve(rhs);

I'm compiling with:

g++ -O3 -I./eigen -fopenmp -msse2 -DEIGEN_TEST_SSE=ON -o example example.cpp

The executions, both with multi-threading and without, take approximately the same (around 1500 ms). I am using Eigen version 3.2.8.

Is there any reason why the multi-threading is not performing better? I actually don't see the multithreading effect in my system monitor. Is there any other way to accelerate this process?

Edit: A call to Eigen::nbThreads() responds 12 threads.

Upvotes: 0

Views: 359

Answers (1)

kangshiyin
kangshiyin

Reputation: 9781

Document of the version 3.2.8

Currently, the following algorithms can make use of multi-threading: general matrix - matrix products, PartialPivLU

http://eigen.tuxfamily.org/dox/TopicMultiThreading.html


As dev document mentions more algorithms are using multi-threading, you need to change to Eigen3.3-beta1 or development branch to use the parallel version of ConjugateGradient.

Upvotes: 2

Related Questions