Linking against MKL

How do I use this algorithm? What does that parameter do?
Post Reply
aldavero
Posts: 1
Joined: 16 May 2022, 11:23

Linking against MKL

Post by aldavero »

Hello there,

I am trying to link my conda-forge installation against MKL, but with no success. I have installed my environment directly from the environment.yml file at the docs, with mkl and mkl-devel 2022.0.1. However, when running the command

Code: Select all

conda install "libblas=*=*mkl"
i am unable to pin either numpy or tenpy to MKL. It just says that

Code: Select all

# All requested packages already installed.
The tenpy config looks as follows:

Code: Select all

>>> np.show_config()
blas_info:
    libraries = ['cblas', 'blas', 'cblas', 'blas']
    library_dirs = ['/home/juanjo/anaconda3/envs/tenpy-mkl/lib']
    include_dirs = ['/home/juanjo/anaconda3/envs/tenpy-mkl/include']
    language = c
    define_macros = [('HAVE_CBLAS', None)]
blas_opt_info:
    define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)]
    libraries = ['cblas', 'blas', 'cblas', 'blas']
    library_dirs = ['/home/juanjo/anaconda3/envs/tenpy-mkl/lib']
    include_dirs = ['/home/juanjo/anaconda3/envs/tenpy-mkl/include']
    language = c
lapack_info:
    libraries = ['lapack', 'blas', 'lapack', 'blas']
    library_dirs = ['/home/juanjo/anaconda3/envs/tenpy-mkl/lib']
    language = f77
lapack_opt_info:
    libraries = ['lapack', 'blas', 'lapack', 'blas', 'cblas', 'blas', 'cblas', 'blas']
    library_dirs = ['/home/juanjo/anaconda3/envs/tenpy-mkl/lib']
    language = c
    define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)]
    include_dirs = ['/home/juanjo/anaconda3/envs/tenpy-mkl/include']
Supported SIMD extensions in this NumPy install:
    baseline = SSE,SSE2,SSE3
    found = SSSE3,SSE41,POPCNT,SSE42,AVX,F16C,FMA3,AVX2
    not found = AVX512F,AVX512CD,AVX512_KNL,AVX512_KNM,AVX512_SKX,AVX512_CLX,AVX512_CNL,AVX512_ICL
I have also tried to set up an environment with intel Python and in that case I am able to link numpy to MKL. I also believe that tenpy pins to MKL, however there are compilation errors and version 7.2 is installed instead of 9.0.

Do you know of another way to try to pin them?
Thank you in advance.
User avatar
Johannes
Site Admin
Posts: 413
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: Linking against MKL

Post by Johannes »

It's documented in the conda-forge docs here.

I think that's actually fine and properly linked against mkl.
I've checked, and when I start from a fresh conda environment defined by TeNPy's environment.yml, I also get the

Code: Select all

# All requested packages already installed.
Indeed, when I checked the installed packages with conda list, the libblas and liblapacke package already have been the *_mkl versions.
Apparently, conda-forge changed to default to MKL now also on Linux systems (it's the default on windows for a while already).

When installing TeNPy from source with pip install -e . from within the git repository, i end up with:

Code: Select all

>>> import tenpy
>>> tenpy.show_config()
tenpy 0.9.0.dev112+d66ef49 (compiled with HAVE_MKL),
git revision d66ef49e15fc05cbc76e9f19c67b14884dc01569 using
python 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:39:04) [GCC 10.3.0]
numpy 1.22.4, scipy 1.8.1
>>> import numpy
>>> numpy.show_config()
blas_info:
    libraries = ['cblas', 'blas', 'cblas', 'blas']
    library_dirs = ['/opt/miniconda3/envs/tenpy_mkl_2022_01/lib']
    include_dirs = ['/opt/miniconda3/envs/tenpy_mkl_2022_01/include']
    language = c
    define_macros = [('HAVE_CBLAS', None)]
blas_opt_info:
    define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)]
    libraries = ['cblas', 'blas', 'cblas', 'blas']
    library_dirs = ['/opt/miniconda3/envs/tenpy_mkl_2022_01/lib']
    include_dirs = ['/opt/miniconda3/envs/tenpy_mkl_2022_01/include']
    language = c
lapack_info:
    libraries = ['lapack', 'blas', 'lapack', 'blas']
    library_dirs = ['/opt/miniconda3/envs/tenpy_mkl_2022_01/lib']
    language = f77
lapack_opt_info:
    libraries = ['lapack', 'blas', 'lapack', 'blas', 'cblas', 'blas', 'cblas', 'blas']
    library_dirs = ['/opt/miniconda3/envs/tenpy_mkl_2022_01/lib']
    language = c
    define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)]
    include_dirs = ['/opt/miniconda3/envs/tenpy_mkl_2022_01/include']
Supported SIMD extensions in this NumPy install:
    baseline = SSE,SSE2,SSE3
    found = SSSE3,SSE41,POPCNT,SSE42,AVX,F16C,FMA3,AVX2,AVX512F,AVX512CD,AVX512_SKX,AVX512_CLX,AVX512_CNL,AVX512_ICL
    not found = AVX512_KNL,AVX512_KNM
Post Reply