Intel MKL on Mac

Intel Math Kernel Library (Intel MKL) is …

a library of optimized math routines for science, engineering, and financial applications. 

Wikipedia (https://en.wikipedia.org/wiki/Math_Kernel_Library)

Intel MKL include BLAS, LAPACK, FFT, and so on. And, it’s free.

I installed intel MKL on Mac and this is the log.

Download intel MKL

Visit intel MKL web site. And, “Choose and Download”.

Choose “macOS”.

Choose “Register & Download”.

Fill out the fields and submit.

Now, you can download intel MKL.

Install MKL

Open the download file and install it.

Setting Environment Variables

In your .bashrc or .bash_profile, add the following. You may modify the path to “mklvars.sh”.

source /opt/intel/mkl/bin/mklvars.sh intel64

Test

Write the following code and save as “blas_mkl.cpp”.

Compile and Run.

> g++ -DMKL_ILP64 -m64 -I${MKLROOT}/include  ${MKLROOT}/lib/libmkl_intel_ilp64.a ${MKLROOT}/lib/libmkl_intel_thread.a ${MKLROOT}/lib/libmkl_core.a -liomp5 -lpthread -lm -ldl -o blas_mkl blas_mkl.cpp
> ./blas_mkl

You can find the link line using Intel® Math Kernel Library Link Line Advisor.

Reference

3 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *