[SciPy-user] scipy, f2py and ifort on intel mac

George Nurser agn at noc.soton.ac.uk
Tue Jan 16 17:10:22 CST 2007


I managed to get f2py to work with ifort on a MBP C2D by following  
the hint in  Pearu Petersen's post in
http://comments.gmane.org/gmane.comp.python.f2py.user/778
  & included

         if sys.platform=='darwin':
	    opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])

in  /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/numpy/distutils/fcompiler/intel.py


In intel.py I also replaced -KPIC by -fPIC as recommended by the  
ifort manual, and removed -shared from the linker_so dictionary list,  
as the manual indicated it's not a valid option.
after that e.g.
f2py --fcompiler=intel -c Wright.f -m Wright
produced a module that imported fine into numpy.


Emboldened by this I had a go at compiling scipy using ifort, with

python setup.py build config_fc --fcompiler=intel

This did *not* work ...
It made blas.so successfully, but the compiler fortcom went into an  
infinite loop when trying to compile lapack.so. The last output (I  
also then changed -O3 to -O2 in case it helped) was:

build/src.macosx-10.3-fat-2.4/build/src.macosx-10.3-fat-2.4/scipy/ 
linalg/flapackmodule.c:11799: warning: passing argument 6 of  
'f2py_func' from incompatible pointer type
compiling Fortran sources
Fortran f77 compiler: /usr/bin/ifort -72 -w90 -w95 -fPIC -cm -O2
Fortran f90 compiler: /usr/bin/ifort -FR -fPIC -cm -O2
Fortran fix compiler: /usr/bin/ifort -FI -fPIC -cm -O2
compile options: '-Ibuild/src.macosx-10.3-fat-2.4 -I/Library/ 
Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ 
numpy/core/include -I/Library/Frameworks/Python.framework/Versions/ 
2.4/include/python2.4 -c'
ifort:f77: build/src.macosx-10.3-fat-2.4/build/src.macosx-10.3- 
fat-2.4/scipy/linalg/flapack-f2pywrappers.f
/usr/bin/ifort -nofor_main -undefined dynamic_lookup -bundle build/ 
temp.macosx-10.3-fat-2.4/build/src.macosx-10.3-fat-2.4/build/ 
src.macosx-10.3-fat-2.4/scipy/linalg/flapackmodule.o build/ 
temp.macosx-10.3-fat-2.4/build/src.macosx-10.3-fat-2.4/ 
fortranobject.o build/temp.macosx-10.3-fat-2.4/build/src.macosx-10.3- 
fat-2.4/build/src.macosx-10.3-fat-2.4/scipy/linalg/flapack- 
f2pywrappers.o -Lbuild/temp.macosx-10.3-fat-2.4 -o build/ 
lib.macosx-10.3-fat-2.4/scipy/linalg/flapack.so -Wl,-framework - 
Wl,Accelerate

After this output, terminal hung until the compilation job was killed.

Compilation with gfortran
python setup.py build

seemed to work without any problems.

Anybody have any ideas?

--George Nurser.









More information about the SciPy-user mailing list