This is a follow-up to my earlier post about building NumPy with Intel compilers and the Intel MKL on CentOS 5. I will now explain how to build SciPy (which requires NumPy).
First, download and unpack the SciPy source tarball. The following command can be used to build SciPy:
LDFLAGS="" FFLAGS="-fPIC -openmp" python2.7 setup.py build --fcompiler=intelem &> build.out
I set the LDFLAGS variable to an empty string to avoid using any LDFLAGS which are defined in my .bashrc. The -fPIC tells the compiler to create position-independent code, although this flag may not be required for newer compilers (ours are quote old: ifort (IFORT) 10.1 20070913 and icc (ICC) 10.1 20070913). I used the -openmp flag to be consistent with the flags I used for building NumPy. The option –fcompiler=intelem forces the Intel Fortran compiler to be used instead of g77. I redirected all output to a file called build.out, which is helpful for finding errors and warnings in the build output.
Once you have built SciPy successfully, install it with the following command:
python2.7 setup.py install --prefix=/apps/Python/Python-2.7.3/
Because I work on a Linux cluster that is shared by many people, I install all Python packages into the /apps directory. Only official RedHat RPMS get installed into standard system paths, maximizing the stability of the cluster. Anyone who wants to use newer versions of tools (like Python 2.7) has to specifically add the correct location to their paths.