sfepy/sfepy — Issue #72: petsc (parallel) solvers
Author: rc
Created: 2012-01-30 10:25:26+00:00
State: open

Lisandro Dalcin has sent us a nice example of solving a sparse system with
a scipy.sparse matrix by petsc4py - let's interface petsc solvers.

Migrated from http://code.google.com/p/sfepy/issues/detail?id=68

earlier comments

ondrej.certik said, at 2008-12-08T15:57:35.000Z:

Could you please point me to that example?

robert.cimrman said, at 2008-12-09T08:41:08.000Z:

The example is attached now.

robert.cimrman said, at 2009-01-15T10:39:42.000Z:

Finally, I have interfaced the PETSc Krylov solvers thanks to petsc4py (git commit
650b562). Check out the solution time below, obtained by
tests/test_linear_solvers.py. The PETSc conjugate gradient solver + incomplete
Cholesky preconditioner rock for the Laplacian!

It remains to try it for larger/more complex problems (to be done as the problems
arrive), and make sfepy parallel. This is going to be another issue, though. So let's
close this one.

equations = {
'Temperature' : """dw_laplace.i1.Omega( coef.val, s, t ) = 0"""
}
... matrix size: (9511, 9511)
... nnz: 132239
... solution times (rezidual norms):
... 0.17 [s] (2.428e-12) : ls120 ls.petsc cg icc
... 0.35 [s] (3.301e-12) : ls110 ls.scipy_iterative cg
... 0.51 [s] (6.537e-12) : ls111 ls.scipy_iterative bicgstab
... 1.01 [s] (3.571e-12) : ls112 ls.scipy_iterative qmr
... 3.77 [s] (2.718e-12) : ls101 ls.pyamg ruge_stuben_solver
... 4.36 [s] (1.760e-12) : ls102 ls.pyamg smoothed_aggregation_solver
... 6.00 [s] (4.870e-15) : dls100 ls.umfpack

ondrej.certik said, at 2009-01-15T21:06:10.000Z:

Great job!

So petsc is 2x faster than scipy? So why umfpack totally sucks on this particular
problem?

robert.cimrman said, at 2009-01-16T11:26:44.000Z:

IMHO it's a very simple problem - the conjugate gradients cannot be beaten for the
Laplacian by a direct solver. Anyway, the scipy's CG is not preconditioned, while the
PETSc CG is (by incomplete Cholesky). Otherwise I would say they would perform
similarly for such a small and simple problem.

To conclude - do not use umfpack for Poisson-like problems on simple geometries as CG
is the winner in such a case. For other problems we have now quite a bunch of solvers
to try out and see which one performs the best - I would bet on PETSc Krylov solvers
with a proper preconditioning might outperform umfpack for other problems besides the
Poisson one too.

dalcinl said, at 2009-01-19T00:11:16.000Z:

For large Poisson-like problems, let say more than 50/500k unknowns, you could try
algebraic multigrid methods from Trillinos/ML and HYPRE BoomerAMG. This requires
PETSc to be built with such packages (basically, pass --with-ml=1 --download-ml=1
and/or --with-hypre=1 --download-hypre=1).

In my (really short) experience with Trillinos/ML and HYPRE BoomerAMG, the fist one
(ML)is faster to set-up but slower for solving; while the second (BoomerAMG) is the
other way around, i.e., slower to set-up but faster for solving. So the choice could
be done depending on the problems being transient or not (provided that the code
reuses the matrices and solvers structures).

naveedattut said, at 2009-06-02T23:13:23.000Z:

Hi every one,
I have a school project in which I'm require to use hypre library. I went through
user manual and reference for hypre, but couldn't get much of those. Kindly any one
there who has used Hypre. I'm dealing with solution of linear problems of form Ax =
b. A and b are spares matrices. I have few question, I'll be very much grateful for
answers.
1 - What is the best way to read in the data files.
2 - what other matrix format Hypre can easily support.
3 - I want to use Hypre PCG, what could be an optimal number of iterations.
I'm looking forward for any kind of help.
Best Regards.
Nesh

ondrej.certik said, at 2009-06-03T01:23:04.000Z:

Hi, please send your email to the list, not to the issues.

robert.cimrman said, at 2009-06-03T08:05:28.000Z:

Also, we do not use Hypre in SfePy yet; it is a good library to support, though. BTW.
to join/post to our mailing list, go to the main page http://code.google.com/p/sfepy/
and click on sfepy-devel. You need a google account to log in.