Comparison between Mac Accelerate framework and Intel MKL

I installed intel MKL. So I want to compare intel MKL to Mac Accelerate Framework. Mac Accelerate is optimized to Mac. It’s interesting which is faster.

I compared them using cblas_dgemm function.

Source code for Mac Accelerate

Compile the following command.

c++ -framework Accelerate -o dgemm_accel dgemm_accel.cpp

Source code for Intel MKL

Compile the following command.

c++ -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 dgemm_mkl dgemm_mkl.cpp


Run both commands 3 times and the results are the following.

Mac Accelerate framework [sec]Intel MKL [sec]
Real timeCPU timeReal timeCPU time

Results shows Mac Accelerate framework and Intel MKL show the same performance. Or, MKL is a little bit faster. I don’t know why the CPU time is different…?


I compared MKL with “for loop program”, of which code is the following.

Compile and Run as the following.

> g++-8 -fopenmp -o dgemm_forloop dgemm_forloop.cpp
> for i in 100 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000;
      ./dgemm_forloop $i

The result is follow.

MKL is awesome!!

1 Comment

Leave a Comment

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