[Numpy-discussion] building with MKL in windows

Martin Spacek numpy@mspacek.mm...
Thu Apr 19 06:32:08 CDT 2007


Does anyone know the right way to get numpy to build on windows using
Intel's MKL for LAPACK and BLAS libraries, under MSVC7.1?

I just did a whole lot of trial-and-error getting it to build. I
downloaded and installed MKL for windows from
http://www.intel.com/cd/software/products/asmo-na/eng/307757.htm

Here's my ~/.numpy-site.py file:

[mkl]
library_dirs = C:\bin\Intel\MKL\9.0\ia32\lib
mkl_libs = mkl_lapack, mkl_ia32, mkl_c_dll, libguide40
include_dirs = C:\bin\Intel\MKL\9.0\include

Most people would need to replace "C:\bin" with C:\Program Files". I
found that I could specify mkl_c instead of mkl_c_dll, and it would
still build. I found I could also specify libguide instead of libguide40.

Also, I found I had to remove the 2 lines in distutils/system_info.py
that mention pthread, mkl_lapack32, mkl_lapack64 (see attached patch)
since libraries with such names don't seem to exist in the MKL for
windows and were generating linking errors.

This obviously isn't the right thing to do, and I don't know enough to
know how to do it properly, but after running "python setup.py install"
it builds without errors, and seems to work:

  >>> numpy.version.version
'1.0.3.dev3719'
  >>> numpy.test()
    Found 10 tests for numpy.core.defmatrix
    Found 36 tests for numpy.core.ma
    Found 198 tests for numpy.core.multiarray
    Found 59 tests for numpy.core.numeric
    Found 31 tests for numpy.core.numerictypes
    Found 9 tests for numpy.core.records
    Found 5 tests for numpy.core.scalarmath
    Found 13 tests for numpy.core.umath
    Found 4 tests for numpy.ctypeslib
    Found 5 tests for numpy.distutils.misc_util
    Found 1 tests for numpy.fft.fftpack
    Found 3 tests for numpy.fft.helper
    Found 9 tests for numpy.lib.arraysetops
    Found 44 tests for numpy.lib.function_base
    Found 3 tests for numpy.lib.getlimits
    Found 4 tests for numpy.lib.index_tricks
    Found 2 tests for numpy.lib.polynomial
    Found 48 tests for numpy.lib.shape_base
    Found 13 tests for numpy.lib.twodim_base
    Found 42 tests for numpy.lib.type_check
    Found 1 tests for numpy.lib.ufunclike
    Found 32 tests for numpy.linalg
    Found 0 tests for __main__
........................................................................................................................
........................................................................................................................
........................................................................................................................
........................................................................................................................
............................................................................................
----------------------------------------------------------------------
Ran 572 tests in 0.641s

OK
<unittest.TextTestRunner object at 0x0131B8F0>
  >>> numpy.show_config()
lapack_opt_info:
      libraries = ['mkl_lapack', 'mkl_ia32', 'mkl_c_dll', 'libguide40']
      library_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\ia32\\lib']
      define_macros = [('SCIPY_MKL_H', None)]
      include_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\include',
'C:\\bin\\Python24\\include']

blas_opt_info:
      libraries = ['mkl_lapack', 'mkl_ia32', 'mkl_c_dll', 'libguide40']
      library_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\ia32\\lib']
      define_macros = [('SCIPY_MKL_H', None)]
      include_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\include',
'C:\\bin\\Python24\\include']

lapack_mkl_info:
      libraries = ['mkl_lapack', 'mkl_ia32', 'mkl_c_dll', 'libguide40']
      library_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\ia32\\lib']
      define_macros = [('SCIPY_MKL_H', None)]
      include_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\include',
'C:\\bin\\Python24\\include']

blas_mkl_info:
      libraries = ['mkl_lapack', 'mkl_ia32', 'mkl_c_dll', 'libguide40']
      library_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\ia32\\lib']
      define_macros = [('SCIPY_MKL_H', None)]
      include_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\include',
'C:\\bin\\Python24\\include']

mkl_info:
      libraries = ['mkl_lapack', 'mkl_ia32', 'mkl_c_dll', 'libguide40']
      library_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\ia32\\lib']
      define_macros = [('SCIPY_MKL_H', None)]
      include_dirs = ['C:\\bin\\Intel\\MKL\\9.0\\include',
'C:\\bin\\Python24\\include']


Anyone have any comments? Should I add this to the wiki at
Installing_SciPy/Windows? Ideally, what should mkl_libs be set to in the
~/.numpy.site.cfg file? Here's Intel's description of all the files in
the ia32\lib directory:


mkl_c.lib    cdecl interface library
mkl_s.lib   CVF default interface library
mkl_c_dll.lib   cdecl interface library for dynamic library
mkl_s_dll.lib   CVF default interface library for dynamic library
mkl_lapack.lib  LAPACK routines and drivers
mkl_solver.lib  Sparse solver routines
mkl_ia32.lib    Optimized kernels (BLAS, cblas, Sparse BLAS, GMP, FFTs,
      DFTs, VML, VSL, interval arithmetic) for 32-bit applications
libguide40.lib  Interface library for dynamic threading library
libguide.lib    Static threading library


Cheers,

Martin

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mkl_windows.patch
Url: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070419/97742162/attachment.pl 


More information about the Numpy-discussion mailing list