Does matlab use the AVX instruction set? If so what version?

42 visualizzazioni (ultimi 30 giorni)
Advanced Vector Instructions, or AVX, allows multiple floating point and integer operaions to be performed simultaneously, and is useful in vectorizing code (as I understand it anyhow, which admittedly my understanding of AVX is not very good). As such, it seems like the type of thing that would benefit Matlab, but I cant seem to find any info about whether or not Matlab actually does use it, or which version.
There seem to be 3 versions of AVX. AVX and AVX2 seem to be supported on most modern intel and AMD CPU's. AVX3 Appears to only be on some of the higher-end Intel server CPUs for the moment, but might be coming to mainstream CPU's when cannonlake CPU's that are due to be released later this year. AVX3 allows twice as many simultaneous calculations as AVX2.
It seems like AVX would be useful to Matlab, but I can't seem to find any info regarding if Matlab actually uses it. Does anyone know if matlab uses the AVX instruction set, and if so what version?

Risposta accettata

Jyotish Robin
Jyotish Robin il 24 Mar 2017
Hi Anthony!
The AVX support in MATLAB is limited to Linear Algebra functions and 'FFT' functions. The Linear Algebra support started in R2011b, and 'FFT' support started in R2012b. In some cases, the AVX support improved incrementally, so with newer MATLAB versions, you may see improved performance gain.
MATLAB takes advantage of the AVX2 instruction set through the MKL library only, meaning the usage is limited to linear algebra operations.
For example, element-wise operations such as +, .* would not use AVX2. But matrix multiply *, or backslash / would use AVX2.
Hope it helps!
  2 Commenti
Anthony Barone
Anthony Barone il 25 Mar 2017
Thank you very much for this answer. This is exactly the kind of information I was looking for!
I went ahead and marked this question as answered, but since you seem familiar with this topic I was hoping that you wouldn't mind me asking a couple additional questions. These questions are probably more difficult to answer, so if you can't help me with them I completely understand.
1) My motivation for asking about his is that I'm thinking about getting a new computer, and one thing I want is excellent Matlab performance. In particular I was thinking about one of the new Ryzen CPU's, but from what Ive heard these dont natively support 256-bit operations in AVX and AVX-2. Rather, that somehow combine 2 128-bit operations to simulate a 256-bit operation. Do you have any idea how that would effect the AVX implementation in Matlab for the functions that support AVX (assuming everything else is equal)? I assume the worse case scenario is that it would take twice as long to run, but I hope that in reality the difference is much less. Also, are the extra cores/threads that Ryzen cpu's have able to compensate for the reduced AVX performance in Matlab code that is NOT parallelized? In other words, can 2 128-bit AVX operations be done on 2 cores simultaneously to complete in the same time that a 256-it AVS operation would take on 1 core? (My understanding of AVX is not very good, so I dont know if it works this way or not).
2) Your reply indicates that AVX-512 is not implemented currently, correct? Any idea if there are plans to implement it in the future? I imagine the answer is "it might get implemented once it becomes more popular", but I figured I'd ask in case you are aware of any info on this.
Thanks again for the help!
Christine Tobler
Christine Tobler il 26 Apr 2018
The Intel MKL has been adding support for AVX-512 instructions ( release notes ). As MATLAB updates to newer versions, more linear algebra operations will start using AVX-512 instructions.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Historical Contests in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by