[petsc-users] Data decomposition in PETsc for Poisson solver

Jed Brown jedbrown at mcs.anl.gov
Tue Jun 26 12:42:24 CDT 2012


On Tue, Jun 26, 2012 at 9:37 AM, Michele Rosso <mrosso at uci.edu> wrote:

>  Hi,
>
> I need some help to use the PETSc library inside my Fortran 95 code.
> My goal is to solve a symmetric linear system that derives from the finite
> difference discretization
> of the Poisson equation. I will use the preconditioned conjugate method.
>
> I am mostly interested in how to decompose my data among the different
> processes.
> In particular:
>
> 1) Since my code already implements the 2D-decomposition, would it be best
> to build the matrix with the  DMDA object type, DA object type
>      or the regular Mat type?
>

It is certainly easiest to just use DMDA (and you will get geometric
multigrid for free, which is unbeatable for this problem), but you can work
directly with Mat if you prefer. See src/ksp/ksp/examples/tutorials/ex45f.F
for a Fortran example.


>
> 2) After inserting values into a vector/matrix, PETSc performs any needed
> message passing of nonlocal components, thus the values locally contained
> on a process  may be communicated to another process.  How can I revert
> this at the end of the computation, that is, how can I be sure that the
> local solution vector contains the values associated to the grid nodes
> contained into the hosting process?
>

Please read the section of the user's manual on local versus global spaces
and the structured grid decompositions. If you use DM, there is
DMGlobalToLocalBegin/End that update the ghost points in the local vectors.


>
>
> Thank you,
>
> Michele
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120626/7710877b/attachment.html>


More information about the petsc-users mailing list