https://en.wikipedia.org/wiki/Math_Kernel_Library#Performanc...
This is quite bad, since a lot of software relies on Intel MKL as the default BLAS implementation (e.g. PyTorch binaries).
It may even be easier to replace the function altogether with LD_PRELOAD.
Make a file with the following content:
int mkl_serv_intel_cpu_true() {
return 1;
}
Compile gcc -shared -o libfake.so fake.c
Run LD_PRELOAD=libfake.so yourprogram
And it uses the optimized AVX codepaths.Disclaimer: may not be legal in your country. I take no responsibility.
patchelf --add-needed libfakeintel.so yourbinaryOf course, the second one makes no sense as x86 programs run just as fine on AMD as Intel with the same feature set (albeit at different speeds)
Is there something I can add to my bashrc to handle that?
If that fails, as OP implies, you can still override the function by creating a tiny library with it always returning true. On GNU/Linux systems, you do that using LD_PRELOAD. Perhaps someone's already done that so you just need to download, compile and set it.
Sorry for the lack of specifics, but I do not deal with these libraries, yet I was still hoping to point you in the right direction.
When run on an AMD, any program built with Intel's compiler should have the environment variable set. I don't think there is any downside to leaving it on all the time, unless you are measuring how badly Intel has tried to cripple your AMD performance.