• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

How to Bypass Matlab’s ‘Cripple AMD CPU’ Function

thelastword

Banned
It's been silly out there......I know how many persons like to defend devs and companies implicitly, saying "don't talk down to devs" or too many conspiracy theories, even in the face of numerous evidence (Ubisoft anyone? Liberterte Fraternite, Egalite)...….The fact is, big companies with monopolies have and will do things to maintain such monopolies or their position......We have persons defending Intel or Nvidia to death when their track record and anti-consumer behavior is well documented and there's a huge blood trail that leads to their camp......…It's similar to "PAP-EA" buying original PC devs, taking them out back and pulling the hammer...…..These big companies have one thing on their minds...."Kill the competition". smother them, create false narratives for years ongoing through forums and various channels.......Like even recently you would still hear 'AMD has bad drivers", that is why I go with NV........"All I ever had was an Intel CPU, they're the best"......Well Bub, that's why there are reviews and research articles...…You want to know what's going on and has been going on in this industry, read, read read......

-----------------------------------------
"One of the difficulties of CPU reviews is that they represent the best time to evaluate new features and software — while simultaneously representing the worst possible time to attempt to do a deep dive on any specific piece of software. Sometimes, reviewers adopt tests because a vendor has recommended them, without considering whether the test will perform identically on an Intel versus an AMD system.

Sometimes, the vendor fails to disclose that an application is compiled in a manner that will lead to tests running much faster on one platform as opposed to another. This is one of those times. When I published Matlab data in our Threadripper 3970X / Cascade Lake X joint review, it was because Intel had recommended this test and workload as a showcase for Intel’s HEDT desktop line. I specifically asked for recommendations, hoping that Intel would have some applications in mind that would show relatively light scaling at or above the 18-core mark with AVX-512 integration.

Even professional apps don’t scale perfectly forever, and I knew going into this review that there was going to be a performance “island” for Intel to stand on at the intersection of higher clocks and lightly threaded applications. “Lightly,” in this context, should be understood to mean “apps that don’t scale all the way to 64 threads” as opposed to “apps that don’t scale past 4-8 threads,” which is usually what we mean when we call an app lightly threaded. It was obvious that Threadripper 3960X and 3970X were going to beat the 10980XE in every app that could scale to match their thread counts, especially in the 3970X’s case. With that as a given, it was worth exploring the areas that had historically been the strongest for Intel to see how performance would compare.

Intel recommended four workloads for this review: AIXPRT, Adobe Premiere Pro, Matlab, and Sony Catalyst. I wanted to spend more time evaluating AIXPRT before I started running it on systems, which made it less appealing. Adobe now requires that you provide them with a credit card in order to launch a 7-day free trial of their software, so that’s right out. I opted to test Matlab and Sony Catalyst. I was not aware of this investigation and report by redditor Nedflanders1976, made some eight days ago."

He writes.....

Matlab runs notoriously slow on AMD CPUs for operations that use the Intel Math Kernel Library (MKL). This is because the Intel MKL uses a discriminative CPU Dispatcher that does not use efficient codepath according to SIMD support by the CPU, but based on the result of a vendor string query. If the CPU is from AMD, the MKL does not use SSE3-SSE4 or AVX1/2 extensions but falls back to SSE1 no matter whether the AMD CPU supports more efficient SIMD extensions like AVX2 or not.

There’s a way to disable this behavior in Matlab. Flanders writes. If you are a Windows user with Matlab installed, create a batch file with the following data:

@echo off
set MKL_DEBUG_CPU_TYPE=5
matlab.exe

Start the application using this batch file. You can make this permanent by entering: “MKL_DEBUG_CPU_TYPE=5” into the System Environment Variables. Nedflanders1976 also has details on how to perform this task for Linux. We played around with testing some variant ideas, including setting “MKL_DYNAMIC=FALSE” and “MKL_NUM_THREADS=64” to see if these settings would improve performance. They did not. Best performance was obtained using the settings above.



Updated Matlab Results

"I have updated our Matlab results with new data, showing the impact of running the application in this mode. I display the total summary time for the entire workload at the bottom of each set of results. The top results show the performance of our three compared CPUs without any changes, the bottom chart shows the impact with the “set MKL_Debug_CPU_Type=5” flag. This may work for other applications that use the MKL library as well. It should be noted that in many cases, the CPU is only ~53-55 percent loaded during this test — a load level that correlates to 17-18 processor threads. In this case, however, these settings proved faster than forcing the MKL to use a higher number of threads. Telling the machine to use 48 or 64 threads only increased total execution time on the 3970X.


9MDPwcu.png



AMD’s performance improves by 1.32x – 1.37x overall. Individual test gains are sometimes much larger. Obviously these results are much worse for Intel, changing what looked like a narrow victory over the 3960X and a good showing against the 3970X into an all-out loss."

https://www.extremetech.com/computi...ss-matlab-cripple-amd-ryzen-threadripper-cpus

----------------------------------------------
The question is. for how many applications is this a reality? I'd wager many......I still remember so many applications just not making use of cores or something intrinsic in the coding that prevented better performance on AMD CPU's for one reason or another...…When you would think higher IPC CPU's, higher cache and cores should perform better.....I still remember ADOBE Premier on Ryzen +, I think it should have done better even then.......With Ryzen 3 it performs better of course, but there's just alot of questions you raise when you see such irregularities.......Fortnite is another, still performs better on Intel and before 2.0 had a huge gulf in favour of NV too, I watch this game, especially on the CPU side and I'm thinking this game should be loving AMD cores and cache, but something is still amiss there........Well I said amiss, "but you get it".......
 

Hudo

Member
Wow, I didn't know that. Well, l'll pass it on, thanks thelastword thelastword

Luckily for our research group, we're doing our data analysis with NumPy and if we need to do more "sophisticated stuff", we've got a Mathematica license, I think. And there's also R, of course.

But it's a pretty shady practice for sure. Even more so from Intel, considering that they use Matlab for performance comparisons.
 

FranXico

Member
Wow, I didn't know that. Well, l'll pass it on, thanks thelastword thelastword

Luckily for our research group, we're doing our data analysis with NumPy and if we need to do more "sophisticated stuff", we've got a Mathematica license, I think. And there's also R, of course.

But it's a pretty shady practice for sure. Even more so from Intel, considering that they use Matlab for performance comparisons.
OP shows a good example of why academic research chooses to use primarily open source tools and libraries. So they don't have to deal with this crap.
 

FranXico

Member
This is some nice info for students and researchers but what's it doing in gaming?
Games that use Intel proprietary libraries will likely also be running poorly on AMD CPUs.

Well, if they do...
Fortnite is another, still performs better on Intel and before 2.0 had a huge gulf in favour of NV too, I watch this game, especially on the CPU side and I'm thinking this game should be loving AMD cores and cache, but something is still amiss there........Well I said amiss, "but you get it".......
 
Last edited:

PhoenixTank

Member
tl;dr:
Matlab uses an Intel library that doesn't correctly check (or check by default?) what instructions CPU is capable of, making non-Intel chips use slower instructions instead. Intel suggested that Matlab be used to benchmark CPU performance.
When not crippled by the library, the AMD CPUs win.
 

Shifty

Member
1a9.gif


...ok zoomer

tl;dr:
Matlab uses an Intel library that doesn't correctly check (or check by default?) what instructions CPU is capable of, making non-Intel chips use slower instructions instead. Intel suggested that Matlab be used to benchmark CPU performance.
When not crippled by the library, the AMD CPUs win.
Props for attempting to rescue this thread's discourse potential from that avalanche of an OP.

Number-crunching stuff like the Intel Math Kernel Library in question tend to live on the academic/production side of computing, so while there's potential for stuff like backend tools and 3D modeling software to be affected by a dodgy library, I don't see it touching the game code that ends up reaching us.

Taking the Fortnite idea as an example, I'm pretty sure UE4 implements its own types for vector math which are available for perusal on GitHub if you have a free developer account. If there's any problem there, it'll be with UE4's core code rather than some spooky Intel DLL.
 
Last edited:

PhoenixTank

Member
Props for attempting to rescue this thread's discourse potential from that avalanche of an OP.

Number-crunching stuff like the Intel Math Kernel Library in question tend to live on the academic/production side of computing, so while there's potential for stuff like backend tools and 3D modeling software to be affected by a dodgy library, I don't see it touching the game code that ends up reaching us.

Taking the Fortnite idea as an example, I'm pretty sure UE4 implements its own types for vector math which are available for perusal on GitHub if you have a free developer account. If there's any problem there, it'll be with UE4's core code rather than some spooky Intel DLL.
Oh definitely, this library in particular is unlikely to affect the gaming side of things. I have to admit I hadn't really got to that part of the OP before assuming it was just a complete copy paste of the article.
A lot of this evokes a similar chill to the whole Athlon & Intel compiler cluster from years ago, that the author brings up. I want to assume incompetence rather than malice on the library developer's part... but combined with Intel recommending this package and the history, I'm not feeling so generous.
Hopefully this is a one-off but a lot of this comes down to sustained market penetration so that developers have more diverse hardware allowing for "Huh. That doesn't seem right..." moments and further investigation.
 

thelastword

Banned
I don't know about the alleged controversy behind it, but if this truly does benefit performance on AMD threadripper CPUs this is a helpful post. Thanks thelastword thelastword
Wow, I didn't know that. Well, l'll pass it on, thanks thelastword thelastword

Luckily for our research group, we're doing our data analysis with NumPy and if we need to do more "sophisticated stuff", we've got a Mathematica license, I think. And there's also R, of course.

But it's a pretty shady practice for sure. Even more so from Intel, considering that they use Matlab for performance comparisons.
That's... not shady at all.

Thanks for heads up, thelastword thelastword .
The cpu's being tested just launched, there are implications in gaming as well, as Intel ensuring they carry the gaming crown is especially important to them. Anybody remembers Intel's challenge to AMD with its 9900k vs their Ryzen 3000 series? .... If Intel is doing this with Matlab, there's no question they do this with gaming as well. It's also rather strange how finicky Intel has become with cinebench, when they had no issues when they were beating AMD chips there..... If Nvidia could try to cripple AMD with game works, so would Intel, where pretty much 95+ had "Intel inside" at one point.....AMD had lots of grass to chop down to get to here and many traps, they had to undo in the process........ It's still a work in progress to get many of these software houses to remove said limitations in their software, which includes games and certain engines.....

Some of the cpu disparity we see in some games is especially mind-boggling in light of better IPC on these AMD chips.....In some gaming benches amd soars, but in another it's getting walloped whilst cpu utilization is down, in essence, hardly any gains on amd chips regardless of their tier, whilst Intel's performance scales up to tier...

Personally, I just want to see all cpu's utilized to their max potential and gpu's as well, so I think it's important to highlight such encroachments to fair play.
 

Melon Husk

Member
Fixed in 2020a

According to NedFlanders1976 (the same individual who made the original Reddit report), MathWorks has incorporated a permanent path fix into Matlab 2020a, the latest version of its application. Essentially, Matlab now always starts in a mode that allows it to run AVX2 code on AMD CPUs. Previously, you could only force this capability by creating a System Environment Variable or a special batch file to launch the program.

 

M1chl

Currently Gif and Meme Champion
Why is this in gaming? Are any of the matlab libraries are used in games?
 

M1chl

Currently Gif and Meme Champion
There may be some games that run better on intel, for no reason other than artificial restrictions
Single core performance is still intel thing. https://www.cpubenchmark.net/singleThread.html
I can't hate on people who makes single thread games, since ithreading is downright evil. Especially whne you also developing your own egine.

There isn't a dedicated tech section.
Sure but off-topic is sufficient for this, I think : )
 
Top Bottom