[Numpy-discussion] numpy with icc

rex rex at nosyntax.com
Sun May 18 15:14:38 EDT 2008


David wrote:
> I have not tried with icc, but the following works for me with the
> last mkl (I have only tried numpy).
>
> [mkl]
> library_dirs = /home/david/intel/mkl/10.0.1.014/lib/32
> lapack_libs = mkl_lapack
> mkl_libs = mkl, guide
>
> (of course, adapt the library_dirs accordingly). All test pass. I have
> updated the site.cfg.example in numpy. But really, if Intel keeps
> changing its library names, there is not much we can do.

The last relevant MKL library name change I'm aware of occurred
when MKL 9.X was released in 2006:

"mkl_lapackXX.so" was changed to "mkl_lapack.so" in all 3
cases. And, since the material below shows mkl_lapack need not be
in site.cfg, the name change should not matter.


I tried your (locally adapted) site.cfg with no changes to
distutils.


/usr/local/src/1.1.0rc1/site.cfg:
-----------------------------------------------------
[mkl]
library_dirs = /opt/intel/mkl/mkl/10.0.3.020/lib/32
lapack_libs = mkl_lapack
mkl_libs = mkl, guide
-----------------------------------------------------

Build command:

python setup.py config --compiler=intel build_clib \
 --compiler=intel build_ext --compiler=intel install \
 --prefix=/usr/local> build3            

#less build3
----------------------------------------------------
F2PY Version 2_5188
blas_opt_info:
blas_mkl_info:
  FOUND:
    libraries = ['mkl', 'guide', 'pthread']
    library_dirs = ['/opt/intel/mkl/10.0.3.020/lib/32']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/usr/local/include', '/usr/include']

  FOUND:
    libraries = ['mkl', 'guide', 'pthread']
    library_dirs = ['/opt/intel/mkl/10.0.3.020/lib/32']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/usr/local/include', '/usr/include']

lapack_opt_info:
lapack_mkl_info:
mkl_info:
  FOUND:
    libraries = ['mkl', 'guide', 'pthread']
    library_dirs = ['/opt/intel/mkl/10.0.3.020/lib/32']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/usr/local/include', '/usr/include']

  FOUND:
    libraries = ['mkl_lapack', 'mkl', 'guide', 'pthread']
    library_dirs = ['/opt/intel/mkl/10.0.3.020/lib/32']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/usr/local/include', '/usr/include']

  FOUND:
    libraries = ['mkl_lapack', 'mkl', 'guide', 'pthread']
    library_dirs = ['/opt/intel/mkl/10.0.3.020/lib/32']
    define_macros = [('SCIPY_MKL_H', None)]

[...]

copying site.cfg -> /usr/local/lib/python2.5/site-packages/numpy/distutils/
copying build/src.linux-i686-2.5/numpy/core/numpyconfig.h -> /usr/local/lib/python2.5/site-packages/numpy/core/include/numpy
copying build/src.linux-i686-2.5/numpy/core/__multiarray_api.h -> /usr/local/lib/python2.5/site-packages/numpy/core/include/numpy
copying build/src.linux-i686-2.5/numpy/core/multiarray_api.txt -> /usr/local/lib/python2.5/site-packages/numpy/core/include/numpy
copying build/src.linux-i686-2.5/numpy/core/__ufunc_api.h -> /usr/local/lib/python2.5/site-packages/numpy/core/include/numpy
copying build/src.linux-i686-2.5/numpy/core/ufunc_api.txt -> /usr/local/lib/python2.5/site-packages/numpy/core/include/numpy
running install_egg_info
-------------------------------------------------------------

ldd shows MKL was linked:

# ldd /usr/local/lib/python2.5/site-packages/numpy/linalg/lapack_lite.so
        linux-gate.so.1 =>  (0xffffe000)
        libmkl_lapack.so => /opt/intel/mkl/10.0.3.020/lib/32/libmkl_lapack.so (0xb7ae1000)
        /opt/intel/mkl/10.0.3.020/lib/32/libmkl_intel.so (0xb79a3000)
        /opt/intel/mkl/10.0.3.020/lib/32/libmkl_intel_thread.so (0xb77a6000)
        /opt/intel/mkl/10.0.3.020/lib/32/libmkl_core.so (0xb7742000)
        libguide.so => /opt/intel/cc/10.1.015/lib/libguide.so (0xb76e0000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb76b4000)
        libimf.so => /opt/intel/cc/10.1.015/lib/libimf.so (0xb7484000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb745f000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7454000)
        libintlc.so.5 => /opt/intel/cc/10.1.015/lib/libintlc.so.5 (0xb7411000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb72e0000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb72db000)
        /lib/ld-linux.so.2 (0x80000000)

Interestingly, the above shows libmkl_lapack.so is being used even
though it is not in the site.cfg. Apparently, mkl and guide are
sufficient in site.cfg.  


$ python
Python 2.5 (release25-maint, Dec  9 2006, 14:35:53)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.test()
Numpy is installed in /usr/local/lib/python2.5/site-packages/numpy
Numpy version 1.1.0rc1
Python version 2.5 (release25-maint, Dec  9 2006, 14:35:53) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)]
  Found 18/18 tests for numpy.core.defmatrix
  Found 3/3 tests for numpy.core.memmap
  Found 283/283 tests for numpy.core.multiarray
  Found 70/70 tests for numpy.core.numeric
  Found 36/36 tests for numpy.core.numerictypes
  Found 12/12 tests for numpy.core.records
  Found 7/7 tests for numpy.core.scalarmath
  Found 16/16 tests for numpy.core.umath
  Found 5/5 tests for numpy.ctypeslib
  Found 5/5 tests for numpy.distutils.misc_util
  Found 2/2 tests for numpy.fft.fftpack
  Found 3/3 tests for numpy.fft.helper
  Found 24/24 tests for numpy.lib._datasource
  Found 10/10 tests for numpy.lib.arraysetops
  Found 1/1 tests for numpy.lib.financial
  Found 0/0 tests for numpy.lib.format
  Found 53/53 tests for numpy.lib.function_base
  Found 5/5 tests for numpy.lib.getlimits
  Found 6/6 tests for numpy.lib.index_tricks
  Found 15/15 tests for numpy.lib.io
  Found 1/1 tests for numpy.lib.machar
  Found 4/4 tests for numpy.lib.polynomial
  Found 49/49 tests for numpy.lib.shape_base
  Found 15/15 tests for numpy.lib.twodim_base
  Found 43/43 tests for numpy.lib.type_check
  Found 1/1 tests for numpy.lib.ufunclike
  Found 89/89 tests for numpy.linalg
  Found 94/94 tests for numpy.ma.core
  Found 15/15 tests for numpy.ma.extras
  Found 7/7 tests for numpy.random
  Found 16/16 tests for numpy.testing.utils
  Found 0/0 tests for __main__
MKL FATAL ERROR: /opt/intel/mkl/10.0.3.020/lib/32/: cannot read file data: Is a directory

To test for an interaction between icc and MKL, I built with gcc (after
removing the 1.1.0rc1/build directory):

# python setup.py config  build_clib  build_ext install \
 --prefix=/usr/local > build4

$ python
Python 2.5 (release25-maint, Dec  9 2006, 14:35:53)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.test()
Numpy is installed in /usr/local/lib/python2.5/site-packages/numpy
Numpy version 1.1.0rc1
Python version 2.5 (release25-maint, Dec  9 2006, 14:35:53) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)]
  Found 18/18 tests for numpy.core.defmatrix
  Found 3/3 tests for numpy.core.memmap
  Found 283/283 tests for numpy.core.multiarray
  Found 70/70 tests for numpy.core.numeric
  Found 36/36 tests for numpy.core.numerictypes
  Found 12/12 tests for numpy.core.records
  Found 7/7 tests for numpy.core.scalarmath
  Found 16/16 tests for numpy.core.umath
  Found 5/5 tests for numpy.ctypeslib
  Found 5/5 tests for numpy.distutils.misc_util
  Found 2/2 tests for numpy.fft.fftpack
  Found 3/3 tests for numpy.fft.helper
  Found 24/24 tests for numpy.lib._datasource
  Found 10/10 tests for numpy.lib.arraysetops
  Found 1/1 tests for numpy.lib.financial
  Found 0/0 tests for numpy.lib.format
  Found 53/53 tests for numpy.lib.function_base
  Found 5/5 tests for numpy.lib.getlimits
  Found 6/6 tests for numpy.lib.index_tricks
  Found 15/15 tests for numpy.lib.io
  Found 1/1 tests for numpy.lib.machar
  Found 4/4 tests for numpy.lib.polynomial
  Found 49/49 tests for numpy.lib.shape_base
  Found 15/15 tests for numpy.lib.twodim_base
  Found 43/43 tests for numpy.lib.type_check
  Found 1/1 tests for numpy.lib.ufunclike
  Found 89/89 tests for numpy.linalg
  Found 94/94 tests for numpy.ma.core
  Found 15/15 tests for numpy.ma.extras
  Found 7/7 tests for numpy.random
  Found 16/16 tests for numpy.testing.utils
  Found 0/0 tests for __main__
MKL FATAL ERROR: /opt/intel/mkl/10.0.3.020/lib/32/: cannot read file data: Is a directory

So why do Erik and I get failures (with both gcc & icc) when MKL
is used and you don't?





More information about the NumPy-Discussion mailing list