Intel® Distribution for Python*
Support and discussions for achieving faster Python* applications and core computational packages.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Bug in GESVD ?

Yue__Zhengyuan
Beginner
226 Views

I installed Anaconda 2019.03 release on macOS Mojave 10.14.4, and I tried doing SVD of a very simple matrix:

import numpy as np
import scipy.linalg as LA

mat = np.array([[-1,0], [0,-1-1j]], dtype=complex)
s = LA.svd(mat, full_matrices=False, lapack_driver='gesvd')
print(s)

However, the output is wrong

[1.    1.    ]  # should be [1.41421356 1.        ]

The correct result can be obtained by setting either "compute_uv=False" or " lapack_driver='gesdd' "

Anaconda is now using the SciPy packages with MKL optimization by default. If I remove the default SciPy packages and installed the version that uses OpenBLAS, the problem will gone. The problem seems to be CPU dependent. I want to know if any other people can reproduce this problem.

 

My system information:

OS: macOS 10.14.4 (18E226)
CPU: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz

numpy.__config__.show() result:

mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']
blas_mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']
blas_opt_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']
lapack_mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']
lapack_opt_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']

 

0 Kudos
1 Reply
Oleksandr_P_Intel
226 Views

Hi, 

Thank you for taking the time to bring this issue to our attention.
I was able to reproduce the erroneous behavior, and will pass the report on to the MKL team.
MKL on Linux is producing the expected result. 

Sorry about the inconvenience. 

Sincerely,
Oleksandr

Reply