[Python-Dev] Compiling Python on Linux with Intel's icc

Alex Leach beamesleach at gmail.com
Fri Mar 2 12:21:46 CET 2012


> Éric Araujo <merwok at netwok.org> wrote:
>
> Could you expand on that?  distutils is supposed to support all
> unix-like C compilers.

Packages that use the numpy distutils can be built with the following 
options:- 

$ python setup.py config --compiler=intelem --fcompiler=intelem build --
compiler=intelem install

This allows distutils to set the appropriate compile flags. Modules built with 
the normal distutils always raise warnings about unsupported flags, 
e.g. -fwrapv.

icc needs to calm down a bit on certain floating point arithmetic 
optimisations, needing some option like '-fp-model strict', as Stefan 
suggested. '-xHost' is a good flag to use too, allowing icc to detect the CPU 
type, and use appropriate optimisations.

The only way I can build modules now is by using environment variables, 
e.g:-

$ CC=icc CXX=icpc LD=xild AR=xiar python setup.py config build build_ext

But this then uses gcc-specific flags when compiling.

Cheers,
Alex


More information about the Python-Dev mailing list