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

Chris Eldred chris.eldred at gmail.com
Thu Apr 7 13:52:42 CDT 2016


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?

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



More information about the petsc-dev mailing list