[SciPy-user] f2py and ifort flags...

Pearu Peterson pearu at cens.ioc.ee
Thu May 24 04:58:52 EDT 2007



fred wrote:
> Hi,
> 
> 1) To compile my fortran code, I use the command line:
> ifort call_func.f -limf -Wl,--rpath 
> -Wl,/usr/local/share/intel/fc/9.1.045/lib funcs.o -o call_func_f
> which works fine.
> 
> 2) I want to use the same trick with f2py. So, from f2py manpage, my 
> Makefile looks like:
> IFCVER = 9.1.045
> PATH = /bin:/usr/bin:/usr/local/share/intel/fc/$(IFCVER)/bin
> LD_LIBRARY_PATH_INTEL = /usr/local/share/intel/fc/$(IFCVER)/lib
> LD_LIBRARY_PATH = /usr/local/lib:${LD_LIBRARY_PATH_INTEL}
> LDFLAGS = -limf -Wl,--rpath -Wl,$(LD_LIBRARY_PATH_INTEL)
> OPTIMIZATION = -O3 -xT -ipo
> 
> all: funcs.o calc_KM.so calc_KV.so calc_output.so
> 
> funcs.o: funcs.c
>         gcc -Wall funcs.c -c -o funcs.o
> 
> calc_KM.so: calc_KM.f funcs.o
>         f2py --fcompiler=intel --opt="$(OPTIMIZATION)" 
> --f90flags="$(LDFLAGS)" -c calc_KM.f funcs.o -m calc_KM
> 
> .../...
> 
> but this has no effect, ie intel libs are not linked.
> 
> What am I doing wrong ?

--f90flags are used in compilation of fortran codes, not when
linking. For linking libraries use `-lname` and `-Lpath`
in f2py command line. But note that numpy/distutils/fcompiler/intel.py
should take care of linking intel compiler libraries. If it does not
work for your compiler, try to fix intel.py and send us your changes.

Pearu



More information about the SciPy-User mailing list