[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Python<->C cross-language interoperability
- To: petsc-dev@xxxxxxxxxxx
- Subject: Re: Python<->C cross-language interoperability
- From: "Matthew Knepley" <knepley@xxxxxxxxx>
- Date: Fri, 23 Nov 2007 14:41:45 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=NxKYzsWUzAY/FbNPCP95B8KuPhaWYw8MTzVnMtmvR4o=; b=TSzxJC0ssPXc2M+0nhPtwEu4Ul2fMOrwUIPKDWIfQ+87bPjFvcsDk4vLOqCoT4CtuOuP63kuVuvjsRZwQR2buZ+YG27ze2asT7rrHlRl96SOmCI+TA/IpzBt9N02nfiC2+ihvqoEculk+CVsj6tBJSX0/SSGADIUQE5km0w1rsg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HKarQgDp+0mipGvOrWt91LqybscK3/rl8sdzGrItbqdxYHM2Muyqhug6sJb8nO7nDEaiZ3iKe/I6ELQ1q3XJkjW8c4ysaA2TFKSVQEuSDh2UpxE4J49D0jnVuUvwIBQ3xMIOX8rkBDGdXzUGroKrJ8eH5bVhZWncs0jb9MfFslg=
- In-reply-to: <e7ba66e40711231134q1c6d11b9tfa0f10b0e41f306@mail.gmail.com>
- References: <e7ba66e40711231134q1c6d11b9tfa0f10b0e41f306@mail.gmail.com>
- Reply-to: petsc-dev@xxxxxxxxxxx
- Sender: owner-petsc-dev@xxxxxxxxxxx
On Nov 23, 2007 2:34 PM, Lisandro Dalcin <dalcinl@xxxxxxxxx> wrote:
> I've achieved considerable progress in making petsc4py provide
> cross-language interoperable in the context of PETSc applications.
>
> I've implemented some new types for Mat, KSP, PC, SNES and TS. Those
> new type implementations enables dynamically use a Python class
> implementing some specific interface, and then this
> pure-Python-written class can be used in any PETSc application written
> in C/C++(/Fortran?)
>
> All this is very much like to having 'shell' types, but the language
> for implementing the specific operations is Python.
>
> Additionally, this is so unobtrusive to core PETSc code, than I want
> to ask if it there is any interest in provide a bit more of support in
> PETSc for this. All what would be needed is to make a call to
> Py_Initialize() inside PetscInitialize(), and the a call to
> Py_Finalize() inside PetscFinalize(); and of couse, get PETSc
> libraries linked against Python library.
Yes, we should definitely do this. I think I already have the support for
linking to the Python library somewhere.
> Perhaps I will also ask in the near future for adding two 'slots' in
> the base PetscObject structure for better supporting petsc4py. I
> really need this to correctly manage Python stuff 'composed' inside
> PETSc objects (I currently use PetscContainer's, but I would love to
> have more specific support)
Yes, this is fine too. We should try and do it before the next release
since it will be a major release.
> If any of you want to take a look, I have a trivial C SNES example,
> were I solve a trivial nonlinear problem, but the nonlinear loop is
> implemented by calling many methods of a Python class (you pass at
> command line an option 'pymodule,PyClass' ). Those methods provide
> pre/post-solve/step actions, monitors, convergence test, custom linear
> solve operation, and custom linesearch (by default none, if you want
> one you can to implement it from scratch, as I've not yet taken the
> step of making current PETSc line search's reusable).
Cool, where is it?
Matt
> --
> 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
>
>
--
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