[petsc-users] MatShell & PCShell

Klaij, Christiaan C.Klaij at marin.nl
Fri Jun 25 01:39:52 CDT 2010


I thought the spirit of ex15f was to only specify global dimensions and let PETSc take care of the partitioning at runtime. So I was expecting

call MatCreateShell(PETSC_COMM_WORLD,PETSC_DECIDE,PETSC_DECIDE, m*n,m*n,PETSC_NULL_INTEGER,AA,ierr)

which is illegal. But thanks to your explanation I understand why. Of course it's much beter to check what PETSc decided and use it for my own MatMult. Thanks for clearing this up!

Chris


Date: Thu, 24 Jun 2010 13:00:54 +0200
From: Jed Brown <jed at 59A2.org>
Subject: Re: [petsc-users] MatShell & PCShell
To: "Klaij\, Christiaan" <C.Klaij at marin.nl>,
        "petsc-users\@mcs.anl.gov" <petsc-users at mcs.anl.gov>
Message-ID: <87vd98pue1.fsf at 59A2.org>
Content-Type: text/plain; charset=us-ascii

On Thu, 24 Jun 2010 08:08:37 +0000, "Klaij, Christiaan" <C.Klaij at marin.nl> wrote:
> Thanks!  I modified ex15f so that it uses a new MatShell AA with
> associated multiplication Ax. Only problem is that MatCreateShell
> expects the local matrix dimensions which is somewhat contrary to the
> spirit of ex15f, but at least I got it working for one proc.

How is this contrary to the spirit?  It needs to be determined for
compatibility with the vector you will multiply against.  Perhaps it
should determine this automatically, but it's easy to provide, and
allows PETSc to check for this compatibility before calling your
function.  If it was determined automatically, then you would have to
check what PETSc decided so you can set up your internal data structures
(which you usually need in your implementation of MatMult)
appropriately.  I think it's more common to create these structures
first, then call MatCreateShell, in which case you know the local sizes.

Jed


dr. ir.ChristiaanKlaij
CFD Researcher
Research & Development
E mailto:C.Klaij at marin.nl
T +31 317 49 33 44M

MARIN
2, Haagsteeg, P.O. Box 28, 6700 AA Wageningen, The Netherlands
T +31 317 49 39 11, F +31 317 49 32 45, I www.marin.nl



-----------------------------
[Insert your disclaimer here]
-----------------------------



More information about the petsc-users mailing list