[firedrake] Calling PETSc within PyOP2 kernels
Justin Chang
jychang48 at gmail.com
Thu Nov 12 09:22:11 GMT 2015
Hi Lawrence,
So I had a nice working code where it runs point-wise SNES in pyop2, and it
ran decently fast. However, with the latest firedrake update, it forced me
to make a few additional changes to the pyop2 kernel, namely adding
PetcInitialize(....) and PetscFinalize(), and my code now runs really slow
after I run it after several time steps on a Unit Interval of 100 elements.
Attached is the code as well as the supplemental 1D analytical expressions
and pyop2 reactions kernel. Run the code as "python 1D_OS_analytical_ex1.py
100 0 0".
If I comment out line 250 in the 1D_OS_analytical.ex1.py file, the program
performs well, w.r.t. wall-clock time that I normally get, but now it has
become a serious bottleneck. Is there a way to improve what I have written
in the reactions kernel?
Thanks,
Justin
On Tue, Nov 3, 2015 at 5:01 AM, Lawrence Mitchell <
lawrence.mitchell at imperial.ac.uk> wrote:
>
> > On 3 Nov 2015, at 11:56, Lawrence Mitchell <
> lawrence.mitchell at imperial.ac.uk> wrote:
> >
> > Hi Justin,
> >
> >> On 3 Nov 2015, at 06:59, Justin Chang <jychang48 at gmail.com> wrote:
> >>
> >> Lawrence,
> >>
> >> So I have implemented PETSc into the PYOP2 kernel, but I am sometimes
> getting strange errors.
> >>
> >> Attached is the working code plus the reactions kernel file.
> >>
> >> Run the code by typing "python 1D_analytical_ADR_ex1.py <seed> <0/1>
> <0/1>". The last option is for using either Newtons Method (0) or
> Variational Inequality (1).
> >
>
> I note as well that if I remove the bad par_loop code and run with PETSc
> in debug mode, I get the following error (running with options 5 1 1):
>
> Time = 0.010000
> Traceback (most recent call last):
> File "1D_analytical_ADR_ex1.py", line 187, in <module>
> u0 = ADsolve(solver_D,u0)
> File "1D_analytical_ADR_ex1.py", line 171, in ADsolve
> solver_O.solve(u0_O,b)
> File
> "/Users/lmitche1/Documents/work/mapdes/firedrake/firedrake/linear_solver.py",
> line 138, in solve
> self.ksp.solve(rhs, solution)
> File "PETSc/KSP.pyx", line 363, in petsc4py.PETSc.KSP.solve
> (src/petsc4py.PETSc.c:152597)
> petsc4py.PETSc.Error: error code 77
> [0] KSPSolve() line 527 in
> /Users/lmitche1/Documents/work/mapdes/petsc/src/ksp/ksp/interface/itfunc.c
> [0] KSPSetUp() line 332 in
> /Users/lmitche1/Documents/work/mapdes/petsc/src/ksp/ksp/interface/itfunc.c
> [0] PCSetUp() line 984 in
> /Users/lmitche1/Documents/work/mapdes/petsc/src/ksp/pc/interface/precon.c
> [0] PCSetUp_GAMG() line 566 in
> /Users/lmitche1/Documents/work/mapdes/petsc/src/ksp/pc/impls/gamg/gamg.c
> [0] PCGAMGCoarsen_AGG() line 997 in
> /Users/lmitche1/Documents/work/mapdes/petsc/src/ksp/pc/impls/gamg/agg.c
> [0] smoothAggs() line 353 in
> /Users/lmitche1/Documents/work/mapdes/petsc/src/ksp/pc/impls/gamg/agg.c
> [0] Petsc has generated inconsistent data
> [0] !(matA_1 && !matA_1->compressedrow.use)
> ***[0]PCReset_GAMG this should not happen, cleaned up in SetUp
>
>
>
> Lawrence
>
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
>
>
-------------- next part --------------
HTML attachment scrubbed and removed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1D_expressions.py
Type: text/x-python-script
Size: 6947 bytes
Desc: not available
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20151112/fed4c730/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1D_OS_analytical_ex1.py
Type: text/x-python-script
Size: 8986 bytes
Desc: not available
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20151112/fed4c730/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reactions3_kernel.py
Type: text/x-python-script
Size: 3326 bytes
Desc: not available
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20151112/fed4c730/attachment-0002.bin>
More information about the firedrake
mailing list