python interface to PETSC

Lisandro Dalcin dalcinl at
Thu Oct 30 18:07:50 CDT 2008

Nichols, If you do not have problems about being in the bledding edge,
you should try to use the all-new implementations of petsc4py and
slepc4py (for this later, I still have to clone the repo in the MCS
server, but that is just a minute).

The only real problem you could have with all this is related to
documentation. But as many other uses of petsc4py do, you can contact
me at any time at Gmail, even by chat :-)

If you decide to give a try, just mail me privately, and I'll give you
a few instructions.

On Thu, Oct 30, 2008 at 7:59 PM, Matthew Knepley <knepley at> wrote:
> On Thu, Oct 30, 2008 at 5:34 PM, Nichols A. Romero
> <naromero at> wrote:
>> Hi,
>> I am post-doc in LCF working on scaling a real-space DFT code called GPAW.
>> This code is a mixture of Python and C.
>> The PETSC webpage states that there is now a Python interface but I could
>> not find a lot of documentation about it in the manual. I did download the
>> PETSC tarball and see that there is a python directory.
> The PETSc Python interface is maintained by Lisandro Dalcin. You can have it
> automatically downloaded by configuring with --with-petsc4py. It has bindings
> for all functions. I am not sure if there is a manual, but he reads this list.
>> Right now the GPAW uses NumPy for basic array manipulation, element-wise
>> dot products, and other simple manipulation. The time consuming part of
>> the GPAW is spent in the solution of a sparse eigenvalue problem.
>> H*Psi=lambda*S*Psi
> You probably want SLEPc, which also has slepc4py. They use Numpy as well.
> I think it would not be hard to formulate your problem for SLEPc. You can
> use a MatShell object for your H*Psi product, and I believe use a Python
> function for it with Lisandro's awesome wrappers.
>   Matt
>> The Hamiltonian matrix (H) is not stored at all, only H*Psi products are
>> computed (Psi are the eigenvectors). It would seem like PETSc could be
>> helpful for solving this problem.
>> Is there a python interface to all the PETSc functions?
>> Nichols A. Romero, Ph.D.
>> Argonne Leadership Computing Facility
>> Argonne National Laboratory
>> Building 360 Room L-146
>> 9700 South Cass Avenue
>> Argonne, IL 60490
>> (630) 252-3441
> --
> 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

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-users mailing list