[petsc-users] petsc4py: PetSc is no longer initialised when calling C Function from Cython

Lisandro Dalcin dalcinl at gmail.com
Thu Oct 20 15:57:52 CDT 2011


On 20 October 2011 17:05, Jeff Wiens <jeffrey.k.wiens at gmail.com> wrote:
>
> The problem seems to be that PetSc is no longer initialised when you
> call a C function. If I initialise PETSc from C, the program works.
> However, if I don't call init() from C, the program won't use the
> python PetSc.

Mmm... I bet you built PETSc with static libraries. There is not
(easy&portable) way to mix petsc4py and other C codes when using
static libraries. Please build PETSc with shared libraries.


> Eventually, I would like
> to Initialise PETSc and construct my PETSc vectors in python and then
> have my C code perform operations on them. Again, this yet another
> test problem.
>

Have you seen the demo/wrap-cython example in petsc4py sources?


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169


More information about the petsc-users mailing list