AMD Ryzen 5950X slow with MKL 2020.0 and MKL_DEBUG_CPU_TYPE=



我刚买了一台Ryzen 5950x的电脑,通过检查bench命令的结果,它在Matlab 2020b上运行得很快。

我遵循了在线建议,全局设置了MKL_DEBUG_CPU_TYPE=5,使用MKL 2020.0。我通过anaconda安装了python 3.8.5,使用numpy 1.20.0

当我使用以下5950x代码尝试numpy时,平均需要28秒。我有另一台带有英特尔i7-8700的电脑,它只需要0.66秒

有人能告诉我为什么吗?或者我应该安装BLAS而不是MKL?

import numpy as np
import os
from time import time
print(os.environ.get('MKL_DEBUG_CPU_TYPE')) # it should print 5
# Let's take the randomness out of random numbers (for reproducibility)
np.random.seed(0)
size = 4096
A, B = np.random.random((size, size)), np.random.random((size, size))
C, D = np.random.random((size * 128,)), np.random.random((size * 128,))
E = np.random.random((int(size / 2), int(size / 4)))
F = np.random.random((int(size / 2), int(size / 2)))
F = np.dot(F, F.T)
G = np.random.random((int(size / 2), int(size / 2)))
N = 5
t = time()
for i in range(N):
np.dot(A, B)
delta = time() - t
print('Dotted two %dx%d matrices in %0.2f s.' % (size, size, delta / N))

请安装intel-oneapi-mkl-2021。对ryzen的支持嵌入其中。您不必编写MKL_DEBUG_...

您可以点击链接:intel oneapi

最新更新