User Tools

Site Tools


howto:compiling_python_2_7_3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
howto:compiling_python_2_7_3 [2012/09/17 15:16]
adymond [Scipy, minimal install]
howto:compiling_python_2_7_3 [2012/09/19 17:52]
adymond [NumPy and SciPy]
Line 273: Line 273:
        ​Processing LAPACK Testing output found in the TESTING ​ direcory        ​Processing LAPACK Testing output found in the TESTING ​ direcory
   SUMMARY  ​      nb test run numerical error other error  ​   SUMMARY  ​      nb test run numerical error other error  ​
-  REAL   ​1077227 0 (0.000%) 0 ​  ​(0.000%) +  REAL         ​1077227 0 (0.000%) 0 ​  ​(0.000%)
   DOUBLE PRECISION 1078039 0 (0.000%) 0 ​  ​(0.000%)    DOUBLE PRECISION 1078039 0 (0.000%) 0 ​  ​(0.000%)
-  COMPLEX 522814 0 (0.000%) 0 ​  ​(0.000%) +  COMPLEX                 ​522814 0 (0.000%) 0 ​  ​(0.000%)
   COMPLEX16 552410 0 (0.000%) 0 ​  ​(0.000%)    COMPLEX16 552410 0 (0.000%) 0 ​  ​(0.000%)
   --> ALL PRECISIONS 3230490 0 (0.000%) 0 ​  ​(0.000%)   --> ALL PRECISIONS 3230490 0 (0.000%) 0 ​  ​(0.000%)
Line 281: Line 281:
 if all went well if all went well
   $ cp -iv lib* $HOME/​local/​lib64   $ cp -iv lib* $HOME/​local/​lib64
 +  ​
 +To convert the built static libraries to dynamic libraries, the following bash
 +loop is used
 +  $ for LIB in *.a ; do
 +      DIR=${LIB}_contents
 +      SOLIB=${LIB%.*}.so
 +      echo $SOLIB
 +      mkdir $DIR
 +      cd $DIR
 +      ar -x ../$LIB
 +      cd -
 +      gfortran -shared -Wl,​-soname=$SOLIB -o $SOLIB ${DIR}/*.o
 +    done;
 +  $ ln -snf librefblas.so libblas.so
 +
 +Copy the shared object or dynamic libraries to your library folder
 +  $ cp -iv lib*.so $HOME/​local/​lib64
 +[warning dynamic libaries not fully tested]
   ​   ​
 === Numpy building, testing and installation === === Numpy building, testing and installation ===
Line 289: Line 307:
   $ tar -xf numpy-1.6.2.tar.gz   $ tar -xf numpy-1.6.2.tar.gz
   $ cd numpy-1.6.2   $ cd numpy-1.6.2
-  ​+ 
 +== build using shared object libraries == 
 +  $ echo "​[DEFAULT]"​ > site.cfg 
 +  $ echo "​library_dirs = $HOME/​local/​lib64"​ >> site.cfg 
 +  $ echo "​include_dirs = $HOME/​local/​include" ​ >> site.cfg 
 +  $ python setup.py build --fcompiler=gnu95 
 +  $ python setup.py install 
 + 
 + 
 +== build using static lapack and blas libraries (for interests sake only) == 
 Set blas and lapack paths Set blas and lapack paths
   $ export ATLAS=None   $ export ATLAS=None
   $ export BLAS=$HOME/​local/​lib64/​librefblas.a   $ export BLAS=$HOME/​local/​lib64/​librefblas.a
   $ export LAPACK=$HOME/​local/​lib64/​liblapack.a   $ export LAPACK=$HOME/​local/​lib64/​liblapack.a
- 
 Build and install Build and install
   $ python setup.py build --fcompiler=gnu95   $ python setup.py build --fcompiler=gnu95
-  $ python setup.py install 
  
-Then test it (note this requires nose+NB to build without lapack and blas libraries, do the following 
-  $ cd ~+  $ export ATLAS=None 
 +  $ export BLAS=None 
 +  $ export LAPACK=None 
 +then build 
 + 
 +speed difference: using LAPACK and BLAS libraries numpy testing takes between 
 +10 and 12s, without the libraries numpy.test() ​takes exactly the same amount 
 +of time? 
 + 
 +== testing == 
 +  $ mkdir -p /​tmp/​$USER/​numpy-1.6.2_testing 
 +  $ python setup.py install --prefix=/​tmp/​$USER/​numpy-1.6.2_testing
   $ ipython   $ ipython
-  ​$ import ​numpy +    ​$ import ​os, sys 
-  $ numpy.test() +    $ sys.path.insert(0,'/​tmp/​%s/​numpy-1.6.2_testing/​lib/​python2.7/​site-packages' ​ % os.environ['​USER'​]) 
-  ​+    $ import numpy 
 +    ​$ numpy.test() 
 +If all the test were passed, rm the testing directory and install numpy 
 +  ​$ rm -r /​tmp/​$USER/​numpy-1.6.2_testing 
 +  $ python setup.py install 
    
 === Scipy, minimal install === === Scipy, minimal install ===
/var/www/wiki/data/pages/howto/compiling_python_2_7_3.txt · Last modified: 2012/09/19 18:09 by adymond