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

Wrong results and crashes from Fortran subroutine with OpenMP

I wrote the following code, and then tried using OpenMP to parallelise it. However, after I compiled the following OpenMP code using f2py, Python always generates certain errors when I run it. There are no error messages, only that the numbers are a…
Febday
  • 45
  • 5
0
votes
0 answers

f2py fails to run - error in CompaqVisualFCompiler, with no compaq compiler installed

I'm trying to use f2py (under anaconda 2, windows 7 64bit, python 2.7.13) but I run into the following error repeatedly, even when simply trying to list available compilers: (C:\Users\UserName\Anaconda2) C:\Users\UserName\Desktop\fortran>f2py -c…
llama
  • 185
  • 1
  • 9
0
votes
0 answers

f2py intel compiler blas

I am on windows machine I am trying to compile a fortran subroutine that has call out to some blas function. I have not seen any examples of how to compile the module using Windows and intel compiler with mkl. Any pointers on where to start will be…
Leon Adams
  • 491
  • 4
  • 10
0
votes
2 answers

f2py: command not found

Mac OS Sierra. In terminal, while trying to execute a .sh file that involves a Python script with Fortran portions, I got this message: lenscov-master Roger$ ./run_covariances.sh recompile rm *.o *.so rm: *.so: No such file or directory make:…
Rethliopuks
  • 125
  • 6
0
votes
0 answers

f2py import issue when multiple Fortran modules are used

I need to run an existing model which includes multiple Fortran files and a Python file. To run the Python file, I am trying to transform Fotran codes to Python modules using f2py. I got no issues on simpler Fortran files but in in a case where…
Kadir
  • 23
  • 1
  • 5
0
votes
2 answers

F2py with Openmp gives import error in Python

I am able to compile the minimal working example below in Fortran which uses Openmp and run to give the expected result (prints 1). subroutine test use omp_lib write(*,*) omp_get_num_threads() end subroutine However using this in python with f2py…
Chris
  • 37
  • 7
0
votes
1 answer

Python Import error for f2py modules compiled with OpenMP

I'm currently experiencing an issue in wrapping some Fortran subroutines for use in a python3 script. This issue has only come up since I have attempted to use OpenMP in the subroutines. For example, if I compile a module 'test.pyd' using f2py -c…
0
votes
1 answer

Optimize fortran code that is running slower than the its python version

I have a Fortran code that I'm compiling with f2py to run in python. I wrote this code to be a faster approach to a python code that already existed, but it's actually running slower than its python counterpart, which makes me think that it isn't…
TomCho
  • 3,204
  • 6
  • 32
  • 83
0
votes
1 answer

Can't compile subroutine with array output with f2py

I have a subroutine that I'm writing in Fortran to be compiled with f2py and the compilation is failing. I won't post the full subroutine here but a MWE is: SUBROUTINE mwe(Vars, nxc, nyc, vCorr) IMPLICIT NONE real(kind=8), dimension(:,:,:,:) ::…
TomCho
  • 3,204
  • 6
  • 32
  • 83
0
votes
0 answers

Unable to use f2py to link large PETSc/SLEPc Fortran code

I am attempting to use f2py to create a python module for my Fortran code that uses both PETSc and SLEPc (this question is very closely related to this post, but the discussion there was unable to solve my problem--see comments at bottom of this…
aherrema
  • 77
  • 7
0
votes
2 answers

f2py - automatic multithreading?

I am currently working on a Python code and to gain some speed I used f2py to port some existing Fortran code. Everything works well and the speedup is amazing. However, I found that the code seems to run on multiple threads now (according to htop),…
rammelmueller
  • 1,092
  • 1
  • 14
  • 29
0
votes
1 answer

f2py won't compile with negative indexes for vector parameter

Say I have a module to be compiled via f2py: test.f90 module test implicit none integer, parameter :: q = 2 real(8), parameter, dimension(-q:q) :: vec = (/ 1, 2, 3, 4, 5 /) contains subroutine writevec() write(*,*) vec end subroutine end…
Matt Hancock
  • 3,870
  • 4
  • 30
  • 44
0
votes
0 answers

f2py change 'compiler instance properties' for Intel iFort compiler

I've been trying to interface an example fortran code with python using f2py. f2py detects all installed fortran compilers & can be checked with the command f2py -c --help-fcompiler. The output of this shows the following default compiler…
0
votes
0 answers

F2py in Anaconda causes "Failed with exit status 1112"

I am trying to use F2py to run a Fortran code in Python, however I am not an expert in Python. I am using Python version 3.5.1 and Anaconda 4.0.0 Every single F2py tutorial says that one should execute for example: f2py -c -m fib3 fib3.f to…
Patrick Machado
  • 61
  • 1
  • 11
0
votes
4 answers

How to execute `f2py`?

How can I wrap in the f2py module? I mean, I am reading a few tutorials that say I should execute f2py FIB1.f -m FIB2 -h FIB1.pyf However, I don't know where I have to execute that, for sure not in spyder or I am doing something wrong. Why? Because…
Patrick Machado
  • 61
  • 1
  • 11