Skip to content

py-numpy linking to intel mkl while compiling with gcc and openblas? #5327

@pramodskumbhar

Description

@pramodskumbhar

I was bit confused by libmkl_rt in gcc compiled numpy:

$ find /gpfs/bbp.cscs.ch/scratch/gss/bgq/kumbhar-adm/SPACK_HOME/install_home/bbpviz_full/install/linux-rhel6-x86_64/gcc-5.3.0/py-numpy-1.13.1-lhfffv6h/ -name "*.so" -exec ldd {} \; -exec grep mkl {} \;
	linux-vdso.so.1 =>  (0x00007fff38112000)
.......
Binary file /gpfs/bbp.cscs.ch/scratch/gss/bgq/kumbhar-adm/SPACK_HOME/install_home/bbpviz_full/install/linux-rhel6-x86_64/gcc-5.3.0/py-numpy-1.13.1-lhfffv6h/lib/python2.7/site-packages/numpy/linalg/lapack_lite.so matches
	linux-vdso.so.1 =>  (0x00007ffc5bfba000)
	libmkl_rt.so => not found
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff4906df000)

Looking into spec we don't see any Intel or MKL dependency :

$ spack spec -y /lhfffv6h
spec:
- py-numpy:
    version: 1.13.1
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      blas: true
      lapack: true
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    dependencies:
      openblas:
        hash: tgtgdmq2dgjfvktxmizfo3gadxkerjxc
        type:
        - build
        - link
      python:
        hash: dhkjobmenmlls3dqb2xf3vel22fdrczc
        type:
        - build
        - link
        - run
    hash: lhfffv6hlf5d5hnljecb574ocevmvbhq
- openblas:
    version: 0.2.20
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      openmp: true
      pic: true
      shared: true
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    hash: tgtgdmq2dgjfvktxmizfo3gadxkerjxc
- python:
    version: 2.7.13
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      shared: true
      tk: false
      ucs4: false
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    dependencies:
      bzip2:
        hash: npjovariojv5p4pml2t6e3prwuvfpucy
        type:
        - build
        - link
      ncurses:
        hash: drvhqydmzj53gsnf32gykluasamrtbbi
        type:
        - build
        - link
      openssl:
        hash: hkpcjq2zk7qdrrjz35m44tzrpiikdu33
        type:
        - build
        - link
      readline:
        hash: u2nuuoap42ogsgp3py4q7bjunqjyhlfl
        type:
        - build
        - link
      sqlite:
        hash: g2xodjde4jxzbdijstqv3gqwv3tiwnfk
        type:
        - build
        - link
      zlib:
        hash: cabzx2gna7p6g6tsll42c4q3aia2gx4e
        type:
        - build
        - link
    hash: dhkjobmenmlls3dqb2xf3vel22fdrczc
- bzip2:
    version: 1.0.6
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      shared: true
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    hash: npjovariojv5p4pml2t6e3prwuvfpucy
- ncurses:
    version: 5.7.4
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      symlinks: false
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    external:
      module: false
      path: /usr
    hash: drvhqydmzj53gsnf32gykluasamrtbbi
- openssl:
    version: '1.0'
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    external:
      module: false
      path: /usr
    hash: hkpcjq2zk7qdrrjz35m44tzrpiikdu33
- readline:
    version: 6.0.4
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    external:
      module: false
      path: /usr
    hash: u2nuuoap42ogsgp3py4q7bjunqjyhlfl
- sqlite:
    version: 3.6.20
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    external:
      module: false
      path: /usr
    hash: g2xodjde4jxzbdijstqv3gqwv3tiwnfk
- zlib:
    version: 1.2.11
    arch:
      platform: linux
      platform_os: rhel6
      target: x86_64
    compiler:
      name: gcc
      version: 5.3.0
    namespace: builtin
    parameters:
      pic: true
      shared: true
      cflags: []
      cppflags: []
      cxxflags: []
      fflags: []
      ldflags: []
      ldlibs: []
    hash: cabzx2gna7p6g6tsll42c4q3aia2gx4e

If I look at build.out then we see some MKL related stuff:

==> Executing phase: 'build'
==> '/gpfs/bbp.cscs.ch/scratch/gss/bgq/kumbhar-adm/SPACK_HOME/install_home/bbpviz_full/install/linux-rhel6-x86_64/gcc-5.3.0/python-2.7.13-dhkjobme/bin/python2.7' 'setup.py' '--no-user-cfg' 'build' '-j' '16'
Running from numpy source directory.
blas_opt_info:
blas_mkl_info:
  FOUND:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/gpfs/bbp.cscs.ch/home/kumbhar-adm/SPACK_HOME/install_home/externals/install/linux-rhel6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.4/compilers_and_libraries_2017.4.196/linux/mkl/lib/intel64']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/gpfs/bbp.cscs.ch/home/kumbhar-adm/SPACK_HOME/install_home/externals/install/linux-rhel6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.4/compilers_and_libraries_2017.4.196/linux/mkl', '/gpfs/bbp.cscs.ch/home/kumbhar-adm/SPACK_HOME/install_home/externals/install/linux-rhel6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.4/compilers_and_libraries_2017.4.196/linux/mkl/include', '/gpfs/bbp.cscs.ch/home/kumbhar-adm/SPACK_HOME/install_home/externals/install/linux-rhel6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.4/compilers_and_libraries_2017.4.196/linux/mkl/lib']

  FOUND:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/gpfs/bbp.cscs.ch/home/kumbhar-adm/SPACK_HOME/install_home/externals/install/linux-rhel6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.4/compilers_and_libraries_2017.4.196/linux/mkl/lib/intel64']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/gpfs/bbp.cscs.ch/home/kumbhar-adm/SPACK_HOME/install_home/externals/install/linux-rhel6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.4/compilers_and_libraries_2017.4.196/linux/mkl', '/gpfs/bbp.cscs.ch/home/kumbhar-adm/SPACK_HOME/install_home/externals/install/linux-rhel6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.4/compilers_and_libraries_2017.4.196/linux/mkl/include', '/gpfs/bbp.cscs.ch/home/kumbhar-adm/SPACK_HOME/install_home/externals/install/linux-rhel6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.4/compilers_and_libraries_2017.4.196/linux/mkl/lib']

....

And if I look at build.env we have :

MIC_LD_LIBRARY_PATH=/some/mkl/path/
MIC_LIBRARY_PATH=/some/mkl/path/
MKLROOT=/some/mkl/path/

I assume we don't remove these variables like LD_LIBRARY_PATH and causing MKL getting linked to py-numpy? Or, anything obvious I am missing here?

EDIT: I confirm MKLROOT was set in my bash env.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions