When you purchase through links on our site, we may earn an affiliate commission. Here’s how it works.

MATLAB codepath tweak massively boosts AMD Ryzen CPUs' performance

Reddit users by the names 'nedflanders1976' and 'foreignrobot' have devised a simple tweak that massively boosts the performance of AMD Ryzen CPUs in MATLAB.

Apparently, when MATLAB and similar Intel MKL-based applications are run, they perform a vendor string query and upon detection of an AMD CPU (AuthenticAMD), these applications are executed using older SSE1 instruction, even if the said CPU supports newer SIMD extensions. AMD processors have had support for AVX2 instructions since the 'Excavator' architecture and this fix enforces the use of AVX2 instruction on supported AMD CPUs.

As expected, there is a significant performance boost to be had due to the use of this newer more efficient instruction.

In the case of Matrix manipulation, there is up to a 258% boost in performance.

The integrated MATLAB benchmark also sees a similar gain in performance by moving to AVX2.

To start MATLAB in an AVX2-enabled mode, the following batch file has to be created and run.

@echo off

call "%MKLROOT%\bin\mklvars.bat" MKL_DEBUG_CPU_TYPE=5

To use this setting permanently, assuming there is no issue in your system post applying this tweak, the following "system environment variable" has to be created which can be found in the "Advanced" section of system properties.

The AVX2 mode can also be activated in the Linux environment by launching this terminal:


And to make the setting permanent in the Linux environment, type in the same thing by editing your shell's configuration script (~/.bashrc for bash, ~/.zshrc for zsh, etc.)

Source: Reddit

Report a problem with article
Next Article

T-Mobile CEO John Legere is stepping down next year

Previous Article

Logitech releases an Adaptive Gaming Kit for the Xbox Adaptive Controller, at $99.99

Join the conversation!

Login or Sign Up to read and post a comment.

8 Comments - Add comment