Acceleration of Intel MKL on AMD Ryzen CPU's

RoyiAvital
Tue, 19 Nov 2019 21:35:18 +0000
Performance

Some of us use Intel MKL with Julia for improved performance.
Intel MKL is composed of few code paths for different features of the CPU (SSE2, SSE4, AVX2, AVX512, etc…).
One of the issues of MKL is it discriminate non Intel CPU’s and use the the generic SSE2 code path on AVX2 capable CPU’s.

This specifically hurts on Ryzen 3xxx series which have better AVX2 performance than Intel’s comparable CPU’s.

It seems people found a way around it. By defining System / Environment Variable users could enforce Intel MKL to use the AVX2 code path and skip the CPU Dispatching mechanism.

One could read about it:

How To Force MATLAB to Use a Fast Code Path on AMD Ryzen/TR CPUs.

MATLAB Code Path Tweak Massively Boosts AMD Ryzen CPUs’ Performance.

Though the above targets MATLAB I think it should work on Julia + MKL.

In Windows it requires:

@echo off

set MKL_DEBUG_CPU_TYPE=5
matlab.exe

It seems MKL_DEBUG_CPU_TYPE=5 suggests AVX2 capable CPU code path.
Where instead of launching MATLAB one should launch Julia.
The same should hols on other OS.

I wonder if one could integrate this trick into Juno (On Julia Pro for that matter).

35 posts - 12 participants