Skip to content

scikit-learn 0.21.x not linking MKL BLAS #14096

@h6197627

Description

@h6197627

While building scikit-learn from sources with MKL BLAS support it is not linking to MKL libraries. Such behavior started from 0.21.0 release (0.21.2 checked also).

user@pc:~/scikit-learn-0.21.0/build$ egrep -ir 'mkl_rt'
(empty)

user@pc:~/scikit-learn-0.20.3/build/lib.linux-x86_64-3.6$ egrep -ir 'mkl_rt'
Binary file sklearn/cluster/_k_means.cpython-36m-x86_64-linux-gnu.so matches
Binary file sklearn/metrics/pairwise_fast.cpython-36m-x86_64-linux-gnu.so matches
Binary file sklearn/utils/weight_vector.cpython-36m-x86_64-linux-gnu.so matches
Binary file sklearn/utils/arrayfuncs.cpython-36m-x86_64-linux-gnu.so matches
Binary file sklearn/svm/liblinear.cpython-36m-x86_64-linux-gnu.so matches
Binary file sklearn/linear_model/cd_fast.cpython-36m-x86_64-linux-gnu.so matches

Checking with ldd confirms that libraries are not linked to mkl_rt. However both reports in the beginning of building process:

FOUND:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/opt/intel/mkl/lib/intel64']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/opt/intel/mkl/include']

FOUND:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/opt/intel/mkl/lib/intel64']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/opt/intel/mkl/include']

sklearn.show_versions() for both builds return MKL as BLAS:

System:
python: 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]
executable: /usr/bin/python3
machine: Linux-4.15.0-51-generic-x86_64-with-Ubuntu-18.04-bionic
BLAS:
macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
lib_dirs: /opt/intel/mkl/lib/intel64
cblas_libs: mkl_rt, pthread
Python deps:
pip: 19.1.1
setuptools: 41.0.1
sklearn: 0.21.2
numpy: 1.16.4
scipy: 1.3.0
Cython: 0.29.10
pandas: None

System:
python: 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]
executable: /usr/bin/python3
machine: Linux-4.15.0-51-generic-x86_64-with-Ubuntu-18.04-bionic
BLAS:
macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
lib_dirs: /opt/intel/mkl/lib/intel64
cblas_libs: mkl_rt, pthread
Python deps:
pip: 19.1.1
setuptools: 41.0.1
sklearn: 0.20.3
numpy: 1.16.4
scipy: 1.3.0
Cython: 0.29.10
pandas: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    EasyWell-defined and straightforward way to resolve

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions