- Thank you received: 108
Interfacing PETSc
4 years 2 months ago - 4 years 2 months ago #3121
by joachim
Interfacing PETSc was created by joachim
Dear NGSolve Users,
The PETSc toolkit provides many powerful parallel solvers, and much more than that.
We have now two possibilities to interface PETSc from NGSolve available:
1. a pure pythonic interface
2. a C++ interface
The first one uses petsc4py Python bindings. The important small step was to make NGSolve compatible with mpi4py communicators. You can find a few elementary tutorials here, more will come soon:
ngsolve.org/docu/nightly/i-tutorials/unit-5a.3-petsc/petsc.html
The second one uses the ngs-petsc C++ library available from here:
github.com/NGSolve/ngs-petsc
It contains many examples from C++, own Python bindings and petsc4py.
We are happy to hear your feedback and see your examples how you use PETSc with NGSolve,
Both approaches need a very recent NGSolve-nightly, or the coming NGSolve 20-08 release.
best, Joachim
The PETSc toolkit provides many powerful parallel solvers, and much more than that.
We have now two possibilities to interface PETSc from NGSolve available:
1. a pure pythonic interface
2. a C++ interface
The first one uses petsc4py Python bindings. The important small step was to make NGSolve compatible with mpi4py communicators. You can find a few elementary tutorials here, more will come soon:
ngsolve.org/docu/nightly/i-tutorials/unit-5a.3-petsc/petsc.html
The second one uses the ngs-petsc C++ library available from here:
github.com/NGSolve/ngs-petsc
It contains many examples from C++, own Python bindings and petsc4py.
We are happy to hear your feedback and see your examples how you use PETSc with NGSolve,
Both approaches need a very recent NGSolve-nightly, or the coming NGSolve 20-08 release.
best, Joachim
Last edit: 4 years 2 months ago by joachim.
- Guosheng Fu
- Offline
- Elite Member
Less
More
- Thank you received: 6
3 years 11 months ago #3387
by Guosheng Fu
Replied by Guosheng Fu on topic Interfacing PETSc
Hello,
I have a question on preconditioning use of petsc. To my knowledge, there are two ways to use petsc solvers:
(1) ship ngsolve matrix to petsc, and use petsc's internal preconditioner to solve
(2) use ngsolve's build-in solver (CGSolver, e.g.), and build (part of) preconditioner using petsc and ship the petsc preconditioner back to ngsolve.
In my previous experence months ago, I found petsc's build-in solver with its build-in preconditioner is slightly faster than ngsolve's solver. Is this to be expected?
My first question is that: can we pass ngsolve (operator) preconditioners (on ngsolve mat), say, an auxiliary low order space preconditioner for a high order operator (where we want to apply petsc preconditioner for coarse space solver) , directly to petsc (on petsc mat)? This seems not possible.
I don't know how to do this, so my second question is: how to implement the PETSc2NGsPrecond operator available in the ngs_petsc adds on, but not yet in the new ngspetsc interface?
The reason to ask the second question is that I noticed, after updating to the newest version of ngsolve, the ngs_petsc adds on seems to be broken.
When I import ngs_petsc, it complains that generic_type: type "VecMap" is already registered!
Best,
Guosheng
I have a question on preconditioning use of petsc. To my knowledge, there are two ways to use petsc solvers:
(1) ship ngsolve matrix to petsc, and use petsc's internal preconditioner to solve
(2) use ngsolve's build-in solver (CGSolver, e.g.), and build (part of) preconditioner using petsc and ship the petsc preconditioner back to ngsolve.
In my previous experence months ago, I found petsc's build-in solver with its build-in preconditioner is slightly faster than ngsolve's solver. Is this to be expected?
My first question is that: can we pass ngsolve (operator) preconditioners (on ngsolve mat), say, an auxiliary low order space preconditioner for a high order operator (where we want to apply petsc preconditioner for coarse space solver) , directly to petsc (on petsc mat)? This seems not possible.
I don't know how to do this, so my second question is: how to implement the PETSc2NGsPrecond operator available in the ngs_petsc adds on, but not yet in the new ngspetsc interface?
The reason to ask the second question is that I noticed, after updating to the newest version of ngsolve, the ngs_petsc adds on seems to be broken.
When I import ngs_petsc, it complains that generic_type: type "VecMap" is already registered!
Best,
Guosheng
- Guosheng Fu
- Offline
- Elite Member
Less
More
- Thank you received: 6
3 years 11 months ago #3388
by Guosheng Fu
Replied by Guosheng Fu on topic Interfacing PETSc
Never mind, the ngs-petsc library is working now...
I mainly use petsc without MPI. I guess ngs-petsc is the way to go for now. :>
I mainly use petsc without MPI. I guess ngs-petsc is the way to go for now. :>
Time to create page: 0.096 seconds