F2PY and PGF90

Dear all,
I am developing a F90 application using several other libraries (such as FFTW) and aimed at being interfaced with a Python software via f2py.
In terms of compilation, no worries : everything goes just fine. However, when using it, the whole software returns regularly NaNs instead of the values it’s supposed to calculate.
I tried to call the routines I developed from a F90 standard program and everything works just fine. I therefore assume that the problem comes from the Python interface.
I read on this forum some related messages proposing a change in dlopen behaviour ; it actually worked, but when increasing the size of my variables, it started again to yield NaN.
Now, my question is : has someone ever met such a puzzling issue? And if so what did you do to correct it? I would be really glad to get some input.

FYI I use the PGF90 v8.0 on a Linux RedHat 5 box and a Python 2.2 interpreter.
Thanks to all for reading.

Hi everyone,
any input? This issue is really puzzling… and quite a pain!
I can post more details about the programs if needed. It’s just I don’t know how relevant this would be regarding the problem we encounter with this software.

All the best and happy new year to all.


Hi Pierre-François,

I don’t know this code myself, but will look into it and see what I can find.

  • Mat

Hi Pierre-François,

Ok, I’ve got f2py installed on my system and am able to run some basic tests. It looks to me that it’s simply a wrapper that allow you to hook your Fortran application into a python interface.

Personally, I first make sure your application works outside of Python. If you can recreate the behavior in native Fortran it should be a lot easier to debug.

If your application works outside of f2py, then I would contact the f2py mailing list ( http://cens.ioc.ee/projects/f2py2e/#mailing-list) since it would then more likely be a problem with f2py then the Fortran code.

Hope this helps,

Hi Mat,
First off, thank you very much for your help. I indeed tried to use the application outside of Python. And it actually worked pretty well. Therefore, as you propose, I will give a try to the f2py mailing list.
In any ways, I will post the answers I get if any.
Best regards,

Hi Mat, hi all,
Well I finally found out the issue wasn’t coming from f2py at all (although the software’s behaviour is quite different from one time to another when wrapping with f2py).
After a thorough (though unfinished) debugging process, I found that FFTW libraries might cause my “NaN” issue. I however still need to further investigate this. If anyone has some experience with interfacing FFTW libs with F90, I am looking for an input here (again).