[SciPy-dev] Compiling scipy with Intel ifort & MKL

rex rex@nosyntax....
Tue Jun 12 18:50:09 CDT 2007


rex <rex@nosyntax.com> [2007-06-12 15:50]:
> rex <rex@nosyntax.com> [2007-06-12 13:59]:
> > Looking at the scipy build log, it appears that the problem may be in distutils/unixccompiler.py
> > 
> > From my limited (and quite possibly wrong) understanding it appears that
> > unixccompiler.py/ccompiler.py is not finding icc & mkl. None of the
> > strings in ccompiler.py for intel match what icc -V returns:
> > 
> > Intel(R) C Compiler for applications running on IA-32, Version 10.0    Build 20070426 Package ID: l_cc_p_10.0.023
> 
> Continuing the quest, I changed ccompiler.py from:
> 
> compiler_class['intel'] = ('intelccompiler','IntelCCompiler',
>                             "Intel C Compiler for 32-bit applications")
> 
> to
> 
> compiler_class['intel'] = ('intelccompiler','IntelCCompiler',
>                             "Intel(R) C Compiler for applications running on IA-32")
> 
> and rebuilt numpy and then tried to build scipy. This time it found icc
> all the way though, but it lost the ifort it found earlier in the same
> build. :(
> 
> Why did fixing the failure of ccompiler.py to find icc break finding the
> fortran complier late (after ~5000 lines) in the scipy build? 

The new problem is in fcompiler/intel.py and is the same id string
problem that ccompiler.py had. ifort -V returns:

Intel(R) Fortran Compiler for applications running on IA-32, Version 10.0    Build 20070426 Package ID: l_fc_p_10.0.023

I changed 

version_match = intel_version_match('32-bit')

to

version_match = intel_version_match('IA-32')

in fcompiler/intel.py, rebuilt/installed numpy and scipy. This time the
scipy build log shows that icc and ifort were used all the way
through. No gcc, no g77. That's the good news. The bad news is that
there are even more scipy.test() errors.

Here are the results of testing with the build that used ifort and both icc &
gcc. Below that is the test using ifort & icc only.

Python 2.5 (r25:51908, Nov 27 2006, 19:14:46)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> scipy.test()
  Found 7 tests for scipy.cluster.vq
  Found 4 tests for scipy.io.array_import
  Found 28 tests for scipy.io.mio
  Found 12 tests for scipy.io.mmio
  Found 5 tests for scipy.io.npfile
  Found 4 tests for scipy.io.recaster
  Found 16 tests for scipy.lib.blas
  Found 128 tests for scipy.lib.blas.fblas

****************************************************************
WARNING: clapack module is empty
-----------
See scipy/INSTALL.txt for troubleshooting.
Notes:
* If atlas library is not found by numpy/distutils/system_info.py,
  then scipy uses flapack instead of clapack.
****************************************************************

  Found 42 tests for scipy.lib.lapack
  Found 41 tests for scipy.linalg.basic
  Found 14 tests for scipy.linalg.blas
  Found 56 tests for scipy.linalg.decomp
  Found 128 tests for scipy.linalg.fblas
  Found 6 tests for scipy.linalg.iterative
  Found 4 tests for scipy.linalg.lapack
  Found 7 tests for scipy.linalg.matfuncs
Warning: FAILURE importing tests for <module 'scipy.linsolve.umfpack' from '.../linsolve/umfpack/__init__.pyc'>
/usr/local/lib/python2.5/site-packages/scipy/linsolve/_superlu.py:1: ImportError: /usr/local/lib/python2.5/site-packages/scipy/linsolve/_zsuperlu.so: undefined symbol: Destroy_CompCol_Permuted (in <module>)
Warning: FAILURE importing tests for <module 'scipy.linsolve.umfpack.umfpack' from '...y/linsolve/umfpack/umfpack.pyc'>
/usr/local/lib/python2.5/site-packages/scipy/linsolve/_superlu.py:1: ImportError: /usr/local/lib/python2.5/site-packages/scipy/linsolve/_zsuperlu.so: undefined symbol: Destroy_CompCol_Permuted (in <module>)
  Found 399 tests for scipy.ndimage
Warning: FAILURE importing tests for <module 'scipy.optimize.optimize' from '...es/scipy/optimize/optimize.pyc'>
/usr/local/lib/python2.5/site-packages/scipy/optimize/minpack.py:1: ImportError: /usr/local/lib/python2.5/site-packages/scipy/optimize/_minpack.so: undefined symbol: __libm_sse2_log10 (in <module>)
Warning: FAILURE importing tests for <module 'scipy.sparse' from '...ages/scipy/sparse/__init__.pyc'>
/usr/local/lib/python2.5/site-packages/scipy/linsolve/_superlu.py:1: ImportError: /usr/local/lib/python2.5/site-pack
ages/scipy/linsolve/_zsuperlu.so: undefined symbol: Destroy_CompCol_Permuted (in <module>)
Warning: FAILURE importing tests for <module 'scipy.sparse.sparse' from '...ckages/scipy/sparse/sparse.pyc'>
/usr/local/lib/python2.5/site-packages/scipy/linsolve/_superlu.py:1: ImportError: /usr/local/lib/python2.5/site-packages/scipy/linsolve/_zsuperlu.so: undefined symbol: Destroy_CompCol_Permuted (in <module>)
  Found 0 tests for __main__
.......
Don't worry about a warning regarding the number of bytes read.
Warning: 1000000 bytes requested, 20 bytes read.
...E....................................................................caxpy:n=4
..caxpy:n=3
....ccopy:n=4
..ccopy:n=3
.............cscal:n=4
....cswap:n=4
..cswap:n=3
.....daxpy:n=4
..daxpy:n=3
....dcopy:n=4
..dcopy:n=3
.............dscal:n=4
....dswap:n=4
..dswap:n=3
.....saxpy:n=4
..saxpy:n=3
....scopy:n=4
..scopy:n=3
.............sscal:n=4
....sswap:n=4
..sswap:n=3
.....zaxpy:n=4
..zaxpy:n=3
....zcopy:n=4
..zcopy:n=3
.............zscal:n=4
....zswap:n=4
..zswap:n=3
............................FF.......................................................
****************************************************************
WARNING: cblas module is empty
-----------
See scipy/INSTALL.txt for troubleshooting.
Notes:
* If atlas library is not found by numpy/distutils/system_info.py,
  then scipy uses fblas instead of cblas.
****************************************************************

.........................................................................caxpy:n=4
..caxpy:n=3
....ccopy:n=4
..ccopy:n=3
.............cscal:n=4
....cswap:n=4
..cswap:n=3
.....daxpy:n=4
..daxpy:n=3
....dcopy:n=4
..dcopy:n=3
.............dscal:n=4
....dswap:n=4
..dswap:n=3
.....saxpy:n=4
..saxpy:n=3
....scopy:n=4
..scopy:n=3
.............sscal:n=4
....sswap:n=4
..sswap:n=3
.....zaxpy:n=4
..zaxpy:n=3
....zcopy:n=4
..zcopy:n=3
.............zscal:n=4
....zswap:n=4
..zswap:n=3
..||A.x - b|| = 0.463278811259
||A.x - b|| = 0.0904112510459
||A.x - b|| = 0.00904717783342
||A.x - b|| = 0.00142227284819
||A.x - b|| = 0.000200415793499
.||A.x - b|| = 0.0701989794825
||A.x - b|| = 0.00132382823161
.||A.x - b|| = 0.552990362175
||A.x - b|| = 0.0853864153742
||A.x - b|| = 0.00956204753397
||A.x - b|| = 0.0015868128577
||A.x - b|| = 0.000330271905952
.||A.x - b|| = 0.191333515726
||A.x - b|| = 0.00850533932205
||A.x - b|| = 0.000281144795047
..||A.x - b|| = 0.463915921284
||A.x - b|| = 0.049085267646
||A.x - b|| = 0.00809201153244
||A.x - b|| = 0.00101049839284
||A.x - b|| = 5.2625953376e-05
...
****************************************************************
WARNING: clapack module is empty
-----------
See scipy/INSTALL.txt for troubleshooting.
Notes:
* If atlas library is not found by numpy/distutils/system_info.py,
  then scipy uses flapack instead of clapack.
****************************************************************

...Result may be inaccurate, approximate err = 1.3204526861e-08
............................................................................................................./usr/local/lib/python2.5/site-packages/scipy/ndimage/interpolation.py:41: UserWarning: Mode "reflect" may yield incorrect results on boundaries. Please use "mirror" instead.
  warnings.warn('Mode "reflect" may yield incorrect results on '
........................................................................................................................................................................................................................................................................................................
======================================================================
ERROR: check_integer (scipy.io.tests.test_array_import.test_read_array)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/io/tests/test_array_import.py", line 55, in check_integer
    from scipy import stats
  File "/usr/local/lib/python2.5/site-packages/scipy/stats/__init__.py", line 7, in <module>
    from stats import *
  File "/usr/local/lib/python2.5/site-packages/scipy/stats/stats.py", line 191, in <module>
    import scipy.special as special
  File "/usr/local/lib/python2.5/site-packages/scipy/special/__init__.py", line 8, in <module>
    from basic import *
  File "/usr/local/lib/python2.5/site-packages/scipy/special/basic.py", line 8, in <module>
    from _cephes import *
ImportError: /usr/local/lib/python2.5/site-packages/scipy/special/_cephes.so: undefined symbol: __libm_sse2_exp

======================================================================
FAIL: check_syevr (scipy.lib.tests.test_lapack.test_flapack_float)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/lib/lapack/tests/esv_tests.py", line 41, in check_syevr
    assert_array_almost_equal(w,exact_w)
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 230, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 215, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 33.3333333333%)
 x: array([-0.66992444,  0.48769468,  9.18222618], dtype=float32)
 y: array([-0.66992434,  0.48769389,  9.18223045])

======================================================================
FAIL: check_syevr_irange (scipy.lib.tests.test_lapack.test_flapack_float)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/lib/lapack/tests/esv_tests.py", line 66, in check_syevr_irange
    assert_array_almost_equal(w,exact_w[rslice])
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 230, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 215, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 33.3333333333%)
 x: array([-0.66992444,  0.48769468,  9.18222618], dtype=float32)
 y: array([-0.66992434,  0.48769389,  9.18223045])

----------------------------------------------------------------------
Ran 901 tests in 1.148s

FAILED (failures=2, errors=1)
<unittest.TextTestRunner object at 0xb6563fec>


This test is from the build using ifort & icc only:

Python 2.5 (r25:51908, Nov 27 2006, 19:14:46)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> scipy.test()
== Error while importing _vq, not testing C imp of vq ==
  Found 7 tests for scipy.cluster.vq
  Found 4 tests for scipy.io.array_import
Warning: FAILURE importing tests for <module 'scipy.io.mio' from '...site-packages/scipy/io/mio.pyc'>
/usr/local/lib/python2.5/site-packages/scipy/sparse/sparsetools.py:7: ImportError: /usr/local/lib/python2.5/site-packages/scipy/sparse/_sparsetools.so: undefined symbol: _Znwj (in <module>)
  Found 12 tests for scipy.io.mmio
  Found 5 tests for scipy.io.npfile
  Found 4 tests for scipy.io.recaster
  Found 16 tests for scipy.lib.blas
  Found 128 tests for scipy.lib.blas.fblas

****************************************************************
WARNING: clapack module is empty
-----------
See scipy/INSTALL.txt for troubleshooting.
Notes:
* If atlas library is not found by numpy/distutils/system_info.py,
  then scipy uses flapack instead of clapack.
****************************************************************

  Found 42 tests for scipy.lib.lapack
  Found 41 tests for scipy.linalg.basic
  Found 14 tests for scipy.linalg.blas
  Found 56 tests for scipy.linalg.decomp
  Found 128 tests for scipy.linalg.fblas
  Found 6 tests for scipy.linalg.iterative
  Found 4 tests for scipy.linalg.lapack
  Found 7 tests for scipy.linalg.matfuncs
  Found 399 tests for scipy.ndimage
  Found 5 tests for scipy.odr
Warning: FAILURE importing tests for <module 'scipy.optimize.optimize' from '...es/scipy/optimize/optimize.pyc'>
/usr/local/lib/python2.5/site-packages/scipy/optimize/zeros.py:3: ImportError: /usr/local/lib/python2.5/site-packages/scipy/optimize/_zeros.so: undefined symbol: bisect (in <module>)
  Found 0 tests for __main__
......== not testing C imp of vq ==
.
Don't worry about a warning regarding the number of bytes read.
Warning: 1000000 bytes requested, 20 bytes read.
...E...........E............................caxpy:n=4
..caxpy:n=3
....ccopy:n=4
..ccopy:n=3
.............cscal:n=4
....cswap:n=4
..cswap:n=3
.....daxpy:n=4
..daxpy:n=3
....dcopy:n=4
..dcopy:n=3
.............dscal:n=4
....dswap:n=4
..dswap:n=3
.....saxpy:n=4
..saxpy:n=3
....scopy:n=4
..scopy:n=3
.............sscal:n=4
....sswap:n=4
..sswap:n=3
.....zaxpy:n=4
..zaxpy:n=3
....zcopy:n=4
..zcopy:n=3
.............zscal:n=4
....zswap:n=4
..zswap:n=3
............................FF.......................................................
****************************************************************
WARNING: cblas module is empty
-----------
See scipy/INSTALL.txt for troubleshooting.
Notes:
* If atlas library is not found by numpy/distutils/system_info.py,
  then scipy uses fblas instead of cblas.
****************************************************************

.........................................................................caxpy:n=4
..caxpy:n=3
....ccopy:n=4
..ccopy:n=3
.............cscal:n=4
....cswap:n=4
..cswap:n=3
.....daxpy:n=4
..daxpy:n=3
....dcopy:n=4
..dcopy:n=3
.............dscal:n=4
....dswap:n=4
..dswap:n=3
.....saxpy:n=4
..saxpy:n=3
....scopy:n=4
..scopy:n=3
.............sscal:n=4
....sswap:n=4
..sswap:n=3
.....zaxpy:n=4
..zaxpy:n=3
....zcopy:n=4
..zcopy:n=3
.............zscal:n=4
....zswap:n=4
..zswap:n=3
..||A.x - b|| = 0.437138305526
||A.x - b|| = 0.0940049148864
||A.x - b|| = 0.0127517922701
||A.x - b|| = 0.00137250351767
||A.x - b|| = 8.29603014309e-05
.||A.x - b|| = 0.241701590498
||A.x - b|| = 0.00268371042198
||A.x - b|| = 2.2608852184e-05
.||A.x - b|| = 0.607549390567
||A.x - b|| = 0.0919587464263
||A.x - b|| = 0.00695201688476
||A.x - b|| = 0.00078087385892
||A.x - b|| = 8.82341930263e-05
.||A.x - b|| = 0.241040719387
||A.x - b|| = 0.00981032340491
||A.x - b|| = 0.000285396218674
..||A.x - b|| = 0.438468906597
||A.x - b|| = 0.048365422497
||A.x - b|| = 0.00538985122199
||A.x - b|| = 0.000653170894647
||A.x - b|| = 9.11645602545e-05
...
****************************************************************
WARNING: clapack module is empty
-----------
See scipy/INSTALL.txt for troubleshooting.
Notes:
* If atlas library is not found by numpy/distutils/system_info.py,
  then scipy uses flapack instead of clapack.
****************************************************************

...Result may be inaccurate, approximate err = 1.3204526861e-08
............................................................................................................./usr/local/lib/python2.5/site-packages/scipy/ndimage/interpolation.py:41: UserWarning: Mode "reflect" may yield incorrect results on boundaries. Please use "mirror" instead.
  warnings.warn('Mode "reflect" may yield incorrect results on '
..........................................................................................................................................................................................................................................................................................................FFF
======================================================================
ERROR: check_integer (scipy.io.tests.test_array_import.test_read_array)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/io/tests/test_array_import.py", line 55, in check_integer
    from scipy import stats
  File "/usr/local/lib/python2.5/site-packages/scipy/stats/__init__.py", line 7, in <module>
    from stats import *
  File "/usr/local/lib/python2.5/site-packages/scipy/stats/stats.py", line 191, in <module>
    import scipy.special as special
  File "/usr/local/lib/python2.5/site-packages/scipy/special/__init__.py", line 8, in <module>
    from basic import *
  File "/usr/local/lib/python2.5/site-packages/scipy/special/basic.py", line 8, in <module>
    from _cephes import *
ImportError: /usr/local/lib/python2.5/site-packages/scipy/special/_cephes.so: undefined symbol: NAN

======================================================================
ERROR: check_simple_todense (scipy.io.tests.test_mmio.test_mmio_coordinate)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/io/tests/test_mmio.py", line 151, in check_simple_todense
    b = mmread(fn).todense()
AttributeError: 'numpy.ndarray' object has no attribute 'todense'

======================================================================
FAIL: check_syevr (scipy.lib.tests.test_lapack.test_flapack_float)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/lib/lapack/tests/esv_tests.py", line 41, in check_syevr
    assert_array_almost_equal(w,exact_w)
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 230, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 215, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 33.3333333333%)
 x: array([-0.66992444,  0.48769468,  9.18222618], dtype=float32)
 y: array([-0.66992434,  0.48769389,  9.18223045])

======================================================================
FAIL: check_syevr_irange (scipy.lib.tests.test_lapack.test_flapack_float)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/lib/lapack/tests/esv_tests.py", line 66, in check_syevr_irange
    assert_array_almost_equal(w,exact_w[rslice])
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 230, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 215, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 33.3333333333%)
 x: array([-0.66992444,  0.48769468,  9.18222618], dtype=float32)
 y: array([-0.66992434,  0.48769389,  9.18223045])

======================================================================
FAIL: test_lorentz (scipy.tests.test_odr.test_odr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/odr/tests/test_odr.py", line 295, in test_lorentz
    3.7798193600109009e+00]),
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 230, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 215, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([  1.00000000e+03,   1.00000000e-01,   3.80000000e+00])
 y: array([  1.43067808e+03,   1.33905090e-01,   3.77981936e+00])

======================================================================
FAIL: test_multi (scipy.tests.test_odr.test_odr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/odr/tests/test_odr.py", line 191, in test_multi
    0.5101147161764654,  0.5173902330489161]),
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 230, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 215, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([ 4. ,  2. ,  7. ,  0.4,  0.5])
 y: array([ 4.37998803,  2.43330576,  8.00288459,  0.51011472,  0.51739023])

======================================================================
FAIL: test_pearson (scipy.tests.test_odr.test_odr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/scipy/odr/tests/test_odr.py", line 238, in test_pearson
    np.array([ 5.4767400299231674, -0.4796082367610305]),
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 230, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/usr/local/lib/python2.5/site-packages/numpy/testing/utils.py", line 215, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([ 1.,  1.])
 y: array([ 5.47674003, -0.47960824])

----------------------------------------------------------------------
Ran 878 tests in 1.500s

FAILED (failures=5, errors=2)
<unittest.TextTestRunner object at 0xb54a08ac>

I think I've gone as far as I can. I'll leave it the the respective (and
respected) experts to clean up my quick hack-fixes to 4 distutils bugs
properly, and to sort out the errors in scipy.test(). Of course I'll be
happy to provide more detailed scipy.test() results.

Now that I have a (sort-of) working scipy using icc 10.0, ifort 10.0 and
mkl 9.1, I'd like to benchmark it to see how much speed payoff all this
work has. Any suggestions? Results from a Core 2 Duo using a gcc build
would save me building blas, lapack, numpy & scipy with gcc to do a
comparison. 

Thanks,

-rex
 


More information about the Scipy-dev mailing list