3

I would like to know if there is a way i can use Intel MKL library instead of OpenBlas. I have installed MKL. Below is the version info

Julia Version 0.6.0
Commit 903644385b (2017-06-19 13:05 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

Kindly let me know if this can be done

Kanan Jarrus
  • 607
  • 1
  • 12
  • 26

2 Answers2

3

This is the procedure I have used to install Julia (0.6.0) with Intel MKL (compiling from source) in macOS Sierra. Remember to uninstall previous versions of Julia first.

  • Install Xcode.
  • Launch a Terminal and update the command line tools:

    $ xcode-select --install
    
  • Install Homebrew.

  • Use Homebrew to install gfortran:

    $ brew install gfortran
    
  • Take advantage of Homebrew and install also wget:

    $ brew install wget
    
  • Go to the Intel Performance Libraries webpage, register yourself and download these free libraries for OS X and install them (as with a regular DMG package):

    1. Intel Threading Building Blocks (TBB)
    2. Intel Math Kernel Library (MKL)
  • Download the Julia source (Tarball with dependencies):

    $ wget https://github.com/JuliaLang/julia/releases/download/v0.6.0/julia-0.6.0-full.tar.gz
    
  • Uncompress the file and move the folder to your $HOME directory.

  • Launch a Terminal and change to the Julia source directory:

    $ cd ~/julia-0.6.0
    
  • With your preferred tool, edit the file Make.inc and enable the use of Intel MKL and Intel MKL FFT. Save and close the file. Use the picture as a guide:

Enabling Intel MKL in Make.inc

  • Set up the Intel MKL environment, for Intel64 architecture with 8 bytes integer support (ILP64):

    $ source /opt/intel/mkl/bin/mklvars.sh intel64 ilp64
    
  • Compile Julia:

    $ make
    
  • If there is a problem compiling Julia, create a symbolic link in the Julia's lib folder to the Intel MKL library and run make again:

    $ ln -s /opt/intel/mkl/lib/libmkl_rt.dylib usr/lib/libmkl_rt.dylib
    $ make
    
  • I did not try to run make install because I do not have Administrator privileges in my Mac, but you are free to do it. Anyway, you can run Julia from this folder:

    $ ./julia
    
  • Next time you open a Terminal probably your Intel MKL variables would have gone. Just add these lines to your ~/.bash_profile:

    # Intel MKL
    source /opt/intel/mkl/bin/mklvars.sh intel64 ilp64
    
Guillermo Luque
  • 458
  • 4
  • 7
  • Do note that the intel links need to be opened with a chrome browser, or you'll be linked to a broken form page. – danieltan95 Sep 27 '20 at 13:50
1

Yes this is possible but much easier to do if you are happy to re-install a clean version of julia.

You will need to edit the Make.user file as described here: https://github.com/JuliaLang/julia#intel-compilers-and-math-kernel-library-mkl

Alexander Morley
  • 4,111
  • 12
  • 26
  • thank you very much for the response. I have installed Julia using macOS dmg package hence I am unable find Make.inc file. Kindly let me know if there any other way to Setup MKL. – Kanan Jarrus Jul 12 '17 at 16:38
  • Sorry the only way I know is if you install it from source. It's not too difficult if you follow the guidelines on the above link. – Alexander Morley Jul 12 '17 at 20:55