MATLAB Answers

Can the latest AMD CPU support matlab2019 perfectly

246 views (last 30 days)
yifeng
yifeng on 6 Oct 2019
Commented: Yair Altman on 2 Apr 2020
I want to buy a PC with AMD CPU,but there are some bad comments on AMD CPU for it will get wrong when running matlab or shut down directly.
I want to konw that whether AMD r7 3700x or r5 3600 are compatible and stable with matlab 2019?and are them stronger than i7 9700?

  2 Comments

Star Strider
Star Strider on 15 Nov 2019
I have two computers using Ryzen processors that I use with MATLAB. They work well, and I have never experienced any problems with them.
Rubén García García
Rubén García García on 7 Apr 2020
Yo tengo un AMD 12 RADEON R7. Y por el momento me está causando problemas con Matlap. Es por eso que llegué a este sitio, investigando.

Sign in to comment.

Answers (2)

Ned Flanders
Ned Flanders on 20 Nov 2019
Edited: Ned Flanders on 2 Dec 2019
AMD CPUs are amongst the fastest thing you can buy for money for Matlab. However, you need to perform a very simple and quick configuration step of your windows/linux as of now to make them work efficiently.
You should read it if you want to understand the background. Also, you should make a feature request to Matlab to address this issue permanently.
Solution 1 (Windows): Create a .bat file using e.g. "Notepad" with the following lines to start Matlab in AVX2 Mode.
@echo off
set MKL_DEBUG_CPU_TYPE=5
matlab.exe
Save as .txt and rename to .bat. If you double-click that file, Matlab will start the MKL in AVX2 Mode. If you start it the normal way, it will remain as always.
You can also download the .bat file from my highdrive if you trust me (which typically you should not as I am a random guy from the internet). If you delete the startup batch file provided in the download or the one you created yourself, its gone and your computer will be as it has been before.
Solution 2 (Windows): If you are happy with the results (which you surely will be :-)), you should make the setting permanent by entering MKL_DEBUG_CPU_TYPE=5 into the System Environment Variables. This has several advantages, one of them being that it applies to all instances of Matlab and not just the one opened using the .bat file.
Doing this will make the change permanent and available to ALL Programs using the MKL on your system until you delete the entry again.
LINUX: (Thanks to foreignrobot)
Simply type in a terminal:
export MKL_DEBUG_CPU_TYPE=5
and then run matlab from the same terminal.
For benchmarking, you can use this script:
To make it permanent in Linux edit your shell's configuration scripts (~/.bashrc for bash, ~/.zshrc for zsh etc) adding the line export MKL_DEBUG_CPU_TYPE=5. That'll apply in any newly opened shell and to apply it in an already open one simply do . ~/.bashrc or whatever your config script name is. (Thanks to lowpolybutt)
P.S.: In case you are on an older AMD FX CPU, you could test whether MKL_DEBUG_CPU_TYPE=4 works for you. This should enable AVX, but I haven't tested this.

  3 Comments

Michal Kvasnicka
Michal Kvasnicka on 2 Dec 2019
This is really extraordinary tuning procedure for recent AMD CPU's. I do not understand why TMW does not apply this routinely during installation process.
I can confirm significant speed up for numerical intensive computations on AMD Epyc CPU's.
Ned Flanders
Ned Flanders on 2 Dec 2019
Glad it helped you! Please don't forget to submit a feature request with Mathworks.

Sign in to comment.


Derek Handwerk
Derek Handwerk on 15 Nov 2019
Matlab will run fine on an AMD cpu, but it will be terriblly slow. If you have an AMD cpu there is no reason you should use matlab if you care at all about the computations being fast. Either use an Intel processsor, or some other numerical solution where you can use openBLAS or the AMD math library.

  1 Comment

Michal Kvasnicka
Michal Kvasnicka on 2 Dec 2019
Now, you can run your Matlab on AMD CPU's significantly faster ?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by