[petsc-users] Simultaneous use petsc4py and fortran/petsc-based python module

Austin Herrema aherrema at iastate.edu
Wed Apr 5 15:05:13 CDT 2017


When I was having this issue, I was using Homebrew-based PETSc. After
switching to my using my own build, I no longer have the issues described
above.

Thanks again,
Austin

On Tue, Apr 4, 2017 at 1:30 PM, Gaetan Kenway <gaetank at gmail.com> wrote:

> There shouldn't be any additional issue with the petsc4py wrapper. We do
> this all the time. In fact, it's generally best to use the petsc4py to do
> the initialization of petsc at the very top of your highest level python
> script. You'll need to do this anyway if you want to use command line
> arguments to change the petsc arch.
> Again, its probably some 4/8 byte issue or maybe a real/complex issue that
> is caused by the petsc4py import initializing something different from what
> you expect.
>
> Gaetan
>
> On Tue, Apr 4, 2017 at 11:24 AM, Austin Herrema <aherrema at iastate.edu>
> wrote:
>
>> Hello all,
>>
>> Another question in a fairly long line of questions from me. Thank you to
>> this community for all the help I've gotten.
>>
>> I have a Fortran/PETSc-based code that, with the help of f2py and some of
>> you, I have compiled into a python module (we'll call it pc_fort_mod). So I
>> can now successfully execute my code with
>>
>> import pc_fort_mod
>> pc_fort_mod.execute()
>>
>> I am now hoping to use this analysis module in a large optimization
>> problem being solved with OpenMDAO <http://openmdao.org/>. OpenMDAO also
>> makes use of PETSc/petsc4py, which, unsurprisingly, does not play well with
>> my PETSc-based module. So doing
>>
>> from petsc4py import PETSc
>> import pc_fort_mod
>> pc_fort_mod.execute()
>>
>> causes the pc_fort_mod execution to fail (in particular, preallocation
>> fails with an exit code of 63, "input argument out of range." I assume the
>> matrix is invalid or something along those lines).
>>
>> So my question is, is there any way to make this work? Or is this pretty
>> much out of the realm of what should be possible at this point?
>>
>> Thank you,
>> Austin
>>
>>
>> --
>> *Austin Herrema*
>> PhD Student | Graduate Research Assistant | Iowa State University
>> Wind Energy Science, Engineering, and Policy | Mechanical Engineering
>>
>
>


-- 
*Austin Herrema*
PhD Student | Graduate Research Assistant | Iowa State University
Wind Energy Science, Engineering, and Policy | Mechanical Engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170405/c6e0fe4e/attachment.html>


More information about the petsc-users mailing list