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
6
votes
0 answers

setuptools, numpy.distutils.core, install_requires, and f2py extension

I've been working on creating a python package that contains some fortran code which I'd like to incorporate using f2py in numpy. The goal is to upload it to PyPI so that users can install using pip. I've done some research and figured out that…
user1969231
6
votes
2 answers

f2py with Intel Fortran compiler

I am trying to use f2py to interface my python programs with my Fortran modules. I am on a Win7 platform. I use latest Anaconda 64 (1.7) as a Python+NumPy stack. My Fortran compiler is the latest Intel Fortran compiler 64 (version 14.0.0.103 Build…
Tesla
  • 61
  • 1
  • 2
6
votes
4 answers

Why is univariate Horner in Fortran faster than NumPy counterpart while bivariate Horner is not

I want to perform polynomial calculus in Python. The polynomial package in numpy is not fast enough for me. Therefore I decided to rewrite several functions in Fortran and use f2py to create shared libraries which are easily imported into Python.…
Aeronaelius
  • 1,291
  • 3
  • 12
  • 31
6
votes
1 answer

Translate F2PY compile steps into setup.py

I've inherited a Fortran 77 code which implements several subroutines which are run through a program block which requires a significant amount of user-input via an interactive command prompt every time the program is run. Since I'd like to…
6
votes
1 answer

Issues when using f2py module in python code

I have a FORTRAN code that required the following compile command gfortran -c interp.f -ffixed-format -ffix-line-length-none I compiled the same using f2py module in python from numpy import…
Andy Stow Away
  • 649
  • 1
  • 8
  • 17
6
votes
1 answer

f2py array valued functions

Do recent versions of f2py support wrapping array-valued fortran functions? In some ancient documentation this wasn't supported. How about it now? Let's for example save the following function as func.f95. function func(x) implicit none …
Tentresh
  • 159
  • 1
  • 7
5
votes
1 answer

can I make shared library using gfortran?

I would like to make so file in order to use it in python. how can I make shared library from fortran source? I have tested like below code. gfortran -c mod.f90 #gfortran -c sub1.f90 gfortran -c func.f90 gfortran -shared -fPIC -o func.so func.f90…
wonjun
  • 311
  • 2
  • 10
5
votes
0 answers

Fortran elemental functions in python using f2py

I have the following minimal Fortran example that I would like to convert using f2py: Fortran module utils_test.f90: module utils_test contains elemental real(8) function prod(a, b) real(8), intent(in) :: a, b prod = a*b end…
user10957988
5
votes
0 answers

f2py and MPI Pool: Child processes continue when parent job is deleted on cluster

I am running a 30-core Python job on a cluster using MPIPool. When I delete the job through the ubiquitous qdel command, only the parent is killed, while the child processes continue to run. In other words: qdel makes the job-ID disappear…
5
votes
1 answer

Difficulty getting OpenMP to work with f2py

I am working on some simulation work for my research and have run into a snag importing fortran into my python scripts. As background, I have worked with Python for some years now, and have only toyed around inside of Fortran when the need arose. I…
Rylkan Tiwaz
  • 51
  • 1
  • 4
5
votes
2 answers

Can I use F2PY on a subroutine with subroutine calls?

Using F2PY as a wrapper, is it possible to use subroutines with subroutine calls? And if so, how? In case I am unclear, I mean like this: SUBROUTINE average(a, b, out) real a, b, out cf2py intent(in) a, b cf2py intent(out) out call…
5
votes
0 answers

Using f2py with windows x64 and Intel Fortran

I'm trying to achieve in using f2py on windows 8, x64, with Intel Fortran Compiler. I've tried two things : 1) install via windows 64x installer. http://www.lfd.uci.edu/~gohlke/pythonlibs/ NumPy is correctly installed, but no compiler found when…
5
votes
0 answers

Correct way to pass fortran OpenMP flags using numpy distutils?

I'm developing a python package which makes use of fortran 90 code with OpenMP directives and I'd like to package it using numpy.distutils. The problem I'm having is that both the compiler flags and the OpenMP libraries are different for different…
user1969231
5
votes
3 answers

Passing numpy string-format arrays to fortran using f2py

My aim is to print the 2nd string from a python numpy array in fortran, but I only ever get the first character printed, and it's not necessarily the right string either. Can anyone tell me what the correct way to pass full string arrays to…
Gerhard
  • 1,925
  • 3
  • 15
  • 24
5
votes
1 answer

How to expose Python callbacks to Fortran using modules

This scipy documentation page about F2Py states: [Callback functions] may also be explicitly set in the module. Then it is not necessary to pass the function in the argument list to the Fortran function. This may be desired if the Fortran…
JimmidyJoo
  • 10,503
  • 7
  • 27
  • 30
1 2
3
32 33