Questions tagged [f2py]

F2PY is a tool that provides an interface between the Python and Fortran programming languages.

F2PY is a tool that provides an interface between the and programming languages. F2PY is part of .

491 questions
0
votes
1 answer

f2py is not able to link with NetCDF library -

I am trying install some Python modules in my system using f2py, which are related to an ocean model (in Fortran 90). I am facing some problems with f2py. To be specific, the f2py is unable to link with the NetCDF library even though I have the…
0
votes
1 answer

f2py recovering variables from Fortran module

My endgame is to have take a number of different Fortran scripts that I've written and interface them via Python. The scripts themselves are relatively straightforward: essentially, just a lot of math without any programming structures more…
Marius
  • 115
  • 5
0
votes
0 answers

Compile fortran's files to python libraries using Makefile

Currently I am compiling my python libraries using manually the f2py3 command such as fp2py3 -c -m xxx_yyy_lib xxx_yyy_lib_fortran.f. Do you have any idea if I can compile automatically all my files using a Makefile? I have tried to used the…
Guuk
  • 505
  • 3
  • 17
0
votes
1 answer

Memory usage doubled when passing matrix to shared object

I have a linear set of equations, where A x = b and A is a large matrix and b is known as well. The matrix A is set up with python. Now I want to invert matrix A to get x. A and b are passed to a Fortran 90 program via a shared object. I compiled…
RoSt
  • 51
  • 1
  • 7
0
votes
2 answers

How do I use the avx flag when compiling Fortran code using f2py?

In doing some performance testing in Python, I compared the timing for different methods to calculate the Euclidean distance between an array of coordinates. I found my Fortran code compiled with F2PY to be roughly 4x slower than the C…
Steven C. Howell
  • 16,902
  • 15
  • 72
  • 97
0
votes
1 answer

Using f2py on a Fortran code linked to PETSc

My question is related to this post: Including a compiled module in module that is wrapped with f2py (Minimum working example)? in which the poster was trying to compile a Fortran code (Test.f90) with f2py and link that to a pre-compiled library…
costoich
  • 11
  • 2
0
votes
1 answer

Error using the F2PY tool of NumPy

I have been trying out the F2PY tool of NumPy, which enables interfacing between Python and Fortran. I have been getting results with F2PY which are contrary to the documentation (https://docs.scipy.org/doc/numpy-dev/f2py/). Specifically, running…
Rob M
  • 11
  • 2
0
votes
1 answer

Compiling f90 function that returns array using f2py

I have a subroutine that calculates a large array and writes it to a file. I'm trying to transform that into a function that returns that array. However, I'm getting a very weird error which seems to be connected to the fact that I am returning an…
TomCho
  • 3,204
  • 6
  • 32
  • 83
0
votes
1 answer

f2py Fortran function interfaces compiling error

f2py gives an error when I try compile FORTRAN subroutine, from which I call another FORTRAN function passing array to it. I simplified code to leave the problem only. SUBROUTINE MAS (matrix, a) IMPLICIT NONE INTERFACE LOGICAL…
Alexey_AM
  • 31
  • 5
0
votes
0 answers

Can't compile with f2py and pythonxy since update to Windows 10

Since I updated to Windows 10 and a clean install of Python xy on my 64Bit Windows 10 machine, I cannot compile f2py modules anymore. F2py finds the gfortran compiler and apparently mingw32, but all efforts end up in errors and eventually ends up in…
Benjamin Mewes
  • 89
  • 2
  • 10
0
votes
0 answers

Link shared library in f2py

I have a Fortran shared library specified by: C FILE: OTHER.F SUBROUTINE OTHER(FUN) EXTERNAL FUN INTEGER I DO I=0,5 PRINT *, FUN(I) ENDDO END SUBROUTINE C END OF FILE OTHER.F Which I compiled as…
astabada
  • 1,029
  • 4
  • 13
  • 26
0
votes
0 answers

ubuntu14.04 error when importing a module converted by f2py

I am using Ubuntu 14.04. I converted Fortran subroutine to a python module using f2py via numpy, and when I imported it in python2.7, I got an error message, undefined_symbol: __svml_cos4 when I imported it in python3, I got undefined_symbol:…
hsingtzu
  • 1
  • 2
0
votes
1 answer

Using external data files in f2py

I have some old fortran code that I am wrapping and importing to python using f2py. The fortran code relies on a data file that resides in the same directory. If I start python in that directory, everything works fine. However, if I import this…
John Smith
  • 1,059
  • 1
  • 13
  • 35
0
votes
2 answers

F2PY cannot find intel fortran compiler on windows 7

I am struggling to get F2PY working with Intel Fortran on Windows 7. This appears to be a common issue and I have attempted a number of suggestions found in other posts (described below). A bit of information about my system: Windows 7 64-bit …
Mack Shippen
  • 81
  • 2
  • 9
0
votes
0 answers

f2py fails at compiling fortran subroutines

I cannot get f2py to successfully compile any fortran code into a python module. I run the procedure outlined in http://docs.scipy.org/doc/numpy-dev/f2py/getting-started.html, using the following fotran file: C FILE: FIB3.F SUBROUTINE…
Ben Boe
  • 1
  • 1