MKL slower than openblas in intel cpu

Jae-Mo_Lihm
Mon, 28 Feb 2022 03:00:50 +0000
Performance

I found MKL is ~1.5 times slower than openblas for matrix-matrix multiplication (both without multithreading). Since I’m using intel CPU, I expected MKL to be faster.

Is there anything obviously wrong in this benchmark? Or is it not unexpected for MKL to be slower than openblas?

using LinearAlgebra, StaticArrays, BenchmarkTools
N = 400
M = 5000
A = rand(ComplexF64, N, M);
x = rand(ComplexF64, M, 3);
y = rand(ComplexF64, N, 3);
LinearAlgebra.BLAS.set_num_threads(1)
@btime mul!($y, $A, $x);
# 3.323 ms (0 allocations: 0 bytes)

using MKL
LinearAlgebra.BLAS.set_num_threads(1)
@btime mul!($y, $A, $x);
# 5.168 ms (0 allocations: 0 bytes)

julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) Gold 6230 CPU @ 2.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cascadelake)
Environment:
  JULIA = /home/jmlim/appl/julia-1.7.0/bin/julia

8 posts - 4 participants