Python Hacks : f2py in detail for Python 2 and Python 3

preview_player
Показать описание
In this video, I am explaining how to use f2py module in Python. f2py is a module for making a shared object file from fortran modules/files. These shared object files are importable inside python as modules. They work with the same speed as that of fortran.

Рекомендации по теме
Комментарии
Автор

It's important to note that while passing arrays to fortran subroutines, the arguments should be passed is a particular order i.e. first we should pass numpy arrays and then the array sizes. This is irrespective of the order you have given in the subroutine definition.
If I define matmul1(var1, var2, array1.array2), still I should pass it as (in python) >>> matmul1.matmul1(arraiy1, array2, var1, var2). The order of array1 and array2 will be maintained and also var1 and var2. But the arrays should be passed first in the defined order. In this tutorial he did by default passed arrays first, so it worked!

jammiashok
Автор

Hey,
compile with (gfortran, python2.7): f2py -c matmul1.f90 -m matmul1 --opt='Ofast'
(or 'O3') to optimize the fortran module more aggressively. That way you get a faster module.

gerni-
Автор

Hi Arun, i tried to run f2py in my Arch with python3.6, it is not available to me!!! but default f2py for python2 is installed but it only wants fixed-format fortran!!!, after certain browsing i slightly came to know that f2py is no longer supported is that true?
i searched through repos for f2py3 it was also no use... could u plz help me?

RamKumar-toip
Автор

could you show us how to install this properly please

StephenRoseDuo
Автор

is the path to f2py executable or Simply type 'which f2py'.

nimishdwarakanath
Автор

Hi there,
Cheers and thanks for the video.

pablomunozfuentes
join shbcf.ru