[petsc-dev] Correct syntax for DMDA ownership ranges in petsc4py

Matthew Knepley knepley at gmail.com
Thu Apr 7 14:00:38 CDT 2016


On Thu, Apr 7, 2016 at 1:52 PM, Chris Eldred <chris.eldred at gmail.com> wrote:

> Hey All,
>
> (I sent this to petsc-users a few days ago and didn't get any replies,
> figured I would try here as well...)
>
> Does anyone know the correct syntax for setting ownership ranges for
> DMDAs in petsc4py? For example, if I have a 1D DMDA with 20 vertices
> and 3 processes, and I want to distribute the vertices as [8,8,4],
> should the correct create call be:
>
> da =
> PETSc.DMDA().create(dim=1,dof=1,sizes=[20,],proc_sizes=[3,],boundary_type=[PETSc.DM.BoundaryType.PERIODIC,],
> stencil_type= PETSc.DMDA.StencilType.BOX,
> stencil_width=1,ownership_ranges=[8,8,4])
>
> or
>
> da =
> PETSc.DMDA().create(dim=1,dof=1,sizes=[20,],proc_sizes=[3,],boundary_type=[PETSc.DM.BoundaryType.PERIODIC,],
> stencil_type= PETSc.DMDA.StencilType.BOX,
> stencil_width=1,ownership_ranges=[[8,8,4],])
>
> For me, the 1st version fails with
> ValueError: number of dimensions 1 and number ownership ranges 3
> (which I expected)
> but the 2nd version also fails with
> TypeError: Expected tuple, got list
>
> I have tried using tuples instead of lists and nothing changes.
> Creating without the ownership_ranges argument works fine as well. Is
> there something else I am missing?
>

Here is the code:


https://bitbucket.org/petsc/petsc4py/src/b234a50085607b793fce93d5dc46307c0d9b57c4/src/PETSc/petscdmda.pxi?at=master&fileviewer=file-view-default#petscdmda.pxi-150

I do not understand why the 1st version fails.

   Matt


> Thanks in advance for any assistance!
>
> Regards,
> -Chris
>
>
> --
> Chris Eldred
> Postdoctoral Fellow, LAGA, University of Paris 13
> PhD, Atmospheric Science, Colorado State University, 2015
> DOE Computational Science Graduate Fellow (Alumni)
> B.S. Applied Computational Physics, Carnegie Mellon University, 2009
> chris.eldred at gmail.com
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160407/2d93c79a/attachment.html>


More information about the petsc-dev mailing list