0
votes

I want to compile on a server a module using f2py with the following command :

f2py -c utils.f90 parameters.f90 helmholtz.f90 calc.f90 qgflux.f90 qgstep.f90 interface.f90 -m py_mod

but the f2py command is not available on that server. Hence, I tried to compile my module within python with the following code :

import numpy.f2py
r = numpy.f2py.run_main(['-m','py_mod','utils.f90','parameters.f90','helmholtz.f90','calc.f90','qgflux.f90','qgstep.f90','interface.f90'])

Looks like everything goes fines, at the end I get :

Wrote C/API module "py_mod" to file "./py_modmodule.c" Fortran 90 wrappers are saved to "./py_mod-f2pywrappers2.f90"

Now the command "print(r)" returns :

{'py_mod': {'csrc': ['./py_modmodule.c', '/usr/lib64/python3.6/site-packages/numpy/f2py/src/fortranobject.c'], 'fsrc': ['./py_mod-f2pywrappers2.f90'], 'h': ['/usr/lib64/python3.6/site-packages/numpy/f2py/src/fortranobject.h']}}

But I do not know what to do next to get the module py_mod, can you please help me ?

Regards

1

1 Answers

0
votes

OK, I finally found a solution to my issue. Here is the command I used in bash :

python3.6 -m numpy.f2py -c utils.f90 parameters.f90 helmholtz.f90 calc.f90 qgflux.f90 qgstep.f90 interface.f90 -m py_mod

and it worked fine !