[petsc-users] incredibly good performance of scipy lgmres

Florian Bruckner e0425375 at gmail.com
Wed Dec 9 12:51:03 CST 2020

Dear Pierre,
Yes, you are right. I should have looked at the source-code directly.
Sorry for the stupid question. Nevertheless it is quite misleading that
scipy only reports the number of outer iterations.
I wanted to use PETSc anyway.

thanks for the fast reply and best wishes

On Wed, Dec 9, 2020 at 5:34 PM Pierre Seize <pierre.seize at onera.fr> wrote:

> I think that `callback` is called once for each outer cycle, and the
> default inner number of iterations is 30, so 30 x 5 = 150 iterations, it
> seems more realistic.
> Pierre Seize
> On 09/12/20 17:25, Stefano Zampini wrote:
> Could it be that scipy lgmres is reporting the wrong number of iterations?
> I would try to replicate the scipy code first
> https://github.com/scipy/scipy/blob/master/scipy/sparse/linalg/isolve/lgmres.py
> Il Mer 9 Dic 2020, 19:17 Florian Bruckner <e0425375 at gmail.com> ha scritto:
>> Dear PETSc developers,
>> I am currently re-implementing our FEM-BEM code using Firedrake.
>> The original code we were using is based on FEniCS and uses scipy sparse
>> solvers for the solution of the coupled FEM / BEM system.
>> For some reason the scipy lgmres method seems to outperform all other
>> methods which we tried. E.g. for the strayfield-calculation of a 10x10x10
>> unit cube scipy-lgmres needs 5 iterations (without preconditioner), whereas
>> scipy-gmres needs 167. The new implementation uses petsc-gmres and
>> petsc-lgmres, but both need around 170 iterations.
>> If I understand lgmres correctly it only improves convergence if gmres is
>> restarted. Since it only needs 5 iterations i think this cannot be the
>> reason. But nevertheless since the method seems to perform very good, it
>> would be worth looking at the differences in detail. I provide the dense
>> data of the system-matrix and right-hand-side vector that I used, as well
>> as scripts for the different considered methods.
>> Any ideas how scipy-lgmres could be that good? It would be nice if
>> someone could validate my results (lgmres solves within 5 iterations). For
>> me the next step will be to wrap scipy-lgmres using petsc4py. I know how to
>> do it with petsc4py directly, but I am not exactly sure how it works with
>> the firedrake interface.
>> best wishes
>> Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201209/f1afcfc2/attachment.html>

More information about the petsc-users mailing list