[petsc-users] petsc4py: parallel matrix-vector multiplication

Matthew Knepley knepley at gmail.com
Sun May 6 06:22:04 CDT 2018


On Sun, May 6, 2018 at 4:40 AM, Robert Speck <r.speck at fz-juelich.de> wrote:

> Hi!
>
> I would like to do a matrix-vector multiplication (besides using linear
> solvers and so on) with petsc4py. I took the matrix from this example
> (https://bitbucket.org/petsc/petsc4py/src/master/demo/
> kspsolve/petsc-mat.py)
> and applied it to a PETSc Vector. All works well in serial, but in
> parallel (in particular if ordering becomes relevant) the resulting
> vector looks very different.


You will have to be more specific about "looks different". If you look
inside any of
the solver code, you can see we are just calling MatMult() everywhere.

   Matt



> Using the shell matrix of this example
> (https://bitbucket.org/petsc/petsc4py/src/master/demo/
> poisson2d/poisson2d.py)
> helps, but then I cannot use matrix-based preconditioners for KSP
> directly (right?). I also tried using DMDA for creating vectors and
> matrix and for taking care of their ordering (which seems to be my
> problem here), but that did not help either.
>
> So, my question is this: How do I do easy parallel matrix-vector
> multiplication with petsc4py in a way that allows me to use parallel
> linear solvers etc. later on? I want to deal with spatial decomposition
> as little as possible. What data structures should I use? DMDA or
> PETSc.Vec() and PETSc.Mat() or something else?
>
> Thanks!
> -Robert-
>
> --
> Dr. Robert Speck
> Juelich Supercomputing Centre
> Institute for Advanced Simulation
> Forschungszentrum Juelich GmbH
> 52425 Juelich, Germany
>
> Tel: +49 2461 61 1644
> Fax: +49 2461 61 6656
>
> Email:   r.speck at fz-juelich.de
> Website: http://www.fz-juelich.de/ias/jsc/speck_r
> PinT:    http://www.fz-juelich.de/ias/jsc/pint
>
>
>
> ------------------------------------------------------------
> ------------------------------------
> ------------------------------------------------------------
> ------------------------------------
> Forschungszentrum Juelich GmbH
> 52425 Juelich
> Sitz der Gesellschaft: Juelich
> Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
> Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
> Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
> Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
> Prof. Dr. Sebastian M. Schmidt
> ------------------------------------------------------------
> ------------------------------------
> ------------------------------------------------------------
> ------------------------------------
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180506/54536e36/attachment-0001.html>


More information about the petsc-users mailing list