0

I'm trying to use the sparsesuite SPQR support module in eigen to solve a system with multi-threading enabled.

I've compiled the corresponding library with -fopenmp flags and tbb. What i'm running is something like

uint n =  Eigen::nbThreads();
vec b = ...; //vector of size ~ 10000
Eigen::SPQR<Eigen::SparseMatrix<double>> qr;
qr.setPivotThreshold(1e-6);
qr.compute(H0); //H0 is a Eigen::SparseMatrix<double> 10000 x 1000
vec a = qr.solve(b);

Running it with various number of threads (1,2,4,16), i'm seeing absolutely no speed-up even if Eigen::nbThreads() returns the right value.

If i use conjugate gradient instead, there is a clear benefit of increasing the number of threads.

So my question is: would you have a clue on why the parallelization seems not to work using SPQR? Am i forgetting something somewhere?

Thanks in advance for your answer,

Mi Ka
  • 1
  • 1
  • 1
    SPQR is not benefiting from multithreading: https://eigen.tuxfamily.org/dox-devel/TopicMultiThreading.html – chtz Apr 19 '21 at 13:32
  • Thanks for the answer, I'm not talking about SparseQR, buit sparsesuite SPQR : https://eigen.tuxfamily.org/dox/classEigen_1_1SPQR.html – Mi Ka Apr 19 '21 at 13:58
  • Did you check the SuiteSparseQR documentation if it supports multithreading (and if so, how to activate it)? – chtz Apr 19 '21 at 19:41
  • I read the guide extensively, though didn't help me much. As a matter of fact, i tried limiting myself to the demo in suite sparse package (without eigen), and still observe a lack of parallelization even on a rather large matrix (taking about 60s for reading and inverting on one core) – Mi Ka Apr 20 '21 at 15:30
  • If it does not mention multi-threading, it probably does not support it. Eigen does not magically add multi-threading to it either. – chtz Apr 20 '21 at 15:32
  • User’s Guide for SuiteSparseQR, a multifrontalmultithreaded sparse QR factorization package (withoptional GPU acceleration) --> here is the documentation i read. It supports both TBB multithreading for column pivoting and benefits from mkl blas parallelization for matrix-vector multiplications as i understood – Mi Ka Apr 20 '21 at 15:34

0 Answers0